{"id":18392,"date":"2024-11-18T14:09:05","date_gmt":"2024-11-18T06:09:05","guid":{"rendered":"https:\/\/fwq.ai\/blog\/18392\/"},"modified":"2024-11-18T14:09:05","modified_gmt":"2024-11-18T06:09:05","slug":"linux%e4%b8%ad%e6%9f%a5%e7%9c%8b%e8%bf%9b%e7%a8%8b%e7%8a%b6%e6%80%81%e7%9a%84%e5%91%bd%e4%bb%a4","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/18392\/","title":{"rendered":"linux\u4e2d\u67e5\u770b\u8fdb\u7a0b\u72b6\u6001\u7684\u547d\u4ee4"},"content":{"rendered":"<blockquote><p>\n  \u67e5\u770b linux \u4e2d\u8fdb\u7a0b\u72b6\u6001\u7684\u547d\u4ee4\u5305\u62ec\uff1aps \u547d\u4ee4\uff1a\u663e\u793a\u6240\u6709\u6b63\u5728\u8fd0\u884c\u8fdb\u7a0b\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u53ef\u901a\u8fc7\u9009\u9879\u7ec6\u5316\u67e5\u8be2\u6761\u4ef6\u3002pidstat \u547d\u4ee4\uff1a\u63d0\u4f9b\u5355\u4e2a\u8fdb\u7a0b\u6216\u4e00\u7ec4\u8fdb\u7a0b\u7684\u8be6\u7ec6\u72b6\u6001\u4fe1\u606f\uff0c\u5982 cpu\u3001\u5185\u5b58\u3001\u78c1\u76d8 i\/o \u548c\u7f51\u7edc i\/o \u4f7f\u7528\u60c5\u51b5\u3002top \u547d\u4ee4\uff1a\u4ee5\u4ea4\u4e92\u5f0f\u65b9\u5f0f\u5b9e\u65f6\u663e\u793a\u8fdb\u7a0b\u72b6\u6001\u4fe1\u606f\uff0c\u5141\u8bb8\u7528\u6237\u6392\u5e8f\u3001\u8fc7\u6ee4\u548c\u7ec8\u6b62\u8fdb\u7a0b\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/17\/2024081719005167472.jpg\" class=\"aligncenter\" title=\"linux\u4e2d\u67e5\u770b\u8fdb\u7a0b\u72b6\u6001\u7684\u547d\u4ee4\u63d2\u56fe\" alt=\"linux\u4e2d\u67e5\u770b\u8fdb\u7a0b\u72b6\u6001\u7684\u547d\u4ee4\u63d2\u56fe\" \/><\/p>\n<p><strong>Linux \u4e2d\u67e5\u770b\u8fdb\u7a0b\u72b6\u6001\u7684\u547d\u4ee4<\/strong><\/p>\n<p><strong>ps \u547d\u4ee4<\/strong><\/p>\n<p>ps \u547d\u4ee4\u662f Linux \u4e2d\u6700\u5e38\u7528\u7684\u8fdb\u7a0b\u72b6\u6001\u67e5\u770b\u547d\u4ee4\u3002\u5b83\u63d0\u4f9b\u6709\u5173\u6240\u6709\u6b63\u5728\u8fd0\u884c\u8fdb\u7a0b\u7684\u8be6\u7ec6\u4fe1\u606f\u3002<\/p>\n<p><strong>\u8bed\u6cd5\uff1a<\/strong><\/p>\n<pre>ps [\u9009\u9879] [\u8fdb\u7a0b ID]<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u9009\u9879\uff1a<\/strong><\/p>\n<ul>\n<li>-A\uff1a\u663e\u793a\u6240\u6709\u8fdb\u7a0b\u3002<\/li>\n<li>-e\uff1a\u663e\u793a\u6240\u6709\u8fdb\u7a0b\u7684\u73af\u5883\u53d8\u91cf\u3002<\/li>\n<li>-f\uff1a\u663e\u793a\u5b8c\u6574\u683c\u5f0f\u8fdb\u7a0b\u8868\u3002<\/li>\n<li>-l\uff1a\u663e\u793a\u8be6\u7ec6\u4fe1\u606f\u8fdb\u7a0b\u8868\u3002<\/li>\n<li>-u\uff1a\u663e\u793a\u4e0e\u6307\u5b9a\u7528\u6237\u76f8\u5173\u7684\u8fdb\u7a0b\u3002<\/li>\n<\/ul>\n<p><strong>pidstat \u547d\u4ee4<\/strong><\/p>\n<p>pidstat \u547d\u4ee4\u63d0\u4f9b\u6709\u5173\u5355\u4e2a\u8fdb\u7a0b\u6216\u4e00\u7ec4\u8fdb\u7a0b\u7684\u8be6\u7ec6\u72b6\u6001\u4fe1\u606f\u3002<\/p>\n<p><strong>\u8bed\u6cd5\uff1a<\/strong><\/p>\n<pre>pidstat [\u9009\u9879] [pid] [\u95f4\u9694]<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u9009\u9879\uff1a<\/strong><\/p>\n<ul>\n<li>-h\uff1a\u663e\u793a\u5e2e\u52a9\u4fe1\u606f\u3002<\/li>\n<li>-u\uff1a\u663e\u793a CPU \u548c\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u4fe1\u606f\u3002<\/li>\n<li>-d\uff1a\u663e\u793a\u78c1\u76d8 I\/O \u4fe1\u606f\u3002<\/li>\n<li>-r\uff1a\u663e\u793a\u7f51\u7edc I\/O \u4fe1\u606f\u3002<\/li>\n<\/ul>\n<p><strong>top \u547d\u4ee4<\/strong><\/p>\n<p>top \u547d\u4ee4\u63d0\u4f9b\u5b9e\u65f6\u8fdb\u7a0b\u72b6\u6001\u4fe1\u606f\u3002\u5b83\u4ee5\u4ea4\u4e92\u5f0f\u65b9\u5f0f\u663e\u793a\uff0c\u5141\u8bb8\u7528\u6237\u6392\u5e8f\u3001\u8fc7\u6ee4\u548c\u7ec8\u6b62\u8fdb\u7a0b\u3002<\/p>\n<p><strong>\u8bed\u6cd5\uff1a<\/strong><\/p>\n<pre>top [\u9009\u9879]<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u9009\u9879\uff1a<\/strong><\/p>\n<ul>\n<li>-c\uff1a\u663e\u793a\u547d\u4ee4\u884c\u3002<\/li>\n<li>-n\uff1a\u6307\u5b9a\u8981\u663e\u793a\u7684\u8fdb\u7a0b\u6570\u3002<\/li>\n<li>-p\uff1a\u6307\u5b9a\u7279\u5b9a\u8fdb\u7a0b ID\u3002<\/li>\n<\/ul>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<ul>\n<li>\u5217\u51fa\u6240\u6709\u8fdb\u7a0b\uff1a<\/li>\n<\/ul>\n<pre>ps -A<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u663e\u793a\u4e0e\u7528\u6237 &#8220;john&#8221; \u76f8\u5173\u7684\u8fdb\u7a0b\uff1a<\/li>\n<\/ul>\n<pre>ps -u john<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u663e\u793a\u8fdb\u7a0b 1234 \u7684\u8be6\u7ec6\u4fe1\u606f\uff1a<\/li>\n<\/ul>\n<pre>ps -l 1234<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u76d1\u63a7\u8fdb\u7a0b 1234 \u7684 CPU \u4f7f\u7528\u60c5\u51b5\uff1a<\/li>\n<\/ul>\n<pre>pidstat -u 1234 1<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u5b9e\u65f6\u663e\u793a\u6240\u6709\u8fdb\u7a0b\u7684\u72b6\u6001\uff1a<\/li>\n<\/ul>\n<pre>top<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u4e2d\u67e5\u770b\u8fdb\u7a0b\u72b6\u6001\u7684\u547d\u4ee4\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u67e5\u770b linux \u4e2d\u8fdb\u7a0b\u72b6\u6001\u7684\u547d\u4ee4\u5305\u62ec\uff1aps \u547d\u4ee4\uff1a\u663e\u793a\u6240\u6709\u6b63\u5728\u8fd0\u884c\u8fdb\u7a0b\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u53ef\u901a\u8fc7\u9009\u9879\u7ec6\u5316\u67e5\u8be2\u6761\u4ef6\u3002pidstat \u547d\u4ee4\uff1a\u63d0\u4f9b\u5355\u4e2a\u8fdb\u7a0b\u6216\u4e00\u7ec4\u8fdb\u7a0b\u7684\u8be6\u7ec6\u72b6\u6001\u4fe1\u606f\uff0c\u5982 cpu\u3001\u5185\u5b58\u3001\u78c1\u76d8 i\/o \u548c\u7f51\u7edc i\/o \u4f7f\u7528\u60c5\u51b5\u3002top \u547d\u4ee4\uff1a\u4ee5\u4ea4\u4e92\u5f0f\u65b9\u5f0f\u5b9e\u65f6\u663e\u793a\u8fdb\u7a0b\u72b6\u6001\u4fe1\u606f\uff0c\u5141\u8bb8\u7528\u6237\u6392\u5e8f\u3001\u8fc7\u6ee4\u548c\u7ec8\u6b62\u8fdb\u7a0b\u3002 Linux \u4e2d\u67e5\u770b\u8fdb\u7a0b\u72b6\u6001\u7684\u547d\u4ee4 ps \u547d\u4ee4 ps \u547d\u4ee4\u662f Linux \u4e2d\u6700\u5e38\u7528\u7684\u8fdb\u7a0b\u72b6\u6001\u67e5\u770b\u547d\u4ee4\u3002\u5b83\u63d0\u4f9b\u6709\u5173\u6240\u6709\u6b63\u5728\u8fd0\u884c\u8fdb\u7a0b\u7684\u8be6\u7ec6\u4fe1\u606f\u3002 \u8bed\u6cd5\uff1a ps [\u9009\u9879] [\u8fdb\u7a0b ID] \u767b\u5f55\u540e\u590d\u5236 \u9009\u9879\uff1a -A\uff1a\u663e\u793a\u6240\u6709\u8fdb\u7a0b\u3002 -e\uff1a\u663e\u793a\u6240\u6709\u8fdb\u7a0b\u7684\u73af\u5883\u53d8\u91cf\u3002 -f\uff1a\u663e\u793a\u5b8c\u6574\u683c\u5f0f\u8fdb\u7a0b\u8868\u3002 -l\uff1a\u663e\u793a\u8be6\u7ec6\u4fe1\u606f\u8fdb\u7a0b\u8868\u3002 -u\uff1a\u663e\u793a\u4e0e\u6307\u5b9a\u7528\u6237\u76f8\u5173\u7684\u8fdb\u7a0b\u3002 pidstat \u547d\u4ee4 pidstat \u547d\u4ee4\u63d0\u4f9b\u6709\u5173\u5355\u4e2a\u8fdb\u7a0b\u6216\u4e00\u7ec4\u8fdb\u7a0b\u7684\u8be6\u7ec6\u72b6\u6001\u4fe1\u606f\u3002 \u8bed\u6cd5\uff1a pidstat [\u9009\u9879] [pid] [\u95f4\u9694] \u767b\u5f55\u540e\u590d\u5236 \u9009\u9879\uff1a -h\uff1a\u663e\u793a\u5e2e\u52a9\u4fe1\u606f\u3002 -u\uff1a\u663e\u793a CPU \u548c\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u4fe1\u606f\u3002 -d\uff1a\u663e\u793a\u78c1\u76d8 I\/O \u4fe1\u606f\u3002 -r\uff1a\u663e\u793a\u7f51\u7edc I\/O \u4fe1\u606f\u3002 top \u547d\u4ee4 top [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-18392","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/18392","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=18392"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/18392\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=18392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=18392"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=18392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}