{"id":4008,"date":"2013-12-24T00:28:40","date_gmt":"2013-12-23T16:28:40","guid":{"rendered":"https:\/\/www.icocean.com\/wp\/?p=4008"},"modified":"2013-12-24T00:28:48","modified_gmt":"2013-12-23T16:28:48","slug":"linux%e4%b8%8b%e5%a6%82%e4%bd%95%e6%9f%a5%e7%9c%8b%e9%ab%98cpu%e5%8d%a0%e7%94%a8%e7%8e%87%e7%ba%bf%e7%a8%8b-linux-cpu%e5%88%a9%e7%94%a8%e7%8e%87%e8%ae%a1%e7%ae%97","status":"publish","type":"post","link":"https:\/\/www.icocean.com\/blog\/?p=4008","title":{"rendered":"Linux\u4e0b\u5982\u4f55\u67e5\u770b\u9ad8CPU\u5360\u7528\u7387\u7ebf\u7a0b LINUX CPU\u5229\u7528\u7387\u8ba1\u7b97"},"content":{"rendered":"<div>\n<div>\n<p><a href=\"http:\/\/blog.csdn.net\/chen3888015\/article\/details\/7432868\" rel=\"nofollow\">http:\/\/blog.csdn.net\/chen3888015\/article\/details\/7432868<\/a><\/p>\n<p>\u5728 Linux \u4e0b top \u5de5\u5177\u53ef\u4ee5\u663e\u793a cpu \u7684\u5e73\u5747\u5229\u7528\u7387(user,nice,system,idle,iowait,irq,softirq,etc.)\uff0c\u53ef\u4ee5\u663e\u793a\u6bcf\u4e2a cpu \u7684\u5229\u7528\u7387\u3002\u4f46\u662f\u65e0\u6cd5\u663e\u793a\u6bcf\u4e2a\u7ebf\u7a0b\u7684 cpu \u5229\u7528\u7387\u60c5\u51b5\uff0c<br \/>\n\u8fd9\u65f6\u5c31\u53ef\u80fd\u51fa\u73b0\u8fd9\u79cd\u60c5\u51b5\uff0c\u603b\u7684 cpu \u5229\u7528\u7387\u4e2d user \u6216 system \u5f88\u9ad8\uff0c\u4f46\u662f\u7528\u8fdb\u7a0b\u7684 cpu \u5360\u7528\u7387\u8fdb\u884c\u6392\u5e8f\u65f6\uff0c\u6ca1\u6709\u8fdb\u7a0b\u7684 user \u6216 system \u4e0e\u4e4b\u5bf9\u5e94\u3002<\/p>\n<p>\u53ef\u4ee5\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u5c06 cpu \u5360\u7528\u7387\u9ad8\u7684\u7ebf\u7a0b\u627e\u51fa\u6765:<br \/>\n<strong>\u00a0ps H -eo user,pid,ppid,tid,time,%cpu,cmd &#8211;sort=%cpu<\/strong><\/p>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u9996\u5148\u6307\u5b9a\u53c2\u6570&#8217;H&#8217;\uff0c\u663e\u793a\u7ebf\u7a0b\u76f8\u5173\u7684\u4fe1\u606f\uff0c\u683c\u5f0f\u8f93\u51fa\u4e2d\u5305\u542b:user,pid,ppid,tid,time,%cpu,cmd\uff0c\u7136\u540e\u518d\u7528%cpu\u5b57\u6bb5\u8fdb\u884c\u6392\u5e8f\u3002\u8fd9\u6837\u5c31\u53ef\u4ee5\u627e\u5230\u5360\u7528\u5904\u7406\u5668\u7684\u7ebf\u7a0b\u4e86\u3002<!--more--><\/p>\n<h2>proc\u6587\u4ef6\u7cfb\u7edf<\/h2>\n<p>\/proc \u6587\u4ef6\u7cfb\u7edf\u662f\u4e00\u4e2a\u4f2a\u6587\u4ef6\u7cfb\u7edf\uff0c\u5b83\u53ea\u5b58\u5728\u5185\u5b58\u5f53\u4e2d\uff0c\u800c\u4e0d\u5360\u7528\u5916\u5b58\u7a7a\u95f4\u3002\u5b83\u4ee5\u6587\u4ef6\u7cfb\u7edf\u7684\u65b9\u5f0f\u4e3a\u5185\u6838\u4e0e\u8fdb\u7a0b\u63d0\u4f9b\u901a\u4fe1\u7684\u63a5\u53e3\u3002\u7528\u6237\u548c\u5e94\u7528\u7a0b\u5e8f\u53ef\u4ee5\u901a\u8fc7\/proc\u5f97\u5230 \u7cfb\u7edf\u7684\u4fe1\u606f\uff0c\u5e76\u53ef\u4ee5\u6539\u53d8\u5185\u6838\u7684\u67d0\u4e9b\u53c2\u6570\u3002\u7531\u4e8e\u7cfb\u7edf\u7684\u4fe1\u606f\uff0c\u5982\u8fdb\u7a0b\uff0c\u662f\u52a8\u6001\u6539\u53d8\u7684\uff0c\u6240\u4ee5\u7528\u6237\u6216\u5e94\u7528\u7a0b\u5e8f\u8bfb\u53d6\/proc\u76ee\u5f55\u4e2d\u7684\u6587\u4ef6\u65f6\uff0cproc\u6587\u4ef6\u7cfb\u7edf\u662f\u52a8 \u6001\u4ece\u7cfb\u7edf\u5185\u6838\u8bfb\u51fa\u6240\u9700\u4fe1\u606f\u5e76\u63d0\u4ea4\u7684\u3002<\/p>\n<p>\/proc \u76ee\u5f55\u4e2d\u6709\u4e00\u4e9b\u4ee5\u6570\u5b57\u547d\u540d\u7684\u76ee\u5f55\uff0c\u5b83\u4eec\u662f\u8fdb\u7a0b\u76ee\u5f55\u3002\u7cfb\u7edf\u4e2d\u5f53\u524d\u8fd0\u884c\u7684\u6bcf\u4e00\u4e2a\u8fdb\u7a0b\u5728\/proc\u4e0b\u90fd\u5bf9\u5e94\u4e00\u4e2a\u4ee5\u8fdb\u7a0b\u53f7\u4e3a\u76ee\u5f55\u540d\u7684\u76ee\u5f55\/proc\/pid\uff0c\u5b83\u4eec\u662f \u8bfb\u53d6\u8fdb\u7a0b\u4fe1\u606f\u7684\u63a5\u53e3\u3002\u6b64\u5916\uff0c\u5728Linux2.6.0-test6\u4ee5\u4e0a\u7684\u7248\u672c\u4e2d\/proc\/pid\u76ee\u5f55\u4e2d\u6709\u4e00\u4e2atask\u76ee\u5f55\uff0c\/proc\/pid\/task \u76ee\u5f55\u4e2d\u4e5f\u6709\u4e00\u4e9b\u4ee5\u8be5\u8fdb\u7a0b\u6240\u62e5\u6709\u7684\u7ebf\u7a0b\u7684\u7ebf\u7a0b\u53f7\u547d\u540d\u7684\u76ee\u5f55\/proc\/pid\/task\/tid\uff0c\u5b83\u4eec\u662f\u8bfb\u53d6\u7ebf\u7a0b\u4fe1\u606f\u7684\u63a5\u53e3\u3002<\/p>\n<h3>\/proc\/cpuinfo\u6587\u4ef6<\/h3>\n<p>\u8be5\u6587\u4ef6\u4e2d\u5b58\u653e\u4e86\u6709\u5173 cpu\u7684\u76f8\u5173\u4fe1\u606f(\u578b\u53f7\uff0c\u7f13\u5b58\u5927\u5c0f\u7b49)\u3002<\/p>\n<p>[zhengangen@buick ~]$ cat \/proc\/cpuinfo<\/p>\n<p>processor\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : 0<\/p>\n<p>vendor_id\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : GenuineIntel<\/p>\n<p>cpu family\u00a0\u00a0\u00a0\u00a0\u00a0 : 15<\/p>\n<p>model\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : 4<\/p>\n<p>model name\u00a0\u00a0\u00a0\u00a0\u00a0 : Intel(R)Xeon(TM) CPU 3.00GHz<\/p>\n<p>stepping\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : 10<\/p>\n<p>cpu MHz\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : 3001.177<\/p>\n<p>cache size\u00a0\u00a0\u00a0\u00a0\u00a0 : 2048 KB<\/p>\n<p>physical id\u00a0\u00a0\u00a0\u00a0 : 0<\/p>\n<p>siblings\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : 2<\/p>\n<p>core id\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : 0<\/p>\n<p>cpu cores\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : 1<\/p>\n<p>fdiv_bug\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : no<\/p>\n<p>hlt_bug\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : no<\/p>\n<p>f00f_bug\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : no<\/p>\n<p>coma_bug\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : no<\/p>\n<p>fpu\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : yes<\/p>\n<p>fpu_exception\u00a0\u00a0 : yes<\/p>\n<p>cpuid level\u00a0\u00a0\u00a0\u00a0 : 5<\/p>\n<p>wp\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : yes<\/p>\n<p>flags\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : fpu vme de psetsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsrsse sse2 ss ht tm pbe lm pni monitor ds_cpl cid xtpr<\/p>\n<p>bogomips\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : 6004.52<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u8bf4\u660e\uff1a<\/strong>\u4ee5\u4e0b\u53ea\u89e3\u91ca\u5bf9\u6211\u4eec\u8ba1\u7b97Cpu\u4f7f\u7528\u7387\u6709\u7528\u7684\u76f8\u5173\u53c2\u6570\u3002<\/p>\n<p>\u53c2\u6570\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u89e3\u91ca<\/p>\n<p>processor (0)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 cpu\u7684\u4e00\u4e2a\u7269\u7406\u6807\u8bc6<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u7ed3\u8bba1<\/strong>\uff1a\u53ef\u4ee5\u901a\u8fc7\u8be5\u6587\u4ef6\u6839\u636eprocessor\u51fa\u73b0\u7684\u6b21\u6570\u7edf\u8ba1cpu\u7684\u903b\u8f91\u4e2a\u6570(\u5305\u62ec\u591a\u6838\u3001\u8d85\u7ebf\u7a0b)\u3002<\/p>\n<h3>\/proc\/stat\u6587\u4ef6<\/h3>\n<p>\u8be5\u6587\u4ef6\u5305\u542b\u4e86\u6240\u6709CPU\u6d3b\u52a8\u7684\u4fe1\u606f\uff0c\u8be5\u6587\u4ef6\u4e2d\u7684\u6240\u6709\u503c\u90fd\u662f\u4ece\u7cfb\u7edf\u542f\u52a8\u5f00\u59cb\u7d2f\u8ba1\u5230\u5f53\u524d\u65f6\u523b\u3002\u4e0d\u540c\u5185\u6838\u7248\u672c\u4e2d\u8be5\u6587\u4ef6\u7684\u683c\u5f0f\u53ef\u80fd\u4e0d\u5927\u4e00\u81f4\uff0c\u4ee5\u4e0b\u901a\u8fc7\u5b9e\u4f8b\u6765\u8bf4\u660e\u6570\u636e\u8be5\u6587\u4ef6\u4e2d\u5404\u5b57\u6bb5\u7684\u542b\u4e49\u3002<\/p>\n<p>\u5b9e\u4f8b\u6570\u636e\uff1a2.6.24-24\u7248\u672c\u4e0a\u7684<\/p>\n<p>&nbsp;<\/p>\n<p>fjzag@fjzag-desktop:~$cat \/proc\/stat<\/p>\n<p>cpu\u00a0 38082 627 27594 89390812256 581 895 0 0<\/p>\n<p>cpu022880 472 16855 430287 10617 576 661 0 0<\/p>\n<p>cpu115202 154 10739 463620 1639 4 234 0 0<\/p>\n<p>intr120053 222 2686 0 1 1 0 5 0 3 0 0 0 47302 0 0 34194 29775 0 5019 845 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0<\/p>\n<p>ctxt1434984<\/p>\n<p>btime1252028243<\/p>\n<p>processes8113<\/p>\n<p>procs_running1<\/p>\n<p>procs_blocked0<\/p>\n<p align=\"left\">\u7b2c\u4e00\u884c\u7684\u6570\u503c\u8868\u793a\u7684\u662fCPU\u603b\u7684\u4f7f\u7528\u60c5\u51b5\uff0c\u6240\u4ee5\u6211\u4eec\u53ea\u8981\u7528\u7b2c\u4e00\u884c\u7684\u6570\u5b57\u8ba1\u7b97\u5c31\u53ef\u4ee5\u4e86\u3002\u4e0b\u8868\u89e3\u6790\u7b2c\u4e00\u884c\u5404\u6570\u503c\u7684\u542b\u4e49\uff1a<\/p>\n<p align=\"left\"><strong>\u53c2\u6570\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u89e3\u6790\uff08\u5355\u4f4d\uff1ajiffies\uff09<\/strong><\/p>\n<p>(jiffies\u662f\u5185\u6838\u4e2d\u7684\u4e00\u4e2a\u5168\u5c40\u53d8\u91cf\uff0c\u7528\u6765\u8bb0\u5f55\u81ea\u7cfb\u7edf\u542f\u52a8\u4e00\u6765\u4ea7\u751f\u7684\u8282\u62cd\u6570\uff0c\u5728linux\u4e2d\uff0c\u4e00\u4e2a\u8282\u62cd\u5927\u81f4\u53ef\u7406\u89e3\u4e3a\u64cd\u4f5c\u7cfb\u7edf\u8fdb\u7a0b\u8c03\u5ea6\u7684\u6700\u5c0f\u65f6\u95f4\u7247\uff0c\u4e0d\u540clinux\u5185\u6838\u53ef\u80fd\u503c\u6709\u4e0d\u540c\uff0c\u901a\u5e38\u57281ms\u523010ms\u4e4b\u95f4)<\/p>\n<p><strong>user<\/strong>\u00a0(38082)\u00a0\u00a0\u00a0 \u4ece\u7cfb\u7edf\u542f\u52a8\u5f00\u59cb\u7d2f\u8ba1\u5230\u5f53\u524d\u65f6\u523b\uff0c\u5904\u4e8e\u7528\u6237\u6001\u7684\u8fd0\u884c\u65f6\u95f4\uff0c\u4e0d\u5305\u542b nice\u503c\u4e3a\u8d1f\u8fdb\u7a0b\u3002<\/p>\n<p><strong>nice<\/strong>\u00a0(627)\u00a0\u00a0\u00a0\u00a0\u00a0 \u4ece\u7cfb\u7edf\u542f\u52a8\u5f00\u59cb\u7d2f\u8ba1\u5230\u5f53\u524d\u65f6\u523b\uff0cnice\u503c\u4e3a\u8d1f\u7684\u8fdb\u7a0b\u6240\u5360\u7528\u7684CPU\u65f6\u95f4<\/p>\n<p><strong>system<\/strong>\u00a0(27594)\u00a0 \u4ece\u7cfb\u7edf\u542f\u52a8\u5f00\u59cb\u7d2f\u8ba1\u5230\u5f53\u524d\u65f6\u523b\uff0c\u5904\u4e8e\u6838\u5fc3\u6001\u7684\u8fd0\u884c\u65f6\u95f4<\/p>\n<p><strong>idle<\/strong>\u00a0(893908)\u00a0\u00a0 \u4ece\u7cfb\u7edf\u542f\u52a8\u5f00\u59cb\u7d2f\u8ba1\u5230\u5f53\u524d\u65f6\u523b\uff0c\u9664IO\u7b49\u5f85\u65f6\u95f4\u4ee5\u5916\u7684\u5176\u5b83\u7b49\u5f85\u65f6\u95f4<strong>iowait<\/strong>\u00a0(12256) \u4ece\u7cfb\u7edf\u542f\u52a8\u5f00\u59cb\u7d2f\u8ba1\u5230\u5f53\u524d\u65f6\u523b\uff0cIO\u7b49\u5f85\u65f6\u95f4(since 2.5.41)<\/p>\n<p align=\"left\"><strong>irq<\/strong>\u00a0(581)\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u4ece\u7cfb\u7edf\u542f\u52a8\u5f00\u59cb\u7d2f\u8ba1\u5230\u5f53\u524d\u65f6\u523b\uff0c\u786c\u4e2d\u65ad\u65f6\u95f4(since 2.6.0-test4)<\/p>\n<p><strong>softirq<\/strong>\u00a0(895)\u00a0 \u00a0\u00a0\u00a0 \u4ece\u7cfb\u7edf\u542f\u52a8\u5f00\u59cb\u7d2f\u8ba1\u5230\u5f53\u524d\u65f6\u523b\uff0c\u8f6f\u4e2d\u65ad\u65f6\u95f4(since2.6.0-test4)<strong>stealstolen<\/strong>(0) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 which is the time spent in otheroperating systems when running in a virtualized environment(since 2.6.11)<\/p>\n<p><strong>guest<\/strong>(0)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 whichis the time spent running a virtual\u00a0CPU\u00a0 for\u00a0 guest operating systems under the control ofthe Linux kernel(since 2.6.24)<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u7ed3\u8bba2<\/strong>\uff1a\u603b\u7684cpu\u65f6\u95f4totalCpuTime = user + nice+ system + idle + iowait + irq + softirq + stealstolen\u00a0+ \u00a0guest<\/p>\n<h3>\/proc\/&lt;pid&gt;\/stat\u6587\u4ef6<\/h3>\n<p>\u8be5\u6587\u4ef6\u5305\u542b\u4e86\u67d0\u4e00\u8fdb\u7a0b\u6240\u6709\u7684\u6d3b\u52a8\u7684\u4fe1\u606f\uff0c\u8be5\u6587\u4ef6\u4e2d\u7684\u6240\u6709\u503c\u90fd\u662f\u4ece\u7cfb\u7edf\u542f\u52a8\u5f00\u59cb\u7d2f\u8ba1<\/p>\n<p>\u5230\u5f53\u524d\u65f6\u523b\u3002\u4ee5\u4e0b\u901a\u8fc7\u5b9e\u4f8b\u6570\u636e\u6765\u8bf4\u660e\u8be5\u6587\u4ef6\u4e2d\u5404\u5b57\u6bb5\u7684\u542b\u4e49\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>[zhengangen@buick ~]# cat\/proc\/6873\/stat<\/p>\n<p>6873 (a.out) R 6723 6873 6723 34819 6873 8388608 77 0 0 0 41958 31 0 0 25 0 3 05882654 1409024 56 4294967295 134512640 134513720 3215579040 0 2097798 0 0 0 00 0 0 17 0 0 0<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u8bf4\u660e\uff1a<\/strong>\u4ee5\u4e0b\u53ea\u89e3\u91ca\u5bf9\u6211\u4eec\u8ba1\u7b97Cpu\u4f7f\u7528\u7387\u6709\u7528\u76f8\u5173\u53c2\u6570<\/p>\n<p>\u53c2\u6570\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u89e3\u91ca<\/p>\n<p>pid=6873 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u8fdb\u7a0b\u53f7<\/p>\n<p>utime=1587 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u8be5\u4efb\u52a1\u5728\u7528\u6237\u6001\u8fd0\u884c\u7684\u65f6\u95f4\uff0c\u5355\u4f4d\u4e3ajiffies<\/p>\n<p>stime=41958\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u8be5\u4efb\u52a1\u5728\u6838\u5fc3\u6001\u8fd0\u884c\u7684\u65f6\u95f4\uff0c\u5355\u4f4d\u4e3ajiffies<\/p>\n<p>cutime=0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u6240\u6709\u5df2\u6b7b\u7ebf\u7a0b\u5728\u7528\u6237\u6001\u8fd0\u884c\u7684\u65f6\u95f4\uff0c\u5355\u4f4d\u4e3ajiffies<\/p>\n<p>cstime=0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u6240\u6709\u5df2\u6b7b\u5728\u6838\u5fc3\u6001\u8fd0\u884c\u7684\u65f6\u95f4\uff0c\u5355\u4f4d\u4e3ajiffies<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u7ed3\u8bba3\uff1a<\/strong>\u8fdb\u7a0b\u7684\u603bCpu\u65f6\u95f4processCpuTime = utime +stime + cutime + cstime\uff0c\u8be5\u503c\u5305\u62ec\u5176\u6240\u6709\u7ebf\u7a0b\u7684cpu\u65f6\u95f4\u3002<\/p>\n<h3>\/proc\/&lt;pid&gt;\/task\/&lt;tid&gt;\/stat\u6587\u4ef6<\/h3>\n<p>\u8be5\u6587\u4ef6\u5305\u542b\u4e86\u67d0\u4e00\u8fdb\u7a0b\u6240\u6709\u7684\u6d3b\u52a8\u7684\u4fe1\u606f\uff0c\u8be5\u6587\u4ef6\u4e2d\u7684\u6240\u6709\u503c\u90fd\u662f\u4ece\u7cfb\u7edf\u542f\u52a8\u5f00\u59cb\u7d2f\u8ba1\u5230\u5f53\u524d\u65f6\u523b\u3002\u8be5\u6587\u4ef6\u7684\u5185\u5bb9\u683c\u5f0f\u4ee5\u53ca\u5404\u5b57\u6bb5\u7684\u542b\u4e49\u540c\/proc\/&lt;pid&gt;\/stat\u6587\u4ef6\u3002<\/p>\n<p>\u6ce8\u610f\uff0c\u8be5\u6587\u4ef6\u4e2d\u7684tid\u5b57\u6bb5\u8868\u793a\u7684\u4e0d\u518d\u662f\u8fdb\u7a0b\u53f7\uff0c\u800c\u662flinux\u4e2d\u7684\u8f7b\u91cf\u7ea7\u8fdb\u7a0b(lwp)\uff0c\u5373\u6211\u4eec\u901a\u5e38\u6240\u8bf4\u7684\u7ebf\u7a0b\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u7ed3\u8bba4<\/strong>\uff1a\u7ebf\u7a0bCpu\u65f6\u95f4threadCpuTime = utime +stime<\/p>\n<h2>\u7cfb\u7edf\u4e2d\u6709\u5173\u8fdb\u7a0bcpu\u4f7f\u7528\u7387\u7684\u5e38\u7528\u547d\u4ee4<\/h2>\n<h3>ps \u547d\u4ee4<\/h3>\n<p>\u901a\u8fc7ps\u547d\u4ee4\u53ef\u4ee5\u67e5\u770b\u7cfb\u7edf\u4e2d\u76f8\u5173\u8fdb\u7a0b\u7684Cpu\u4f7f\u7528\u7387\u7684\u4fe1\u606f\u3002\u4ee5\u4e0b\u5728linux man\u6587\u6863\u4e2d\u5bf9ps\u547d\u4ee4\u8f93\u51fa\u4e2d\u6709\u5173cpu\u4f7f\u7528\u7387\u7684\u89e3\u91ca\uff1a<\/p>\n<p>&nbsp;<\/p>\n<p>CPU usage is currentlyexpressed as the percentage of time spent running during the entire lifetime ofa process. This is not ideal, and it does not conform to the standards that psotherwise conforms to. CPU usage is unlikely to add up to exactly 100%.<\/p>\n<p>&nbsp;<\/p>\n<p>%cpu\u00a0\u00a0 cpu utilization of the process in&#8221;##.#&#8221; format. It is the CPU time used\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 divided by the timethe process has been running (cputime\/realtime ratio),\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 expressed as apercentage. It will not add up to 100% unless you are lucky.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u7ed3\u8bba5\uff1a<\/strong>ps\u547d\u4ee4\u7b97\u51fa\u6765\u7684cpu\u4f7f\u7528\u7387\u76f8\u5bf9\u4e8e\u8fdb\u7a0b\u542f\u52a8\u65f6\u7684\u5e73\u5747\u503c\uff0c\u968f\u7740\u8fdb\u7a0b\u8fd0\u884c\u65f6\u95f4\u7684\u589e\u5927\uff0c\u8be5\u503c\u4f1a\u8d8b\u5411\u4e8e\u5e73\u7f13\u3002<\/p>\n<h3>top\u547d\u4ee4<\/h3>\n<p>\u901a\u8fc7top\u547d\u4ee4\u53ef\u4ee5\u67e5\u770b\u7cfb\u7edf\u4e2d\u76f8\u5173\u8fdb\u7a0b\u7684\u5b9e\u65f6\u4fe1\u606f\uff08cpu\u4f7f\u7528\u7387\u7b49\uff09\u3002\u4ee5\u4e0b\u662fman\u6587\u6863\u4e2d\u5bf9top\u547d\u4ee4\u8f93\u51fa\u4e2d\u6709\u5173\u8fdb\u7a0bcpu\u4f7f\u7528\u7387\u7684\u89e3\u91ca\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>#C\u00a0 &#8212;\u00a0Last used CPU (SMP) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Anumber representing the last used processor. In a true\u00a0 SMP\u00a0environment\u00a0 this\u00a0 will\u00a0likely change\u00a0 frequently\u00a0 since\u00a0the\u00a0 kernel intentionally usesweak affinity.\u00a0 Also, the very act ofrunning top may break this weak affinity and cause more processes to\u00a0 change\u00a0CPUs\u00a0 more\u00a0 often (because of the extra demand for cputime).<\/p>\n<p>&nbsp;<\/p>\n<p>%CPU\u00a0 &#8212;\u00a0 CPUusage\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The\u00a0 task\u2019s share ofthe elapsed CPU time since the last screen update, expressed as a percent-ageof total CPU time.\u00a0 In a true SMP environment, if \u00a0Irix mode is Off, top will operate in Solaris modewhere a task\u2019s cpu usage will be divided by the total number of CPUs.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u7ed3\u8bba6\uff1a<\/strong>\u67d0\u4e00\u4e2a\u7ebf\u7a0b\u5728\u5176\u8fd0\u884c\u671f\u95f4\u5176\u6240\u4f7f\u7528\u7684cpu\u53ef\u80fd\u4f1a\u53d1\u751f\u53d8\u5316\u3002<\/p>\n<p><strong>\u7ed3\u8bba7\uff1a<\/strong>\u5728\u591a\u6838\u7684\u60c5\u51b5\u4e0btop\u547d\u4ee4\u8f93\u51fa\u7684cpu\u4f7f\u7528\u7387\u5b9e\u8d28\u662f\u6309cpu\u4e2a\u6570*100%\u8ba1\u7b97\u7684\u3002<\/p>\n<h2>\u5355\u6838\u60c5\u51b5\u4e0bCpu\u4f7f\u7528\u7387\u7684\u8ba1\u7b97<\/h2>\n<h3>\u57fa\u672c\u601d\u60f3<\/h3>\n<p>\u901a \u8fc7\u8bfb\u53d6\/proc\/stat \u3001\/proc\/&lt;pid&gt;\/stat\u3001\/proc\/&lt;pid&gt;\/task\/&lt;tid&gt;\/stat\u4ee5\u53ca\/proc \/cpuinfo\u8fd9\u51e0\u4e2a\u6587\u4ef6\u83b7\u53d6\u603b\u7684Cpu\u65f6\u95f4\u3001\u8fdb\u7a0b\u7684Cpu\u65f6\u95f4\u3001\u7ebf\u7a0b\u7684Cpu\u65f6\u95f4\u4ee5\u53caCpu\u7684\u4e2a\u6570\u7684\u4fe1\u606f\uff0c\u7136\u540e\u901a\u8fc7\u4e00\u5b9a\u7684\u7b97\u6cd5\u8fdb\u884c\u8ba1\u7b97(\u91c7\u6837\u4e24\u4e2a\u8db3\u591f \u77ed\u7684\u65f6\u95f4\u95f4\u9694\u7684Cpu\u5feb\u7167\u4e0e\u8fdb\u7a0b\u5feb\u7167\u6765\u8ba1\u7b97\u8fdb\u7a0b\u7684Cpu\u4f7f\u7528\u7387)\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>\u603b\u7684Cpu\u4f7f\u7528\u7387\u8ba1\u7b97<\/h3>\n<h4>\u8ba1\u7b97\u65b9\u6cd5\uff1a<\/h4>\n<p>1\u3001\u00a0 \u91c7\u6837\u4e24\u4e2a\u8db3\u591f\u77ed\u7684\u65f6\u95f4\u95f4\u9694\u7684Cpu\u5feb\u7167\uff0c\u5206\u522b\u8bb0\u4f5ct1,t2\uff0c\u5176\u4e2dt1\u3001t2\u7684\u7ed3\u6784\u5747\u4e3a\uff1a<\/p>\n<p>(user\u3001nice\u3001system\u3001idle\u3001iowait\u3001irq\u3001softirq\u3001stealstolen\u3001guest)\u76849\u5143\u7ec4;<\/p>\n<p>2\u3001\u00a0 \u8ba1\u7b97\u603b\u7684Cpu\u65f6\u95f4\u7247totalCpuTime<\/p>\n<p>a)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u628a\u7b2c\u4e00\u6b21\u7684\u6240\u6709cpu\u4f7f\u7528\u60c5\u51b5\u6c42\u548c\uff0c\u5f97\u5230s1;<\/p>\n<p>b)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u628a\u7b2c\u4e8c\u6b21\u7684\u6240\u6709cpu\u4f7f\u7528\u60c5\u51b5\u6c42\u548c\uff0c\u5f97\u5230s2;<\/p>\n<p>c)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0s2 &#8211; s1\u5f97\u5230\u8fd9\u4e2a\u65f6\u95f4\u95f4\u9694\u5185\u7684\u6240\u6709\u65f6\u95f4\u7247\uff0c\u5373totalCpuTime = j2 &#8211; j1 ;<\/p>\n<p>3\u3001\u8ba1\u7b97\u7a7a\u95f2\u65f6\u95f4idle<\/p>\n<p>idle\u5bf9\u5e94\u7b2c\u56db\u5217\u7684\u6570\u636e\uff0c\u7528\u7b2c\u4e8c\u6b21\u7684\u7b2c\u56db\u5217- \u7b2c\u4e00\u6b21\u7684\u7b2c\u56db\u5217\u5373\u53ef<\/p>\n<p>idle=\u7b2c\u4e8c\u6b21\u7684\u7b2c\u56db\u5217- \u7b2c\u4e00\u6b21\u7684\u7b2c\u56db\u5217<\/p>\n<p>6\u3001\u8ba1\u7b97cpu\u4f7f\u7528\u7387<\/p>\n<p>pcpu =100* (total-idle)\/total<\/p>\n<h3>\u67d0\u4e00\u8fdb\u7a0bCpu\u4f7f\u7528\u7387\u7684\u8ba1\u7b97<\/h3>\n<h4>\u8ba1\u7b97\u65b9\u6cd5\uff1a<\/h4>\n<p>1\uff0e\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u91c7\u6837\u4e24\u4e2a\u8db3\u591f\u77ed\u7684\u65f6\u95f4\u95f4\u9694\u7684cpu\u5feb\u7167\u4e0e\u8fdb\u7a0b\u5feb\u7167\uff0c<\/p>\n<p>a)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6bcf\u4e00\u4e2acpu\u5feb\u7167\u5747\u4e3a(user\u3001nice\u3001system\u3001idle\u3001iowait\u3001irq\u3001softirq\u3001stealstolen\u3001guest)\u76849\u5143\u7ec4;<\/p>\n<p>b)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6bcf\u4e00\u4e2a\u8fdb\u7a0b\u5feb\u7167\u5747\u4e3a\u00a0(utime\u3001stime\u3001cutime\u3001cstime)\u76844\u5143\u7ec4\uff1b<\/p>\n<p>2\uff0e\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5206\u522b\u6839\u636e<strong>\u7ed3\u8bba2\u3001\u7ed3\u8bba3<\/strong>\u8ba1\u7b97\u51fa\u4e24\u4e2a\u65f6\u523b\u7684\u603b\u7684cpu\u65f6\u95f4\u4e0e\u8fdb\u7a0b\u7684cpu\u65f6\u95f4\uff0c\u5206\u522b\u8bb0\u4f5c\uff1atotalCpuTime1\u3001totalCpuTime2\u3001processCpuTime1\u3001processCpuTime2<\/p>\n<p>3\uff0e\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u8ba1 \u7b97\u8be5\u8fdb\u7a0b\u7684cpu\u4f7f\u7528\u7387pcpu = 100*(processCpuTime2 \u2013 processCpuTime1) \/ (totalCpuTime2 \u2013 totalCpuTime1) (\u6309100%\u8ba1\u7b97\uff0c\u5982\u679c\u662f\u591a\u6838\u60c5\u51b5\u4e0b\u8fd8\u9700\u4e58\u4ee5cpu\u7684\u4e2a\u6570);<\/p>\n<h4>\u5b9e\u9a8c\u6570\u636e<\/h4>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td colspan=\"2\" valign=\"top\" width=\"568\">\n<p align=\"center\"><strong>\u5b9e\u9a8c\u4e00:<\/strong>\u00a0\u76d1\u63a7\u4e00\u7a7a\u5faa\u73af\u7684\u8fdb\u7a0b\u7684cpu\u4f7f\u7528\u7387\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\" valign=\"top\" width=\"568\">\n<p align=\"center\"><strong>\u8bf4\u660e\uff1a<\/strong>\u5de6\u8fb9\u7684\u6570\u636e\u662f\u6309\u4ee5\u4e0a\u7b97\u6cd5\u5f97\u5230\u7684\u6570\u636e\uff0c\u5176\u4e2d\u91c7\u6837\u7684\u65f6\u95f4\u95f4\u9694\u4e0etop\u547d\u4ee4\u5237\u65b0\u5c4f\u5e55\u7684\u65f6\u95f4\u95f4\u9694\u76f8\u540c\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\n<p align=\"center\">\u6309\u4ee5\u4e0a\u65b9\u6cd5\u8ba1\u7b97\u5f97\u5230\u7684cpu\u4f7f\u7528\u7387<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\">\u901a\u8fc7top\u547d\u4ee4\u5f97\u5230\u7684<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\n<p align=\"left\">\n<p align=\"left\">99.50083<\/p>\n<p align=\"left\">98.333336<\/p>\n<p align=\"left\">98.0<\/p>\n<p align=\"left\">98.83138<\/p>\n<p align=\"left\">99.0<\/p>\n<p align=\"left\">99.0<\/p>\n<p align=\"left\">99.83361<\/p>\n<p align=\"left\">98.83527<\/p>\n<p>98.4975<\/p>\n<p>&nbsp;<\/td>\n<td valign=\"top\">PID \u00a0\u00a0\u00a0USER\u00a0\u00a0\u00a0\u00a0\u00a0 PR \u00a0\u00a0NI\u00a0 \u00a0VIRT\u00a0 \u00a0RES\u00a0 \u00a0SHR \u00a0\u00a0S \u00a0<strong>%CPU<\/strong>\u00a0%MEM \u00a0TIME+\u00a0 COMMAND<\/p>\n<p align=\"left\">7639 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 206m\u00a0 10m 7136 S\u00a0\u00a0 99\u00a0 2.2\u00a0\u00a0 1:00.74 java<\/p>\n<p align=\"left\">\u00a07639 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 206m\u00a0 10m 7136 S\u00a0\u00a0 99\u00a0 2.2\u00a0\u00a0 1:03.71 java<\/p>\n<p align=\"left\">\u00a07639 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 206m\u00a0 10m 7136 S\u00a0\u00a0 99\u00a0 2.2\u00a0\u00a0 1:06.67 java<\/p>\n<p align=\"left\">\u00a07639 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 206m\u00a0 10m 7136 S\u00a0\u00a0 99\u00a0 2.2\u00a0\u00a0 1:09.63 java<\/p>\n<p align=\"left\">\u00a07639 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 206m\u00a0 10m 7136 S\u00a0\u00a0 98\u00a0 2.2\u00a0\u00a0 1:12.59 java<\/p>\n<p align=\"left\">\u00a07639 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 206m\u00a0 10m 7136 S\u00a0\u00a0 99\u00a0 2.2\u00a0\u00a0 1:15.55 java<\/p>\n<p align=\"left\">\u00a07639 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 206m\u00a0 10m 7136 S\u00a0 100\u00a0 2.2\u00a0\u00a0 1:18.55 java<\/p>\n<p align=\"left\">\u00a07639 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 206m\u00a0 10m 7136 S\u00a0 100\u00a0 2.2\u00a0\u00a0 1:21.54 java<\/p>\n<p align=\"left\">\u00a07639 fjzag\u00a0 \u00a0\u00a0\u00a020\u00a0\u00a0 0\u00a0 206m\u00a0 10m 7136 S\u00a0\u00a0 99\u00a0 2.2\u00a0\u00a0 1:24.52 java<\/p>\n<p>\u00a07639 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 206m\u00a0 10m 7136 S\u00a0\u00a0 98\u00a0 2.2\u00a0\u00a0 1:27.46 java<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td colspan=\"2\" valign=\"top\" width=\"568\">\n<p align=\"center\"><strong>\u5b9e\u9a8c\u4e8c:<\/strong>\u00a0\u76d1\u63a7jconsole\u8fdb\u7a0b\u7684cpu\u4f7f\u7528\u7387\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\" valign=\"top\" width=\"568\">\n<p align=\"center\"><strong>\u8bf4\u660e\uff1a<\/strong>\u5de6\u8fb9\u7684\u6570\u636e\u662f\u6309\u4ee5\u4e0a\u7b97\u6cd5\u5f97\u5230\u7684\u6570\u636e\uff0c\u5176\u4e2d\u91c7\u6837\u7684\u65f6\u95f4\u95f4\u9694\u4e0etop\u547d\u4ee4\u5237\u65b0\u5c4f\u5e55\u7684\u65f6\u95f4\u95f4\u9694\u76f8\u540c\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\n<p align=\"center\">\u6309\u4ee5\u4e0a\u65b9\u6cd5\u8ba1\u7b97\u5f97\u5230\u7684cpu\u4f7f\u7528\u7387<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\">\u901a\u8fc7top\u547d\u4ee4\u5f97\u5230\u7684<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\n<p align=\"left\">\n<p align=\"left\">8.681135<\/p>\n<p align=\"left\">12.0<\/p>\n<p align=\"left\">10.350584<\/p>\n<p align=\"left\">7.6539097<\/p>\n<p align=\"left\">7.6539097<\/p>\n<p align=\"left\">5.0<\/p>\n<p align=\"left\">13.021703<\/p>\n<p align=\"left\">11.0<\/p>\n<p align=\"left\">8.666667<\/p>\n<\/td>\n<td valign=\"top\">PID \u00a0\u00a0USER\u00a0\u00a0\u00a0\u00a0\u00a0 PR \u00a0\u00a0NI\u00a0 VIRT\u00a0 \u00a0RES\u00a0 \u00a0SHR \u00a0S \u00a0<strong>%CPU<\/strong>\u00a0%MEM \u00a0TIME+\u00a0 COMMAND<\/p>\n<p align=\"left\">7753 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 252m\u00a0 72m\u00a0 22m S\u00a0\u00a0 10 14.4\u00a0\u00a0 0:18.70 jconsole<\/p>\n<p align=\"left\">\u00a07753 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 252m\u00a0 72m\u00a0 22m S\u00a0\u00a0 12 14.4\u00a0\u00a0 0:19.07 jconsole<\/p>\n<p align=\"left\">\u00a07753 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 252m\u00a0 72m\u00a0 22m S\u00a0\u00a0 11 14.4\u00a0\u00a0 0:19.39 jconsole<\/p>\n<p align=\"left\">\u00a07753 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 252m\u00a0 72m\u00a0 22m S\u00a0\u00a0\u00a0 7 14.4\u00a0\u00a0 0:19.61 jconsole<\/p>\n<p align=\"left\">\u00a07753 fjzag\u00a0 \u00a0\u00a0\u00a020\u00a0\u00a0 0\u00a0 252m\u00a0 72m\u00a0 22m S\u00a0\u00a0\u00a0 7 14.4\u00a0\u00a0 0:19.83 jconsole<\/p>\n<p align=\"left\">\u00a07753 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 252m\u00a0 72m\u00a0 22m S\u00a0\u00a0\u00a0 5 14.4\u00a0\u00a0 0:19.97 jconsole<\/p>\n<p align=\"left\">\u00a07753 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 252m\u00a0 72m\u00a0 22m S\u00a0\u00a0 14 14.4\u00a0\u00a0 0:20.38 jconsole<\/p>\n<p align=\"left\">\u00a07753 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 252m\u00a0 72m\u00a0 22m S\u00a0\u00a0 10 14.4\u00a0\u00a0 0:20.68 jconsole<\/p>\n<p>\u00a07753 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 252m\u00a0 72m\u00a0 22m S\u00a0\u00a0\u00a0 9 14.5\u00a0\u00a0 0:20.96 jconsole<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u67d0\u4e00\u7ebf\u7a0bCpu\u4f7f\u7528\u7387\u7684\u8ba1\u7b97<\/h3>\n<h4>\u8ba1\u7b97\u65b9\u6cd5\uff1a<\/h4>\n<p>1\uff0e\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u91c7\u6837\u4e24\u4e2a\u8db3\u591f\u77ed\u7684\u65f6\u95f4\u9694\u7684cpu\u5feb\u7167\u4e0e\u7ebf\u7a0b\u5feb\u7167\uff0c<\/p>\n<p>a)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6bcf\u4e00\u4e2acpu\u5feb\u7167\u5747\u4e3a(user\u3001nice\u3001system\u3001idle\u3001iowait\u3001irq\u3001softirq\u3001stealstealon\u3001guest)\u76849\u5143\u7ec4;<\/p>\n<p>b)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6bcf\u4e00\u4e2a\u7ebf\u7a0b\u5feb\u7167\u5747\u4e3a\u00a0(utime\u3001stime)\u76842\u5143\u7ec4\uff1b<\/p>\n<p>2\uff0e\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5206\u522b\u6839\u636e<strong>\u7ed3\u8bba2\u3001\u7ed3\u8bba4<\/strong>\u8ba1\u7b97\u51fa\u4e24\u4e2a\u65f6\u523b\u7684\u603b\u7684cpu\u65f6\u95f4\u4e0e\u7ebf\u7a0b\u7684cpu\u65f6\u95f4\uff0c\u5206\u522b\u8bb0\u4f5c\uff1atotalCpuTime1\u3001totalCpuTime2\u3001threadCpuTime1\u3001threadCpuTime2<\/p>\n<p>3\uff0e\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u8ba1 \u7b97\u8be5\u7ebf\u7a0b\u7684cpu\u4f7f\u7528\u7387pcpu = 100*( threadCpuTime2\u2013 threadCpuTime1) \/ (totalCpuTime2\u2013 totalCpuTime1) (\u6309100%\u8ba1\u7b97\uff0c\u5982\u679c\u662f\u591a\u6838\u60c5\u51b5\u4e0b\u8fd8\u9700\u4e58\u4ee5cpu\u7684\u4e2a\u6570);<\/p>\n<h4>\u5b9e\u9a8c\u6570\u636e<\/h4>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td colspan=\"2\" valign=\"top\" width=\"568\">\n<p align=\"center\"><strong>\u5b9e\u9a8c\u4e00:<\/strong>\u00a0\u76d1\u63a7\u4e00\u7a7a\u5faa\u73af\u7684\u7ebf\u7a0b\u7684cpu\u4f7f\u7528\u7387\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\" valign=\"top\" width=\"568\">\n<p align=\"center\"><strong>\u8bf4\u660e\uff1a<\/strong>\u5de6\u8fb9\u7684\u6570\u636e\u662f\u6309\u4ee5\u4e0a\u7b97\u6cd5\u5f97\u5230\u7684\u6570\u636e\uff0c\u5176\u4e2d\u91c7\u6837\u7684\u65f6\u95f4\u95f4\u9694\u4e0etop\u547d\u4ee4\u5237\u65b0\u5c4f\u5e55\u7684\u65f6\u95f4\u95f4\u9694\u76f8\u540c\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\n<p align=\"center\">\u6309\u4ee5\u4e0a\u65b9\u6cd5\u8ba1\u7b97\u5f97\u5230\u7684cpu\u4f7f\u7528\u7387<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\">\u901a\u8fc7top\u547d\u4ee4\u5f97\u5230\u7684<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\n<p align=\"left\">\n<p align=\"left\">98.83138<\/p>\n<p align=\"left\">97.00997<\/p>\n<p align=\"left\">96.98997<\/p>\n<p align=\"left\">97.49583<\/p>\n<p align=\"left\">98.169716<\/p>\n<p align=\"left\">96.8386<\/p>\n<p align=\"left\">97.333336<\/p>\n<p align=\"left\">93.82304<\/p>\n<p align=\"left\">98.66667<\/p>\n<\/td>\n<td valign=\"top\">PID \u00a0\u00a0\u00a0USER\u00a0\u00a0\u00a0\u00a0\u00a0 PR \u00a0\u00a0NI\u00a0 \u00a0VIRT\u00a0 \u00a0RES\u00a0 \u00a0SHR \u00a0\u00a0S \u00a0<strong>%CPU<\/strong>\u00a0%MEM \u00a0TIME+\u00a0 COMMAND<\/p>\n<p align=\"left\">7649 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 206m\u00a0 10m 7136 R\u00a0\u00a0 97\u00a0 2.2\u00a0\u00a0 7:22.94 java<\/p>\n<p align=\"left\">\u00a07649 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 206m\u00a0 10m 7136 R\u00a0\u00a0 97\u00a0 2.2\u00a0\u00a0 7:25.86 java<\/p>\n<p align=\"left\">\u00a07649 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 206m\u00a0 10m 7136 R\u00a0\u00a0 97\u00a0 2.2\u00a0\u00a0 7:28.76 java<\/p>\n<p align=\"left\">\u00a07649 fjzag\u00a0 \u00a0\u00a0\u00a020\u00a0\u00a0 0\u00a0 206m\u00a0 10m 7136 R\u00a0\u00a0 99\u00a0 2.2\u00a0\u00a0 7:31.72 java<\/p>\n<p align=\"left\">\u00a07649 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 206m\u00a0 10m 7136 R\u00a0\u00a0 98\u00a0 2.2\u00a0\u00a0 7:34.65 java<\/p>\n<p align=\"left\">\u00a07649 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 206m\u00a0 10m 7136 R\u00a0\u00a0 96\u00a0 2.2\u00a0\u00a0 7:37.53 java<\/p>\n<p align=\"left\">\u00a07649 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 206m\u00a0 10m 7136 R\u00a0\u00a0 98\u00a0 2.2\u00a0\u00a0 7:40.47 java<\/p>\n<p align=\"left\">\u00a07649 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 206m\u00a0 10m 7136 R\u00a0\u00a0 96\u00a0 2.2\u00a0\u00a0 7:43.34 java<\/p>\n<p>\u00a07649 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 206m\u00a0 10m 7136 R\u00a0\u00a0 97\u00a0 2.2\u00a0\u00a0 7:46.25 java<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td colspan=\"2\" valign=\"top\" width=\"568\">\n<p align=\"center\"><strong>\u5b9e\u9a8c\u4e8c:<\/strong>\u00a0\u76d1\u63a7jconsole\u7a0b\u5e8f\u67d0\u4e00\u7ebf\u7a0b\u7684cpu\u4f7f\u7528\u7387\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\" valign=\"top\" width=\"568\">\n<p align=\"center\"><strong>\u8bf4\u660e\uff1a<\/strong>\u5de6\u8fb9\u7684\u6570\u636e\u662f\u6309\u4ee5\u4e0a\u7b97\u6cd5\u5f97\u5230\u7684\u6570\u636e\uff0c\u5176\u4e2d\u91c7\u6837\u7684\u65f6\u95f4\u95f4\u9694\u4e0etop\u547d\u4ee4\u5237\u65b0\u5c4f\u5e55\u7684\u65f6\u95f4\u95f4\u9694\u76f8\u540c\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\n<p align=\"center\">\u6309\u4ee5\u4e0a\u65b9\u6cd5\u8ba1\u7b97\u5f97\u5230\u7684cpu\u4f7f\u7528\u7387<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\">\u901a\u8fc7top\u547d\u4ee4\u5f97\u5230\u7684<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">&nbsp;<\/p>\n<p align=\"left\">1.3400335<\/p>\n<p align=\"left\">6.644518<\/p>\n<p align=\"left\">1.3333334<\/p>\n<p align=\"left\">0.6677796<\/p>\n<p align=\"left\">0.6666667<\/p>\n<p align=\"left\">1.3333334<\/p>\n<p>1.3333334<\/td>\n<td valign=\"top\">\u00a0PID \u00a0\u00a0\u00a0USER\u00a0\u00a0\u00a0\u00a0\u00a0 PR \u00a0\u00a0NI\u00a0 \u00a0VIRT\u00a0 \u00a0RES\u00a0 SHR \u00a0S \u00a0<strong>%CPU<\/strong>\u00a0%MEM \u00a0TIME+\u00a0 COMMAND<\/p>\n<p align=\"left\">7755 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 251m\u00a0 72m\u00a0 22m S\u00a0\u00a0\u00a0 1 14.4\u00a0\u00a0 0:11.92 jconsole<\/p>\n<p align=\"left\">\u00a07755 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 251m\u00a0 72m\u00a0 22m S\u00a0\u00a0\u00a0 7 14.4\u00a0\u00a0 0:12.12 jconsole<\/p>\n<p align=\"left\">\u00a07755 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 251m\u00a0 72m\u00a0 22m S\u00a0\u00a0\u00a0 2 14.4\u00a0\u00a0 0:12.18 jconsole<\/p>\n<p align=\"left\">\u00a07755 fjzag\u00a0\u00a0 \u00a0\u00a020\u00a0\u00a0 0\u00a0 251m\u00a0 72m\u00a0 22m S\u00a0\u00a0\u00a0 0 14.4\u00a0\u00a0 0:12.18 jconsole<\/p>\n<p align=\"left\">\u00a07755 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 251m\u00a0 72m\u00a0 22m S\u00a0\u00a0\u00a0 1 14.4\u00a0\u00a0 0:12.20 jconsole<\/p>\n<p align=\"left\">\u00a07755 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 251m\u00a0 72m\u00a0 22m S\u00a0\u00a0\u00a0 1 14.4\u00a0\u00a0 0:12.24 jconsole<\/p>\n<p>\u00a07755 fjzag\u00a0\u00a0\u00a0\u00a0 20\u00a0\u00a0 0\u00a0 251m\u00a0 72m\u00a0 22m S\u00a0\u00a0\u00a0 1 14.4\u00a0\u00a0 0:12.28 jconsole<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u591a\u6838\u60c5\u51b5\u4e0bcpu\u4f7f\u7528\u7387\u7684\u8ba1\u7b97<\/h2>\n<p>\u4ee5\u4e0b\u901a\u8fc7\u5b9e\u9a8c\u6570\u636e\u6765\u8bf4\u660e\u591a\u6838\u60c5\u51b5\u4e0b\u67d0\u4e00\u8fdb\u7a0bcpu\u4f7f\u7528\u7387\u662f\u6309cpu\u4e2a\u6570*100%\u8ba1\u7b97\u7684.<\/p>\n<h4>\u5b9e\u9a8c\u4e00<\/h4>\n<h5>\u63cf\u8ff0:<\/h5>\n<p>\u5728<strong>\u53cc\u6838<\/strong>\u7684\u60c5\u51b5\u4e0b\u4f5c\u7684\u4e00\u7ec4\u5b9e\u9a8c\uff0c\u7b2c\u4e00\u7ec4\u6570\u636e\u662f\u901a\u8fc7ps\u00a0 -eLo pid,lwp,pcpu | grep 9140\u547d\u4ee4\u67e5\u770b\u8fdb\u7a0b\u53f7\u4e3a9140\u7684\u8fdb\u7a0b\u4e2d\u5404\u7ebf\u7a0b\u7684\u8be6\u7ec6\u4fe1\u606f\u3002\u7b2c\u4e8c\u7ec4\u6570\u636e\u662f\u901a\u8fc7 ps\u547d\u4ee4\u67e5\u770b\u8fdb\u7a0b\u53f7\u4e3a9140\u8fdb\u7a0b\u7684cpu\u4f7f\u7528\u7387\u3002<\/p>\n<h5>\u6570\u636e\u4e00\uff1a<\/h5>\n<p><strong>pid\u00a0\u00a0 lwp\u00a0 %cpu<\/strong><\/p>\n<p>9140\u00a0\u00a09140\u00a0\u00a00.0<br \/>\n9140\u00a0\u00a09141\u00a0\u00a00.0<br \/>\n9140\u00a0\u00a09142\u00a0\u00a00.0<br \/>\n9140\u00a0\u00a09143\u00a0\u00a00.0<br \/>\n9140\u00a0\u00a09144\u00a0\u00a00.0<br \/>\n9140\u00a0\u00a09149\u00a0\u00a00.0<br \/>\n9140\u00a0\u00a09150\u00a0\u00a00.0<br \/>\n9140\u00a0\u00a09151\u00a0\u00a00.0<br \/>\n9140\u00a0\u00a09152\u00a0\u00a00.1<br \/>\n9140\u00a0\u00a09153\u00a096.6\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u8be5\u7ebf\u7a0b\u662f\u4e00\u4e2a\u7a7a\u5faa\u73af<br \/>\n9140\u00a0\u00a09154\u00a095.9\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u8be5\u7ebf\u7a0b\u662f\u4e00\u4e2a\u7a7a\u5faa\u73af<\/p>\n<p>\u4ee5\u4e0a\u9664\u4e86\u7ea2\u8272\u6807\u6ce8\u51fa\u6765\u7684\u4e24\u4e2a\u7ebf\u7a0b\u4ee5\u5916,\u5176\u4ed6\u7684\u7ebf\u7a0b\u90fd\u662f\u540e\u53f0\u7ebf\u7a0b\u3002<\/p>\n<h5>\u6570\u636e\u4e8c\uff1a<\/h5>\n<p><strong>pid\u00a0\u00a0 %cpu<\/strong><\/p>\n<p>9140\u00a0\u00a0193<\/p>\n<h4>\u5b9e\u9a8c\u4e8c<\/h4>\n<h5>\u63cf\u8ff0\uff1a<\/h5>\n<p>\u5728<strong>\u5355\u6838<\/strong>\u7684\u60c5\u51b5\u4e0b\u4f5c\u7684\u4e00\u7ec4\u5b9e\u9a8c\uff0c\u7b2c\u4e00\u7ec4\u6570\u636e\u662f\u901a\u8fc7ps\u00a0 -eLo pid,lwp,pcpu | grep 6137\u547d\u4ee4\u67e5\u770b\u8fdb\u7a0b\u53f7\u4e3a6137\u7684\u8fdb\u7a0b\u4e2d\u5404\u7ebf\u7a0b\u7684\u8be6\u7ec6\u4fe1\u606f\u3002\u7b2c\u4e8c\u7ec4\u6570\u636e\u662f\u901a\u8fc7 ps\u547d\u4ee4\u67e5\u770b\u8fdb\u7a0b\u53f7\u4e3a6137\u8fdb\u7a0b\u7684cpu\u4f7f\u7528\u7387\u3002<\/p>\n<h5>\u6570\u636e\u4e00\uff1a<\/h5>\n<p><strong>\u00a0pid\u00a0\u00a0\u00a0 lwp\u00a0\u00a0%cpu<\/strong><\/p>\n<p>6137\u00a06137\u00a0 0.0<\/p>\n<p>6137\u00a06138\u00a0 0.1<\/p>\n<p>6137\u00a06143\u00a0 0.0<\/p>\n<p>6137\u00a06144\u00a0 0.0<\/p>\n<p>6137\u00a06145\u00a0 0.0<\/p>\n<p>6137\u00a06146\u00a0 0.0<\/p>\n<p>6137\u00a06147\u00a0 0.0<\/p>\n<p>6137\u00a06148\u00a0 0.0<\/p>\n<p>6137\u00a06149\u00a0 0.0<\/p>\n<p>6137\u00a06150 46.9\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u7a7a\u5faa\u73af\u7ebf\u7a0b<\/p>\n<p>6137\u00a06151 46.9\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u7a7a\u5faa\u73af\u7ebf\u7a0b<\/p>\n<p>\u4ee5\u4e0a\u9664\u4e86\u7ea2\u8272\u6807\u6ce8\u51fa\u6765\u7684\u4e24\u4e2a\u7ebf\u7a0b\u4ee5\u5916,\u5176\u4ed6\u7684\u7ebf\u7a0b\u90fd\u662f\u540e\u53f0\u7ebf\u7a0b\u3002<\/p>\n<h5>\u6570\u636e\u4e8c<\/h5>\n<p><strong>pid %cpu<\/strong><\/p>\n<p>6137 92.9<\/p>\n<h2>\u4e3b\u8981\u95ee\u9898\uff1a<\/h2>\n<p>1.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u4e0d\u540c\u5185\u6838\u7248\u672c\/proc\/stat\u6587\u4ef6\u683c\u5f0f\u4e0d\u5927\u4e00\u81f4\u3002\/proc\/stat\u6587\u4ef6\u4e2d\u7b2c\u4e00\u884c\u4e3a\u603b\u7684cpu\u4f7f\u7528\u60c5\u51b5\u3002<\/p>\n<p>\u5404\u4e2a\u7248\u672c\u90fd\u6709\u76844\u4e2a\u5b57\u6bb5: user\u3001nice\u3001system\u3001idle<\/p>\n<p>2.5.41\u7248\u672c\u65b0\u589e\u5b57\u6bb5\uff1aiowait<\/p>\n<p>2.6.0-test4\u65b0\u589e\u5b57\u6bb5\uff1airq\u3001softirq<\/p>\n<p>2.6.11\u65b0\u589e\u5b57\u6bb5\uff1astealstolen\uff1a \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 which is thetime spent in other operating<\/p>\n<p>systems whenrunning in a virtualized environment<\/p>\n<p>2.6.24 \u65b0\u589e\u5b57\u6bb5\uff1aguest:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 whichis the time spent running a virtual\u00a0CPU\u00a0 for\u00a0 guest operating systems under the control ofthe Linux kernel<\/p>\n<p>2\uff0e\/proc\/pid\/task\u76ee\u5f55\u662fLinux 2.6.0-test6\u4e4b\u540e\u624d\u6709\u7684\u529f\u80fd\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>3\uff0e\u5173\u4e8e\u51fa\u73b0cpu\u4f7f\u7528\u7387\u4e3a\u8d1f\u7684\u60c5\u51b5\uff0c\u76ee\u524d\u60f3\u5230\u7684\u89e3\u51b3\u65b9\u6848\u662f\u5982\u679c\u51fa\u73b0\u8d1f\u503c\uff0c\u8fde\u7eed\u91c7\u6837\u8ba1\u7b97cpu\u4f7f\u7528\u7387\u76f4\u5230\u4e3a\u975e\u8d1f\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>4.\u6709\u4e9b\u7ebf\u7a0b\u751f\u547d\u5468\u671f\u8f83\u77ed,\u53ef\u80fd\u5728\u6211\u4eec\u91c7\u6837\u671f\u95f4\u5c31\u5df2\u7ecf\u6b7b\u6389\u4e86.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/zhangxugg-163-com.iteye.com\/blog\/873378\" rel=\"nofollow\">php-cgi\u8fdb\u7a0b\u5360\u7528cpu\u8d44\u6e90\u8fc7\u591a\u8d1f\u8f7d\u9ad8\u7684\u539f\u56e0\u5206\u6790\u53ca\u89e3\u51b3\u6b65\u9aa4<\/a><\/p>\n<p>&nbsp;<\/p>\n<div>\n<p>\u670d\u52a1\u5668\u73af\u5883\uff1aredhat linux 5.5 , nginx ,\u00a0 phpfastcgi<\/p>\n<p>&nbsp;<\/p>\n<p>\u5728\u6b64\u73af\u5883\u4e0b\uff0c\u4e00\u822cphp-cgi\u8fd0\u884c\u662f\u975e\u5e38\u7a33\u5b9a\u7684\uff0c\u4f46\u4e5f\u9047\u5230\u8fc7php-cgi\u5360\u7528\u592a\u591acpu\u8d44\u6e90\u800c\u5bfc\u81f4\u670d\u52a1\u5668\u54cd\u5e94\u8fc7\u6162\uff0c\u6211\u6240\u9047\u5230\u7684php-cgi\u8fdb\u7a0b\u5360\u7528cpu\u8d44\u6e90\u8fc7\u591a\u7684\u539f\u56e0\u6709\uff1a<\/p>\n<p>&nbsp;<\/p>\n<p>1. \u4e00\u4e9bphp\u7684\u6269\u5c55\u4e0ephp\u7248\u672c\u517c\u5bb9\u5b58\u5728\u95ee\u9898\uff0c\u5b9e\u8df5\u8bc1\u660e eAccelerater\u4e0e\u67d0\u4e9bphp\u7248\u672c\u517c\u5bb9\u5b58\u5728\u95ee\u9898\uff0c\u5177\u4f53\u8868\u73b0\u65f6\u542f\u52a8php-cgi\u8fdb\u7a0b\u540e\uff0c\u8fd0\u884c10\u591a\u5206\u949f\uff0c\u5947\u6162\u65e0\u6bd4\uff0c\u4f46\u9759\u6001\u8d44\u6e90\u8bbf\u95ee\u5f88\u5feb\uff0c\u670d\u52a1\u5668\u8d1f \u8f7d\u4e5f\u5f88\u6b63\u5e38\uff08\u8bf4\u660enginx\u6ca1\u6709\u95ee\u9898\uff0c\u800c\u662fphp-cgi\u8fdb\u7a0b\u7684\u95ee\u9898\uff09\uff0c\u89e3\u51b3\u529e\u6cd5\u5c31\u662f\u4ecephp.ini\u4e2d\u7981\u6b62\u6389eAccelerater\u6a21\u5757\uff0c\u518d\u91cd\u542f php-cgi\u8fdb\u7a0b\u5373\u53ef<\/p>\n<p>&nbsp;<\/p>\n<p>2. \u7a0b\u5e8f\u4e2d\u53ef\u80fd\u5b58\u5728\u6b7b\u5faa\u73af\uff0c\u5bfc\u81f4\u670d\u52a1\u5668\u8d1f\u8f7d\u8d85\u9ad8\uff08\u4f7f\u7528top\u6307\u4ee4\u67e5\u770b\u8d1f\u8f7d\u9ad8\u8fbe100+\uff09, \u9700\u8981\u501f\u52a9Linux\u7684proc\u865a\u62df\u6587\u4ef6\u7cfb\u7edf\u627e\u5230\u5177\u4f53\u7684\u95ee\u9898\u7a0b\u5e8f<\/p>\n<p>&nbsp;<\/p>\n<p>3. php\u7a0b\u5e8f\u4e0d\u5408\u7406\u4f7f\u7528session , \u8fd9\u4e2a\u53d1\u751f\u5728\u5f00\u6e90\u5fae\u535a\u8bb0\u4e8b\u72d7\u7a0b\u5e8f\u4e0a\uff0c\u5177\u4f53\u8868\u73b0\u662f\u6709\u5c11\u91cfphp-cgi\u8fdb\u7a0b\uff08\u4e0d\u8d85\u8fc710\u4e2a\uff09\u7684cpu\u4f7f\u7528\u7387\u8fbe98%\u4ee5\u4e0a\uff0c \u670d\u52a1\u5668\u8d1f\u8f7d\u57284-8\u4e4b\u95f4\uff0c\u8fd9\u4e2a\u95ee\u9898\u7684\u89e3\u51b3\uff0c\u4ecd\u7136\u9700\u8981\u501f\u52a9Linux\u7684proc\u6587\u4ef6\u7cfb\u7edf\u627e\u51fa\u539f\u56e0\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>4. \u7a0b\u5e8f\u4e2d\u5b58\u5728\u8fc7\u5ea6\u8017\u65f6\u4e14\u4e0d\u53ef\u80fd\u5b8c\u6210\u7684\u64cd\u4f5c\uff08\u8fd8\u662f\u7a0b\u5e8f\u7684\u95ee\u9898\uff09\uff0c\u4f8b\u5982discuz x 1.5\u7684\u9644\u4ef6\u4e0b\u8f7d\u529f\u80fd: source\/module\/forum\/forum_attachement.php\u4e2d\u7684\u5b9a\u4e49<\/p>\n<p>&nbsp;<\/p>\n<p>function getremotefile($file) {<br \/>\nglobal $_G;<br \/>\n@set_time_limit(0);<br \/>\nif(!@readfile($_G[&#8216;setting&#8217;][&#8216;ftp&#8217;][&#8216;attachurl&#8217;].&#8217;forum\/&#8217;.$file)) {<br \/>\n$ftp = ftpcmd(&#8216;object&#8217;);<br \/>\n$tmpfile = @tempnam($_G[&#8216;setting&#8217;][&#8216;attachdir&#8217;], &#8221;);<br \/>\nif($ftp-&gt;ftp_get($tmpfile, &#8216;forum\/&#8217;.$file, FTP_BINARY)) {<br \/>\n@readfile($tmpfile);<br \/>\n@unlink($tmpfile);<br \/>\n} else {<br \/>\n@unlink($tmpfile);<br \/>\nreturn FALSE;<br \/>\n}<br \/>\n}<br \/>\nreturn TRUE;<br \/>\n}<\/p>\n<p>&nbsp;<\/p>\n<p>\u6ca1\u6709\u5bf9\u4f20\u5165\u7684\u53c2\u6570\u4f5c\u4efb\u4f55\u521d\u6b65\u68c0\u67e5\uff0c\u800c\u4e14\u8bbe\u7f6e\u4e86\u6c38\u4e0d\u8d85\u65f6\uff0c\u5e76\u4e14\u4f7f\u7528readfile\u4e00\u6b21\u8bfb\u53d6\u8d85\u5927\u6587\u4ef6\uff0c\u5c31\u53ef\u80fd\u5b58\u5728\u4ee5\u4e0b\u95ee\u9898\uff1a<br \/>\nA. \u4ee5http\u65b9\u5f0f\u8bfb\u53d6\u8fdc\u7a0b\u9644\u4ef6\u8fc7\u5ea6\u8017\u65f6<\/p>\n<p>B. FTP\u65e0\u6cd5\u8fde\u63a5\u65f6\uff0c\u5982\u4f55\u53ca\u65f6\u53cd\u9988\u51fa\u9519\u8bef\uff1f<\/p>\n<p>C. readfile\u662f\u4e00\u6b21\u6027\u8bfb\u53d6\u6587\u4ef6\u52a0\u8f7d\u5230\u5185\u5b58\u4e2d\u5e76\u8f93\u51fa\uff0c\u5f53\u6587\u4ef6\u8fc7\u5927\u65f6\uff0c\u5185\u5b58\u6d88\u8017\u60ca\u4eba<\/p>\n<p>\u6839\u636e\u5b9e\u9a8c\u53d1\u73b0\u91c7\u7528readfile\u4e00\u6b21\u6027\u8bfb\u53d6\uff0c\u5185\u5b58\u6d88\u8017\u4f1a\u660e\u663e\u589e\u52a0\uff0c\u4f46\u662fCPU\u7684\u5229\u7528\u7387\u4f1a\u4e0b\u964d\u8f83\u591a\u3002\u5982\u679c\u91c7\u7528\u5206\u6bb5\u8bfb\u53d6\u7684\u65b9\u5f0f\uff0c\u5185\u5b58\u6d88\u8017\u4f1a\u7a0d\u5fae\u4e0b\u964d\uff0c\u800cCPU\u5360\u7528\u5374\u4f1a\u660e\u663e\u4e0a\u5347\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u5bf9discuz x 1.5\u7684\u8fd9\u4e2abug\u8f83\u597d\u89e3\u51b3\u65b9\u6cd5\u5c31\u662f\u540e\u53f0\u91cd\u65b0\u6b63\u786e\u8bbe\u7f6e\u8fdc\u7a0b\u9644\u4ef6\u53c2\u6570\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u4ee5\u4e0b\u662f\u6211\u9010\u6b65\u6574\u7406\u7684\u6545\u969c\u6392\u9664\u6b65\u9aa4\uff1a<\/p>\n<p>1. \u5f97\u5230\u5360\u7528cpu\u8d44\u6e90\u8fc7\u591a\u7684php-cgi\u8fdb\u7a0b\u7684pid(\u8fdb\u7a0bid)\uff0c \u4f7f\u7528top\u547d\u4ee4\u5373\u53ef\uff0c\u5982\u4e0b\u56fe\uff1a<\/p>\n<p>&nbsp;<br \/>\n<img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"https:\/\/www.icocean.com\/blog\/wp-content\/uploads\/auto_save_image\/2013\/12\/162843KA4.jpg\" width=\"700\" height=\"344\" \/><\/p>\n<p>\u7ecf\u8fc7\u4e0a\u56fe\uff0c\u6211\u4eec\u53d1\u73b0\uff0c\u6709\u4e24\u4e2aphp-cgi\u8fdb\u7a0b\u7684cpu\u8d44\u6e90\u5360\u7528\u7387\u8fc7\u9ad8\uff0cpid\u5206\u522b\u662f10059\uff0c11570\uff0c\u8fd9\u4e00\u822c\u90fd\u662f\u7a0b\u5e8f\u4f18\u5316\u4e0d\u591f\u9020\u6210\uff0c\u5982\u4f55\u5b9a\u4f4d\u95ee\u9898\u7684php\u7a0b\u5e8f\u4f4d\u7f6e\uff1f<\/p>\n<p>&nbsp;<\/p>\n<p>2. \u627e\u51fa\u8fdb\u7a0b\u6240\u4f7f\u7528\u7684\u6587\u4ef6<\/p>\n<p>\/proc\/\u6587\u4ef6\u7cfb\u7edf\u4fdd\u5b58\u5728\u5185\u5b58\u4e2d\uff0c\u4e3b\u8981\u4fdd\u5b58\u7cfb\u7edf\u7684\u72b6\u6001\uff0c\u5173\u952e\u914d\u7f6e\u7b49\u7b49\uff0c\u800c\/proc\/\u76ee\u5f55\u4e0b\u6709\u5f88\u591a\u6570\u5b57\u76ee\u5f55\uff0c\u5c31\u662f\u8fdb\u7a0b\u7684\u76f8\u5173\u4fe1\u606f\uff0c\u5982\u4e0b\u56fe\uff0c\u6211\u4eec\u770b\u770b\u8fdb\u7a0b10059\u6b63\u5728\u4f7f\u7528\u54ea\u4e9b\u6587\u4ef6\uff1f<br \/>\n<img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"https:\/\/www.icocean.com\/blog\/wp-content\/uploads\/auto_save_image\/2013\/12\/162845bJC.jpg\" width=\"700\" height=\"163\" \/><\/p>\n<p>\u663e\u7136\uff0c\u4f7f\u7528\u4e86\/home\/tmp\/sess_*\u6587\u4ef6\uff0c\u8fd9\u660e\u663e\u662fPHP\u7684session\u6587\u4ef6\uff0c \u6211\u4eec\u67e5\u770b\u8fd9\u4e2asession\u6587\u4ef6\u7684\u5185\u5bb9\u4e3a\uff1aview_time|123333312412<\/p>\n<p>&nbsp;<\/p>\n<p>\u5230 \u8fd9\u91cc\uff0c\u6211\u4eec\u5df2\u7ecf\u53ef\u4ee5\u6000\u7591\u662f\u7531\u4e8ephp\u7a0b\u5e8f\u5199\u5165\u4e00\u4e2a\u53ebview_time\u7684session\u9879\u800c\u5f15\u8d77\uff0c \u90a3\u4e48\u5269\u4f59\u7684\u4e8b\u4ef6\u5c31\u662f\u68c0\u67e5\u5305\u542bview_time\u7684\u6240\u6709php\u6587\u4ef6\uff0c\u7136\u540e\u4fee\u6539\u4e4b\uff08\u6bd4\u5982\u6539\u7528COOKIE\uff09\uff0c\u8fd9\u5b9e\u8bdd\uff0c \u8fd9\u4e2aview_time\u5e76\u975e\u654f\u611f\u6570\u636e\uff0c\u4ec5\u4ec5\u8bb0\u5f55\u7528\u6237\u6700\u540e\u8bbf\u95ee\u65f6\u95f4\uff0c\u5b9e\u5728\u6ca1\u5fc5\u8981\u4f7f\u7528\u4ee3\u4ef7\u5de8\u5927\u7684session, \u800c\u5e94\u8be5\u4f7f\u7528cookie\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>3. \u627e\u51fa\u6709\u95ee\u9898\u7684\u7a0b\u5e8f\uff0c\u4fee\u6539\u4e4b<\/p>\n<p>\u4f7f\u7528vi\u7f16\u8f91\u4ee5\u4e0bshell\u7a0b\u5e8f\uff08\u5047\u8bbe\u7f51\u7ad9\u7a0b\u5e8f\u4f4d\u4e8e\/www\u76ee\u5f55\u4e0b\uff09<\/p>\n<p>&nbsp;<\/p>\n<p>#!\/bin\/bash<br \/>\nfind \/www\/ -name &#8220;*.php&#8221; &gt; list.txt<\/p>\n<p>f=`cat .\/list.txt`<\/p>\n<p>for n in $f<br \/>\ndo<br \/>\nr=`egrep &#8216;view_time&#8217; $n`<br \/>\nif [ ! &#8220;$r&#8221; = &#8220;&#8221; ] ; then<br \/>\necho $n<br \/>\nfi<br \/>\ndone<\/p>\n<p>&nbsp;<\/p>\n<p>\u8fd0\u884c\u8fd9\u4e2ashell\u7a0b\u5e8f\uff0c\u5c06\u8f93\u51fa\u5305\u542b\u6709view_time\u7684\u6587\u4ef6\uff0c \u5bf9\u8bb0\u4e8b\u72d7\u5fae\u535a\u7cfb\u7edf\uff0c\u4ea7\u751f\u7684\u95ee\u9898\u4f4d\u4e8emodules\/topic.mod.class\u6587\u4ef6\u4e2d<\/p>\n<p>&nbsp;<\/p>\n<p>http:\/\/blog.csdn.net\/turkeyzhou\/article\/details\/6709953<\/p>\n<p>http:\/\/www.cnblogs.com\/cute\/archive\/2011\/04\/20\/2022280.html<\/p>\n<p>\u672c\u6587\u5185\u5bb9\u9075\u4ece<a href=\"http:\/\/creativecommons.org\/licenses\/by-nc-sa\/3.0\/deed.zh\" target=\"_blank\" rel=\"nofollow\">CC\u7248\u6743\u534f\u8bae<\/a>, \u53ef\u4ee5\u968f\u610f\u8f6c\u8f7d, \u4f46\u5fc5\u987b\u4ee5\u8d85\u94fe\u63a5\u5f62\u5f0f\u6807\u660e\u6587\u7ae0\u539f\u59cb\u51fa\u5904\u548c\u4f5c\u8005\u4fe1\u606f\u53ca\u7248\u6743\u58f0\u660e<br \/>\n\u7f51\u5740: http:\/\/www.penglixun.com\/tech\/system\/cpu_load_analyse.html<\/p>\n<p>\u6700\u8fd1\u5bf9\u6211\u7684\u672c\u672c\uff084\u68388\u7ebf\u7a0b\uff09\u7528top\u547d\u4ee4\u770b\u7cfb\u7edf\u72b6\u51b5\u51fa\u73b0\u4e86CPU\u5229\u7528\u7387\u8d85\u8fc7200%\u7684\u60c5\u51b5\uff0c\u975e\u5e38\u8be7\u5f02\uff0c\u67e5\u4e86\u4e0b\u76f8\u5173\u8d44\u6599\uff0c\u628a\u8fd9\u4e2a\u95ee\u9898\u5f04\u6e05\u695a\u4e86\u3002<br \/>\n\u9996\u5148\u6765\u5206\u6790\u4e0bCPU Load<\/p>\n<blockquote><p>load average: 0.09, 0.05, 0.01<\/p><\/blockquote>\n<p>\u5206\u522b\u662f1\u5206\u949f\u30015\u5206\u949f\u300115\u5206\u949f\u7684\u5e73\u5747Load\u3002<br \/>\nLoad\u8fd9\u4e2a\u4e1c\u897f\u600e\u4e48\u7406\u89e3\u5462\uff0c\u5c31\u50cf\u4e00\u6761\u9a6c\u8def\uff0c\u6709N\u4e2a\u8f66\u9053\uff0c\u5982\u679cN\u4e2a\u8fdb\u7a0b\u8fdb\u5165\u8f66\u9053\uff0c\u90a3\u4e48\u6b63\u597d\u4e00\u4eba\u4e00\u4e2a\uff0c\u518d\u591a\u4e00\u8f86\u8f66\u5c31\u5360\u4e0d\u5230\u8f66\u9053\uff0c\u8981\u7b49\u6709\u4e00\u4e2a\u8f66\u7a7a\u51fa\u8f66\u9053\u3002<br \/>\n\u5728 CPU\u4e2d\u53ef\u4ee5\u7406\u89e3\u4e3aCPU\u53ef\u4ee5\u5e76\u884c\u5904\u7406\u7684\u4efb\u52a1\u6570\uff0c\u90a3\u4e48\u5c31\u662f\u201cCPU\u4e2a\u6570 * \u6838\u6570\u201d\uff0c\u5982\u679cCPU Load = CPU\u4e2a\u6570 * \u6838\u6570 \u90a3\u4e48\u5c31\u662f\u8bf4CPU\u6b63\u597d\u6ee1\u8d1f\u8f7d\uff0c\u518d\u591a\u4e00\u70b9\uff0c\u53ef\u80fd\u5c31\u8981\u51fa\u95ee\u9898\u4e86\uff0c\u6709\u4efb\u52a1\u4e0d\u80fd\u88ab\u53ca\u65f6\u5206\u914d\u5904\u7406\u5668\uff0c\u90a3\u4e48\u4fdd\u8bc1\u6027\u80fd\u7684\u8bdd\uff0c\u6700\u597d\u662f\u5c0f\u4e8eCPU\u4e2a\u6570 * \u6838\u6570 *0.7\u3002<\/p>\n<blockquote><p>\u67e5\u770bCPU\u6838\u6570\u53ef\u4ee5\u901a\u8fc7\uff1agrep \u2018model name\u2019 \/proc\/cpuinfo<\/p><\/blockquote>\n<p>\u90a3\u4e48\u4ee5\u54ea\u4e2a\u5e73\u5747\u503c\u4e3a\u51c6\u5462\uff1f\u5982\u679c1\u5206\u949f\u5e73\u5747\u51fa\u73b0\u5927\u4e8eCPU\u4e2a\u6570 * \u6838\u6570\u7684\u60c5\u51b5\uff0c\u8fd8\u4e0d\u7528\u62c5\u5fc3\uff0c\u5982\u679c5\u5206\u949f\u5e73\u5747\u4e5f\u662f\uff0c\u90a3\u5c31\u8981\u8b66\u60d5\u4e86\uff0c15\u5206\u949f\u5e73\u5747\u4e5f\u662f\u8fd9\u6837\uff0c\u5c31\u8981\u5206\u6790\u54ea\u91cc\u51fa\u95ee\u9898\u4e86\uff0c\u9632\u8303\u4e8e\u672a\u7136<br \/>\nCPU\u5229\u7528\u7387\u8d85\u8fc7100%\u7684\u95ee\u9898\uff0c\u4e5f\u662f\u5dee\u4e0d\u591a\uff0ctop\u547d\u4ee4\u5e94\u8be5\u662f\u628a\u6bcf\u4e2a\u6838\u7684CPU\u5360\u7528\u7387\u52a0\u8d77\u6765\uff0c\u7b97\u4e00\u4e2a\u548c\uff0c\u4e8e\u662f\u591a\u6838\u60c5\u51b5\u4e0b\u4f1a\u51fa\u73b0\u8d85\u8fc7100%\u3002<\/p>\n<p>\u53e6\u5916Context Switch Rate\u4e5f\u662f\u4e2a\u975e\u5e38\u503c\u5f97\u6ce8\u610f\u7684\u503c\uff0c\u56e0\u4e3a\u7ebf\u7a0b\u95f4\u5207\u6362\u7684\u4ee3\u4ef7\u4e5f\u662f\u975e\u5e38\u9ad8\u7684\u3002<\/p>\n<blockquote><p>\u5f15\u7528\u4e00\u4e2a\u516c\u5f0f\uff1aContext Switch Rate = Interrupt Rate + TPS* N<\/p><\/blockquote>\n<p>\u5bf9\u4e8e\u4e00\u4e2a\u591a\u7ebf\u7a0b\u7684\u7a0b\u5e8f\uff0c\u6211\u89c9\u5f97\u51c6\u5907\u4e00\u4e2a\u63a7\u5236\u7ebf\u7a0b\u6765\u8c03\u5ea6\u4efb\u52a1\u662f\u975e\u5e38\u5fc5\u8981\u7684\uff0c\u514d\u5f97\u7ebf\u7a0b\u8fc7\u4e8e\u9ad8\u5e76\u53d1\uff0c\u5bfc\u81f4\u8d44\u6e90\u7684\u4e89\u7528\u548c\u7ebf\u7a0b\u5207\u6362\u5e26\u6765\u6027\u80fd\u95ee\u9898\uff0c\u6700\u597d\u63a7\u5236\u5e76\u53d1\u7684\u7ebf\u7a0b\u6570\u57fa\u672c\u7b49\u4e8eCPU\u7684\u603b\u6838\u6570\uff0c\u51cf\u5c11\u8fd9\u4e2aN\uff0c\u83b7\u5f97\u66f4\u597d\u7684\u5904\u7406\u5668\u6027\u80fd\u3002<\/p>\n<p>\u53c2\u8003\u4e86\u5982\u4e0b\u51e0\u7bc7\u6587\u7ae0\uff1a<br \/>\n<a href=\"http:\/\/blog.csdn.net\/marising\/archive\/2010\/01\/12\/5182771.aspx\" rel=\"nofollow\">\u538b\u529b\u6d4b\u8bd5\u8861\u91cfCPU\u7684\u4e09\u4e2a\u6307\u6807\uff1aCPU Utilization\u3001Load Average\u548cContext Switch Rate<\/a><br \/>\n<a href=\"http:\/\/www.blogjava.net\/cenwenchu\/archive\/2008\/06\/30\/211712.html\" rel=\"nofollow\">\u7406\u89e3Load Average\u505a\u597d\u538b\u529b\u6d4b\u8bd5<\/a><br \/>\n<a href=\"http:\/\/www.gracecode.com\/archives\/2973\/\" rel=\"nofollow\">\u7406\u89e3 Linux \u7684\u5904\u7406\u5668\u8d1f\u8f7d\u5747\u503c<\/a><br \/>\n<a href=\"http:\/\/blog.csdn.net\/marising\/archive\/2010\/01\/13\/5186643.aspx\" rel=\"nofollow\">\u9ad8\u6027\u80fd\u670d\u52a1\u5668\u67b6\u6784<\/a><\/p>\n<p>PS. \u6700\u8fd1\u535a\u5ba2\u5199\u5f97\u5c11\uff0c\u90fd\u8981\u957f\u8349\u4e86\u3002\u987a\u4fbf\u8d5e\u4e00\u4e0b\u963f\u91cc\u7684\u98df\u5802\uff0c\u6bd4\u6211\u4eec\u5b66\u6821\u98df\u5802\u56db\u5e74\u4e0d\u53d8\u83dc\u996d\u8fd8\u8d35\u597d\u591a\u4e86\u3002<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<div align=\"left\">\n<div>\n<div>\n<div>\n<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"7\"><\/td>\n<td nowrap=\"nowrap\">\n<div>\u67e5\u770b\u6587\u7ae0<\/div>\n<\/td>\n<td align=\"right\" nowrap=\"nowrap\"><\/td>\n<td width=\"7\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div>\n<div>\u7406\u89e3Linux \u7684\u5904\u7406\u5668\u8d1f\u8f7d\u5747\u503c\uff08Understanding Linux CPU Load &#8211; when should you be worried?\uff09<\/div>\n<div>2011-03-10 16:12<\/div>\n<table>\n<tbody>\n<tr>\n<td>\n<div>\n<p>\u4f60\u53ef\u80fd\u5bf9\u4e8e Linux \u7684\u8d1f\u8f7d\u5747\u503c\uff08load averages\uff09\u5df2\u6709\u4e86\u5145\u5206\u7684\u4e86\u89e3\u3002\u8d1f\u8f7d\u5747\u503c\u5728 uptime \u6216\u8005 top \u547d\u4ee4\u4e2d\u53ef\u4ee5\u770b\u5230\uff0c\u5b83\u4eec\u53ef\u80fd\u4f1a\u663e\u793a\u6210\u8fd9\u4e2a\u6837\u5b50\uff1a<\/p>\n<p>load average: 0.09, 0.05, 0.01<\/p>\n<p>\u5f88\u591a\u4eba\u4f1a\u8fd9\u6837\u7406\u89e3\u8d1f\u8f7d\u5747\u503c\uff1a\u4e09\u4e2a\u6570\u5206\u522b\u4ee3\u8868\u4e0d\u540c\u65f6\u95f4\u6bb5\u7684\u7cfb\u7edf\u5e73\u5747\u8d1f\u8f7d\uff08\u4e00\u5206\u949f\u3001\u4e94 \u5206\u949f\u3001\u4ee5\u53ca\u5341\u4e94\u5206\u949f\uff09\uff0c\u5b83\u4eec\u7684\u6570\u5b57\u5f53\u7136\u662f\u8d8a\u5c0f\u8d8a\u597d\u3002\u6570\u5b57\u8d8a\u9ad8\uff0c\u8bf4\u660e\u670d\u52a1\u5668\u7684\u8d1f\u8f7d\u8d8a \u5927\uff0c\u8fd9\u4e5f\u53ef\u80fd\u662f\u670d\u52a1\u5668\u51fa\u73b0\u67d0\u79cd\u95ee\u9898\u7684\u4fe1\u53f7\u3002<\/p>\n<p>\u800c\u4e8b\u5b9e\u4e0d\u5b8c\u5168\u5982\u6b64\uff0c\u662f\u4ec0\u4e48\u56e0\u7d20\u6784\u6210\u4e86\u8d1f\u8f7d\u5747\u503c\u7684\u5927\u5c0f\uff0c\u4ee5\u53ca\u5982\u4f55\u533a\u5206\u5b83\u4eec\u76ee\u524d\u7684\u72b6\u51b5\u662f \u201c\u597d\u201d\u8fd8\u662f\u201c\u7cdf\u7cd5\u201d\uff1f\u4ec0\u4e48\u65f6\u5019\u5e94\u8be5\u6ce8\u610f\u54ea\u4e9b\u4e0d\u6b63\u5e38\u7684\u6570\u503c\uff1f<\/p>\n<p>\u56de\u7b54\u8fd9\u4e9b\u95ee\u9898\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u4e86\u89e3\u4e0b\u8fd9\u4e9b\u6570\u503c\u80cc\u540e\u7684\u4e9b\u77e5\u8bc6\u3002\u6211\u4eec\u5148\u7528\u6700\u7b80\u5355\u7684\u4f8b\u5b50\u8bf4\u660e\uff0c \u4e00\u53f0\u53ea\u914d\u5907\u4e00\u5757\u5355\u6838\u5904\u7406\u5668\u7684\u670d\u52a1\u5668\u3002<\/p>\n<p>\u884c\u8f66\u8fc7\u6865<\/p>\n<p>\u4e00 \u53ea\u5355\u6838\u7684\u5904\u7406\u5668\u53ef\u4ee5\u5f62\u8c61\u5f97\u6bd4\u55bb\u6210\u4e00\u6761\u5355\u8f66\u9053\u3002\u8bbe\u60f3\u4e0b\uff0c\u4f60\u73b0\u5728\u9700\u8981\u6536\u53d6\u8fd9\u6761\u9053\u8def\u7684\u8fc7\u6865 \u8d39 &#8212; \u5fd9\u4e8e\u5904\u7406\u90a3\u4e9b\u5c06\u8981\u8fc7\u6865\u7684\u8f66\u8f86\u3002\u4f60\u9996\u5148\u5f53\u7136\u9700\u8981\u4e86\u89e3\u4e9b\u4fe1\u606f\uff0c\u4f8b\u5982\u8f66\u8f86\u7684\u8f7d\u91cd\u3001\u4ee5\u53ca \u8fd8\u6709\u591a\u5c11\u8f66\u8f86\u6b63\u5728\u7b49\u5f85\u8fc7\u6865\u3002\u5982\u679c\u524d\u9762\u6ca1\u6709\u8f66\u8f86\u5728\u7b49\u5f85\uff0c\u90a3\u4e48\u4f60\u53ef\u4ee5\u544a\u8bc9\u540e\u9762\u7684\u53f8\u673a\u901a\u8fc7\u3002 \u5982\u679c\u8f66\u8f86\u4f17\u591a\uff0c\u90a3\u4e48\u9700\u8981\u544a\u77e5\u4ed6\u4eec\u53ef\u80fd\u9700\u8981\u7a0d\u7b49\u4e00\u4f1a\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u9700\u8981\u4e9b\u7279\u5b9a\u7684\u4ee3\u53f7\u8868\u793a\u76ee\u524d\u7684\u8f66\u6d41\u60c5\u51b5\uff0c\u4f8b\u5982\uff1a<\/p>\n<p><strong>0.00 \u8868\u793a\u76ee\u524d\u6865\u9762\u4e0a\u6ca1\u6709\u4efb\u4f55\u7684\u8f66\u6d41\u3002<\/strong>\u5b9e\u9645\u4e0a\u8fd9\u79cd\u60c5\u51b5\u4e0e 0.00 \u548c 1.00 \u4e4b\u95f4\u662f\u76f8\u540c\u7684\uff0c\u603b\u800c\u8a00\u4e4b\u5f88\u901a\u7545\uff0c\u8fc7\u5f80\u7684\u8f66\u8f86\u53ef\u4ee5\u4e1d\u6beb\u4e0d\u7528\u7b49\u5f85\u7684\u901a\u8fc7\u3002<strong>1.00 \u8868\u793a\u521a\u597d\u662f\u5728\u8fd9\u5ea7\u6865\u7684\u627f\u53d7\u8303\u56f4\u5185\u3002<\/strong>\u8fd9\u79cd\u60c5\u51b5\u4e0d\u7b97\u7cdf\u7cd5\uff0c\u53ea\u662f\u8f66\u6d41\u4f1a\u6709\u4e9b\u5835\uff0c\u4e0d\u8fc7\u8fd9\u79cd\u60c5\u51b5\u53ef\u80fd\u4f1a\u9020\u6210\u4ea4\u901a\u8d8a\u6765\u8d8a\u6162\u3002<strong>\u8d85\u8fc7 1.00\uff0c\u90a3\u4e48\u8bf4\u660e\u8fd9\u5ea7\u6865\u5df2\u7ecf\u8d85\u51fa\u8d1f\u8377\uff0c\u4ea4\u901a\u4e25\u91cd\u7684\u62e5\u5835\u3002<\/strong>\u90a3\u4e48\u60c5\u51b5\u6709\u591a\u7cdf\u7cd5\uff1f \u4f8b\u5982 2.00 \u7684\u60c5\u51b5\u8bf4\u660e\u8f66\u6d41\u5df2\u7ecf\u8d85\u51fa\u4e86\u6865\u6240\u80fd\u627f\u53d7\u7684\u4e00\u500d\uff0c\u90a3\u4e48\u5c06\u6709\u591a\u4f59\u8fc7\u6865\u4e00\u500d\u7684\u8f66\u8f86\u6b63\u5728\u7126\u6025\u7684\u7b49\u5f85\u30023.00 \u7684\u8bdd\u60c5\u51b5\u5c31\u66f4\u4e0d\u5999\u4e86\uff0c\u8bf4\u660e\u8fd9\u5ea7\u6865\u57fa\u672c\u4e0a\u5df2\u7ecf\u5feb\u627f\u53d7\u4e0d\u4e86\uff0c\u8fd8\u6709\u8d85\u51fa\u6865\u8d1f\u8f7d\u4e24\u500d\u591a\u7684\u8f66\u8f86\u6b63\u5728\u7b49\u5f85\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.icocean.com\/blog\/wp-content\/uploads\/auto_save_image\/2013\/12\/162846NRh.jpg\" \/><\/p>\n<p>\u4e0a\u9762\u7684\u60c5\u51b5\u548c\u5904\u7406\u5668\u7684\u8d1f\u8f7d\u60c5\u51b5\u975e\u5e38\u76f8\u4f3c\u3002\u4e00\u8f86\u6c7d\u8f66\u7684\u8fc7\u6865\u65f6\u95f4\u5c31\u597d\u6bd4\u662f\u5904\u7406\u5668\u5904\u7406\u67d0\u7ebf\u7a0b \u7684\u5b9e\u9645\u65f6\u95f4\u3002Unix \u7cfb\u7edf\u5b9a\u4e49\u7684\u8fdb\u7a0b\u8fd0\u884c\u65f6\u957f\u4e3a\u6240\u6709\u5904\u7406\u5668\u5185\u6838\u7684\u5904\u7406\u65f6\u95f4\u52a0\u4e0a\u7ebf\u7a0b \u5728\u961f\u5217\u4e2d\u7b49\u5f85\u7684\u65f6\u95f4\u3002<\/p>\n<p>\u548c\u6536\u8fc7\u6865\u8d39\u7684\u7ba1\u7406\u5458\u4e00\u6837\uff0c\u4f60\u5f53\u7136\u5e0c\u671b\u4f60\u7684\u6c7d\u8f66\uff08\u64cd\u4f5c\uff09\u4e0d\u4f1a\u88ab\u7126\u6025\u7684\u7b49\u5f85\u3002\u6240\u4ee5\uff0c\u7406\u60f3\u72b6\u6001 \u4e0b\uff0c\u90fd\u5e0c\u671b\u8d1f\u8f7d\u5e73\u5747\u503c\u5c0f\u4e8e 1.00 \u3002\u5f53\u7136\u4e0d\u6392\u9664\u90e8\u5206\u5cf0\u503c\u4f1a\u8d85\u8fc7 1.00\uff0c\u4f46\u957f\u6b64\u4ee5\u5f80\u4fdd\u6301\u8fd9 \u4e2a\u72b6\u6001\uff0c\u5c31\u8bf4\u660e\u4f1a\u6709\u95ee\u9898\uff0c\u8fd9\u65f6\u5019\u4f60\u5e94\u8be5\u4f1a\u5f88\u7126\u6025\u3002<\/p>\n<p>\u201c\u6240\u4ee5\u4f60\u8bf4\u7684\u7406\u60f3\u8d1f\u8377\u4e3a 1.00 \uff1f\u201d<\/p>\n<p>\u55ef\uff0c\u8fd9\u79cd\u60c5\u51b5\u5176\u5b9e\u5e76\u4e0d\u5b8c\u5168\u6b63\u786e\u3002\u8d1f\u8377 1.00 \u8bf4\u660e\u7cfb\u7edf\u5df2\u7ecf\u6ca1\u6709\u5269\u4f59\u7684\u8d44\u6e90\u4e86\u3002\u5728\u5b9e\u9645\u60c5\u51b5\u4e2d \uff0c\u6709\u7ecf\u9a8c\u7684\u7cfb\u7edf\u7ba1\u7406\u5458\u90fd\u4f1a\u5c06\u8fd9\u6761\u7ebf\u5212\u5728 0.70\uff1a<\/p>\n<p><strong>\u201c\u9700\u8981\u8fdb\u884c\u8c03\u67e5\u6cd5\u5219\u201d\uff1a<\/strong>\u5982\u679c\u957f\u671f\u4f60\u7684\u7cfb\u7edf\u8d1f\u8f7d\u5728 0.70 \u4e0a\u4e0b\uff0c\u90a3\u4e48\u4f60\u9700\u8981\u5728\u4e8b\u60c5\u53d8\u5f97\u66f4\u7cdf\u7cd5\u4e4b\u524d\uff0c\u82b1\u4e9b\u65f6\u95f4\u4e86\u89e3\u5176\u539f\u56e0\u3002<strong>\u201c\u73b0\u5728\u5c31\u8981\u4fee\u590d\u6cd5\u5219\u201d\uff1a1.00 \u3002<\/strong>\u5982\u679c\u4f60\u7684\u670d\u52a1\u5668\u7cfb\u7edf\u8d1f\u8f7d\u957f\u671f\u5f98\u5f8a\u4e8e 1.00\uff0c\u90a3\u4e48\u5c31\u5e94\u8be5\u9a6c\u4e0a\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002\u5426\u5219\uff0c\u4f60\u5c06\u534a\u591c\u63a5\u5230\u4f60\u4e0a\u53f8\u7684\u7535\u8bdd\uff0c\u8fd9\u53ef\u4e0d\u662f\u4ef6\u4ee4\u4eba\u6109\u5feb\u7684\u4e8b\u60c5\u3002<strong>\u201c\u51cc\u6668\u4e09\u70b9\u534a\u953b\u70bc\u8eab\u4f53\u6cd5\u5219\u201d\uff1a5.00\u3002<\/strong>\u5982\u679c\u4f60\u7684\u670d\u52a1\u5668\u8d1f\u8f7d\u8d85\u8fc7\u4e86 5.00 \u8fd9\u4e2a\u6570\u5b57\uff0c\u90a3\u4e48\u4f60\u5c06\u5931\u53bb\u4f60\u7684\u7761\u7720\uff0c\u8fd8\u5f97\u5728\u4f1a\u8bae\u4e2d\u8bf4\u660e\u8fd9\u60c5\u51b5\u53d1\u751f\u7684\u539f\u56e0\uff0c\u603b\u4e4b\u5343\u4e07\u4e0d\u8981\u8ba9\u5b83\u53d1\u751f\u3002 \u90a3\u4e48\u591a\u4e2a\u5904\u7406\u5668\u5462\uff1f\u6211\u7684\u5747\u503c\u662f 3.00\uff0c\u4f46\u662f\u7cfb\u7edf\u8fd0\u884c\u6b63\u5e38\uff01<\/p>\n<p>\u54c7\u5594\uff0c\u4f60\u6709\u56db\u4e2a\u5904\u7406\u5668\u7684\u4e3b\u673a\uff1f\u90a3\u4e48\u5b83\u7684\u8d1f\u8f7d\u5747\u503c\u5728 3.00 \u662f\u5f88\u6b63\u5e38\u7684\u3002<\/p>\n<p>\u5728\u591a\u5904\u7406\u5668\u7cfb\u7edf\u4e2d\uff0c\u8d1f\u8f7d\u5747\u503c\u662f\u57fa\u4e8e\u5185\u6838\u7684\u6570\u91cf\u51b3\u5b9a\u7684\u3002\u4ee5 100% \u8d1f\u8f7d\u8ba1\u7b97\uff0c1.00 \u8868\u793a\u5355\u4e2a\u5904\u7406\u5668\uff0c\u800c 2.00 \u5219\u8bf4\u660e\u6709\u4e24\u4e2a\u53cc\u5904\u7406\u5668\uff0c\u90a3\u4e48 4.00 \u5c31\u8bf4\u660e\u4e3b\u673a\u5177\u6709\u56db\u4e2a\u5904\u7406\u5668\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.icocean.com\/blog\/wp-content\/uploads\/auto_save_image\/2013\/12\/162846UtA.jpg\" \/><\/p>\n<p>\u56de\u5230\u6211\u4eec\u4e0a\u9762\u6709\u5173\u8f66\u8f86\u8fc7\u6865\u7684\u6bd4\u55bb\u30021.00 \u6211\u8bf4\u8fc7\u662f\u201c\u4e00\u6761\u5355\u8f66\u9053\u7684\u9053\u8def\u201d\u3002\u90a3\u4e48\u5728\u5355\u8f66\u9053 1.00 \u60c5\u51b5\u4e2d\uff0c\u8bf4\u660e\u8fd9\u6865\u6881\u5df2\u7ecf\u88ab\u8f66\u585e\u6ee1\u4e86\u3002\u800c\u5728\u53cc\u5904\u7406\u5668\u7cfb\u7edf\u4e2d\uff0c\u8fd9\u610f\u5473\u7740\u591a\u51fa\u4e86\u4e00\u500d\u7684 \u8d1f\u8f7d\uff0c\u4e5f\u5c31\u662f\u8bf4\u8fd8\u6709 50% \u7684\u5269\u4f59\u7cfb\u7edf\u8d44\u6e90 &#8212; \u56e0\u4e3a\u8fd8\u6709\u53e6\u5916\u6761\u8f66\u9053\u53ef\u4ee5\u901a\u884c\u3002<\/p>\n<p>\u6240\u4ee5\uff0c\u5355\u5904\u7406\u5668\u5df2\u7ecf\u5728\u8d1f\u8f7d\u7684\u60c5\u51b5\u4e0b\uff0c\u53cc\u5904\u7406\u5668\u7684\u8d1f\u8f7d\u6ee1\u989d\u7684\u60c5\u51b5\u662f 2.00\uff0c\u5b83\u8fd8\u6709\u4e00\u500d\u7684\u8d44\u6e90\u53ef\u4ee5\u5229\u7528\u3002<\/p>\n<p>\u591a\u6838\u4e0e\u591a\u5904\u7406\u5668<\/p>\n<p>\u5148\u8131\u79bb\u4e0b\u4e3b\u9898\uff0c\u6211\u4eec\u6765\u8ba8\u8bba\u4e0b\u591a\u6838\u5fc3\u5904\u7406\u5668\u4e0e\u591a\u5904\u7406\u5668\u7684\u533a\u522b\u3002\u4ece\u6027\u80fd\u7684\u89d2\u5ea6\u4e0a\u7406\u89e3\uff0c\u4e00\u53f0\u4e3b \u673a\u62e5\u6709\u591a\u6838\u5fc3\u7684\u5904\u7406\u5668\u4e0e\u53e6\u53f0\u62e5\u6709\u540c\u6837\u6570\u76ee\u7684\u5904\u7406\u6027\u80fd\u57fa\u672c\u4e0a\u53ef\u4ee5\u8ba4\u4e3a\u662f\u76f8\u5dee\u65e0\u51e0\u3002\u5f53\u7136\u5b9e\u9645 \u60c5\u51b5\u4f1a\u590d\u6742\u5f97\u591a\uff0c\u4e0d\u540c\u6570\u91cf\u7684\u7f13\u5b58\u3001\u5904\u7406\u5668\u7684\u9891\u7387\u7b49\u56e0\u7d20\u90fd\u53ef\u80fd\u9020\u6210\u6027\u80fd\u7684\u5dee\u5f02\u3002<\/p>\n<p>\u4f46\u5373\u4fbf\u8fd9\u4e9b\u56e0\u7d20\u9020\u6210\u7684\u5b9e\u9645\u6027\u80fd\u7a0d\u6709\u4e0d\u540c\uff0c\u5176\u5b9e\u7cfb\u7edf\u8fd8\u662f\u4ee5\u5904\u7406\u5668\u7684\u6838\u5fc3\u6570\u91cf\u8ba1\u7b97\u8d1f\u8f7d\u5747\u503c \u3002\u8fd9\u4f7f\u6211\u4eec\u6709\u4e86\u4e24\u4e2a\u65b0\u7684\u6cd5\u5219\uff1a<\/p>\n<p><strong>\u201c\u6709\u591a\u5c11\u6838\u5fc3\u5373\u4e3a\u6709\u591a\u5c11\u8d1f\u8377\u201d\u6cd5\u5219\uff1a<\/strong>\u5728\u591a\u6838\u5904\u7406\u4e2d\uff0c\u4f60\u7684\u7cfb\u7edf\u5747\u503c\u4e0d\u5e94\u8be5\u9ad8\u4e8e\u5904\u7406\u5668\u6838\u5fc3\u7684\u603b\u6570\u91cf\u3002<strong>\u201c\u6838\u5fc3\u7684\u6838\u5fc3\u201d\u6cd5\u5219\uff1a<\/strong>\u6838\u5fc3\u5206\u5e03\u5728\u5206\u522b\u51e0\u4e2a\u5355\u4e2a\u7269\u7406\u5904\u7406\u4e2d\u5e76\u4e0d\u91cd\u8981\uff0c\u5176\u5b9e\u4e24\u9897\u56db\u6838\u7684\u5904\u7406\u5668 \u7b49\u4e8e \u56db\u4e2a\u53cc\u6838\u5904\u7406\u5668 \u7b49\u4e8e \u516b\u4e2a\u5355\u5904\u7406\u5668\u3002\u6240\u4ee5\uff0c\u5b83\u5e94\u8be5\u6709\u516b\u4e2a\u5904\u7406\u5668\u5185\u6838\u3002 \u5ba1\u89c6\u6211\u4eec\u81ea\u5df1<\/p>\n<p>\u8ba9\u6211\u4eec\u518d\u6765\u770b\u770b uptime \u7684\u8f93\u51fa<\/p>\n<p>~ $ uptime 23:05 up 14 days, 6:08, 7 users, load averages: 0.65 0.42 0.36<\/p>\n<p>\u8fd9\u662f\u4e2a\u53cc\u6838\u5904\u7406\u5668\uff0c\u4ece\u7ed3\u679c\u4e5f\u8bf4\u660e\u6709\u5f88\u591a\u7684\u7a7a\u95f2\u8d44\u6e90\u3002\u5b9e\u9645\u60c5\u51b5\u662f\u5373\u4fbf\u5b83\u7684\u5cf0\u503c\u4f1a\u5230 1.7\uff0c\u6211\u4e5f\u4ece\u6765\u6ca1\u6709\u8003\u8651\u8fc7\u5b83\u7684\u8d1f\u8f7d\u95ee\u9898\u3002<\/p>\n<p>\u90a3\u4e48\uff0c\u600e\u4e48\u4f1a\u6709\u4e09\u4e2a\u6570\u5b57\u7684\u786e\u8ba9\u4eba\u56f0\u6270\u3002\u6211\u4eec\u77e5\u9053\uff0c0.65\u30010.42\u30010.36 \u5206\u522b\u8bf4\u660e\u4e0a\u4e00\u5206\u949f\u3001\u6700\u540e\u4e94\u5206\u949f\u4ee5\u53ca\u6700\u540e\u5341\u4e94\u5206\u949f\u7684\u7cfb\u7edf\u8d1f\u8f7d\u5747\u503c\u3002\u90a3\u4e48\u8fd9\u53c8\u5e26\u6765\u4e86\u4e00\u4e2a\u95ee\u9898\uff1a<\/p>\n<p><strong>\u6211\u4eec\u4ee5\u54ea\u4e2a\u6570\u5b57\u4e3a\u51c6\uff1f\u4e00\u5206\u949f\uff1f\u4e94\u5206\u949f\uff1f\u8fd8\u662f\u5341\u4e94\u5206\u949f\uff1f<\/strong><\/p>\n<p>\u5176 \u5b9e\u5bf9\u4e8e\u8fd9\u4e9b\u6570\u5b57\u6211\u4eec\u5df2\u7ecf\u8c08\u8bba\u4e86\u5f88\u591a\uff0c\u6211\u8ba4\u4e3a\u4f60\u5e94\u8be5\u7740\u773c\u4e8e\u4e94\u5206\u949f\u6216\u8005\u5341\u4e94\u5206\u949f\u7684\u5e73\u5747\u6570 \u503c\u3002\u5766\u767d\u8bb2\uff0c\u5982\u679c\u524d\u4e00\u5206\u949f\u7684\u8d1f\u8f7d\u60c5\u51b5\u662f 1.00\uff0c\u90a3\u4e48\u4ecd\u53ef\u4ee5\u8bf4\u660e\u8ba4\u5b9a\u670d\u52a1\u5668\u60c5\u51b5\u8fd8\u662f\u6b63\u5e38\u7684\u3002 \u4f46\u662f\u5982\u679c\u5341\u4e94\u5206\u949f\u7684\u6570\u503c\u4ecd\u7136\u4fdd\u6301\u5728 1.00\uff0c\u90a3\u4e48\u5c31\u503c\u5f97\u6ce8\u610f\u4e86\uff08\u6839\u636e\u6211\u7684\u7ecf\u9a8c\uff0c\u8fd9\u65f6\u5019\u4f60\u5e94 \u8be5\u589e\u52a0\u7684\u5904\u7406\u5668\u6570\u91cf\u4e86\uff09\u3002<\/p>\n<p><strong>\u90a3\u4e48\u6211\u5982\u4f55\u5f97\u77e5\u6211\u7684\u7cfb\u7edf\u88c5\u5907\u4e86\u591a\u5c11\u6838\u5fc3\u7684\u5904\u7406\u5668\uff1f<\/strong><\/p>\n<p>\u5728 Linux \u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528<\/p>\n<p>cat \/proc\/cpuinfo<\/p>\n<p>\u83b7\u53d6\u4f60\u7cfb\u7edf\u4e0a\u7684\u6bcf\u4e2a\u5904\u7406\u5668\u7684\u4fe1\u606f\u3002\u5982\u679c\u4f60\u53ea\u60f3\u5f97\u5230\u6570\u5b57\uff0c\u90a3\u4e48\u5c31\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\uff1a<\/p>\n<p>grep &#8216;model name&#8217; \/proc\/cpuinfo | wc -l<\/p>\n<p>&nbsp;<\/p>\n<p>\u539f\u6587\uff1a<\/p>\n<p>You might be familiar with Linux load averages already. Load averages are the three numbers shown with theuptimeandtopcommands &#8211; they look like this:<\/p>\n<div>load average: 0.09, 0.05, 0.01<\/div>\n<p>Most people have an inkling of what the load averages mean: the three numbers represent averages over progressively longer periods of time (on<wbr \/>e, five, and fifteen minute averages), and that lower numbers are better. Higher numbers represent a problem or an overloaded machine. But, what&#8217;s the the threshold? What constitutes &#8220;good&#8221; and &#8220;bad&#8221; load average values? When should you be concerned over a load average value, and when should you scramble to fix it ASAP?<\/p>\n<p>First, a little background on what the load average values mean. We&#8217;ll start out with the simplest case: a machine with on<wbr \/>e single-core processor.<\/p>\n<p>The traffic analogy<\/p>\n<p>A single-core CPU is like a single lane of traffic. Imagine you are a bridge operator &#8230; sometimes your bridge is so busy there are cars lined up to cross. You want to let folks know how traffic is moving on your bridge. A decent metric would be<em>how many cars are waiting<\/em>at a particular time. If no cars are waiting, incoming drivers know they can drive across right away. If cars are backed up, drivers know they&#8217;re in for delays.<\/p>\n<p>So, Bridge Operator, what numbering system are you going to use? How about:<\/p>\n<p><strong>0.00 means there&#8217;s no traffic on the bridge at all<\/strong>. In fact, between 0.00 and 1.00 means there&#8217;s no backup, and an arriving car will just go right on.<strong>1.00 means the bridge is<em>exactly<\/em>at capacity.<\/strong>All is still good, but if traffic gets a little heavier, things are going to slow down.<strong>over 1.00 means there&#8217;s backup.<\/strong>How much? Well, 2.00 means that there are two lanes worth of cars total &#8212; on<wbr \/>e lane&#8217;s worth on the bridge, and on<wbr \/>e lane&#8217;s worth waiting. 3.00 means there are three lane&#8217;s worth total &#8212; on<wbr \/>e lane&#8217;s worth on the bridge, and two lanes&#8217; worth waiting. Etc.<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.icocean.com\/blog\/wp-content\/uploads\/auto_save_image\/2013\/12\/162847tzT.jpg\" \/>= load of 1.00<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.icocean.com\/blog\/wp-content\/uploads\/auto_save_image\/2013\/12\/1628478lm.jpg\" \/>= load of 0.50<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.icocean.com\/blog\/wp-content\/uploads\/auto_save_image\/2013\/12\/162847Sjb.jpg\" \/>= load of 1.70<\/p>\n<p>This is basically what CPU load is. &#8220;Cars&#8221; are processes using a slice of CPU time (&#8220;crossing the bridge&#8221;) or queued up to use the CPU. Unix refers to this as the<em>run-queue length<\/em>: the sum of the number of processes that are currently running plus the number that are waiting (queued) to run.<\/p>\n<p>Like the bridge operator, you&#8217;d like your cars\/processes to never be waiting. So, your CPU load should ideally stay below 1.00. Also like the bridge operator, you are still ok if you get some temporary spikes above 1.00 &#8230; but when you&#8217;re consistently above 1.00, you need to worry.<\/p>\n<p>So you&#8217;re saying the ideal load is 1.00?<\/p>\n<p>Well, not exactly. The problem with a load of 1.00 is that you have no headroom. In practice, many sysadmins will draw a line at 0.70:<\/p>\n<p>The<strong>&#8220;Need to Look into it&#8221;<\/strong>Rule of Thumb:<strong>0.70<\/strong>If your load average is staying above &gt; 0.70, it&#8217;s time to investigate before things get worse.<\/p>\n<p>The<strong>&#8220;Fix this now&#8221;<\/strong>Rule of Thumb:<strong>1.00<\/strong>. If your load average stays above 1.00, find the problem and fix it now. Otherwise, you&#8217;re going to get woken up in the middle of the night, and it&#8217;s not going to be fun.<\/p>\n<p>The<strong>&#8220;Arrgh, it&#8217;s 3AM WTF?&#8221;<\/strong>Rule of Thumb:<strong>5.0<\/strong>. If your load average is above 5.00, you could be in serious trouble, your box is either hanging or slowing way down, and this will (inexplicably) happen in the worst possible time like in the middle of the night or when you&#8217;re presenting at a conference. Don&#8217;t let it get there.<\/p>\n<p>What about Multi-processors? My load says 3.00, but things are running fine!<\/p>\n<p>Got a quad-processor system? It&#8217;s still healthy with a load of 3.00.<\/p>\n<p>On multi-processor system, the load is relative to the number of processor cores available. The &#8220;100% utilization&#8221; mark is 1.00 on a single-core system, 2.00, on a dual-core, 4.00 on a quad-core, etc.<\/p>\n<p>If we go back to the bridge analogy, the &#8220;1.00&#8221; really means &#8220;on<wbr \/>e lane&#8217;s worth of traffic&#8221;. On a on<wbr \/>e-lane bridge, that means it&#8217;s filled up. On a two-late bridge, a load of 1.00 means its at 50% capacity &#8212; on<wbr \/>ly on<wbr \/>e lane is full, so there&#8217;s another whole lane that can be filled.<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.icocean.com\/blog\/wp-content\/uploads\/auto_save_image\/2013\/12\/162848FRW.jpg\" \/>= load of 2.00 on two-lane road<\/p>\n<p>Same with CPUs: a load of 1.00 is 100% CPU utilization on single-core box. On a dual-core box, a load of 2.00 is 100% CPU utilization.<\/p>\n<p>Multicore vs. multiprocessor<\/p>\n<p>While we&#8217;re on the topic, let&#8217;s talk about multicore vs. multiprocessor. For performance purposes, is a machine with a single dual-core processor basically equivalent to a machine with two processors with on<wbr \/>e core each? Yes. Roughly. There are lots of subtleties here concerning amount of cache, frequency of process hand-offs between processors, etc. Despite those finer points, for the purposes of sizing up the CPU load value, the<em>total number of cores<\/em>is what matters, regardless of how many physical processors those cores are spread across.<\/p>\n<p>Which leads us to a two new Rules of Thumb:<\/p>\n<p><em>The &#8220;number of cores = max load&#8221;<\/em>Rule of Thumb: on a multicore system, your load should not exceed the number of cores available.<\/p>\n<p>The<em>&#8220;cores is cores&#8221;<\/em>Rule of Thumb: How the cores are spread out over CPUs doesn&#8217;t matter. Two quad-cores == four dual-cores == eight single-cores. It&#8217;s all eight cores for these purposes.<\/p>\n<p>Bringing It Home<\/p>\n<p>Let&#8217;s take a look at the load averages output fromuptime:<\/p>\n<div>~ $ uptime<br \/>\n23:05 up 14 days, 6:08, 7 users, load averages: 0.65 0.42 0.36<\/div>\n<p>This is on a dual-core CPU, so we&#8217;ve got lots of headroom. I won&#8217;t even think about it until load gets and stays above 1.7 or so.<\/p>\n<p>Now, what about those three numbers? 0.65 is the average over the last minute, 0.42 is the average over the last five minutes, and 0.36 is the average over the last 15 minutes. Which brings us to the question:<\/p>\n<p><strong>Which average should I be observing? On<wbr \/>e, five, or 15 minute?<\/strong><\/p>\n<p>For the numbers we&#8217;ve talked about (1.00 = fix it now, etc), you should be looking at the five or 15-minute averages. Frankly, if your box spikes above 1.0 on the on<wbr \/>e-minute average, you&#8217;re still fine. It&#8217;s when the 15-minute average goes north of 1.0 and stays there that you need to snap to. (obviously, as we&#8217;ve learned, adjust these numbers to the number of processor cores your system has).<\/p>\n<p><strong>So # of cores is imp<wbr \/>ortant to interpreting load averages &#8230; how do I know how many cores my system has?<\/strong><\/p>\n<p>cat \/proc\/cpuinfoto get info on each processor in your system.<em>Note: not available on OSX, Google for alternatives<\/em>. To get just a count, run it throughgrepand word count:grep &#8216;model name&#8217; \/proc\/cpuinfo | wc -l<\/p>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>http:\/\/hi.baidu.com\/moonlitshiny\/blog\/item\/538fc10446fca5121c958341.html<br \/>\nhttp:\/\/www.penglixun.com\/tech\/system\/cpu_load_analyse.html<br \/>\ntomcat cpu\u5360\u7528\u8fc7\u9ad8\uff0c\u7cfb\u7edf\u8d1f\u8f7d\u9ad8\u95ee\u9898\u8ddf\u8e2a<\/p>\n<p><a title=\"\u7ebf\u4e0a\" href=\"http:\/\/www.haogongju.net\/tag\/%E7%BA%BF%E4%B8%8A\" target=\"_blank\" rel=\"nofollow\">\u7ebf\u4e0a<\/a>8\u6838\u00a0<a title=\"linux\u670d\u52a1\u5668\" href=\"http:\/\/www.haogongju.net\/tag\/linux%E6%9C%8D%E5%8A%A1%E5%99%A8\" target=\"_blank\" rel=\"nofollow\">linux\u670d\u52a1\u5668<\/a>\uff0c\u8d1f\u8f7d\u4e3a8\u4e3a\u6b63\u5e38\u60c5\u51b5\uff0c\u76ee\u524dCPU\u8d1f\u8f7d\u8fc7\u9ad8\uff0c\u6700\u9ad8\u8d1f\u8f7d30\u591a\uff0c\u5e73\u5747\u8d1f\u8f7d\u572820\u5de6\u53f3\uff0c\u5df2\u7ecf\u6301\u7eed\u8fd1\u4e00\u5468\uff0c\u5177\u4f53\u5360\u7528CPU<a title=\"\u8d44\u6e90\" href=\"http:\/\/www.haogongju.net\/tag\/%E8%B5%84%E6%BA%90\" target=\"_blank\" rel=\"nofollow\">\u8d44\u6e90<\/a>\u7684<a title=\"\u670d\u52a1\" href=\"http:\/\/www.haogongju.net\/tag\/%E6%9C%8D%E5%8A%A1\" target=\"_blank\" rel=\"nofollow\">\u670d\u52a1<\/a>\u662ftomcat_sc\uff0c\u5360\u7528CPU\u8d44\u6e90\u9ad8\u8fbe\uff1a720%<br \/>\n\u4f7f\u7528jconsole\u53bb<a title=\"\u8ddf\u8e2a\" href=\"http:\/\/www.haogongju.net\/tag\/%E8%B7%9F%E8%B8%AA\" target=\"_blank\" rel=\"nofollow\">\u8ddf\u8e2a<\/a><\/p>\n<p>\u66f4\u6539catal<a title=\"in\" href=\"http:\/\/www.haogongju.net\/tag\/in\" target=\"_blank\" rel=\"nofollow\">in<\/a>a.sh \u542f\u52a8\u8bbe\u7f6e\uff1a<\/p>\n<p>$ CATALINA_OPTS=&#8221;-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8933 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=$server_ip&#8221;;<\/p>\n<pre>imp<wbr \/>ort java.rmi.registry.LocateRegistry; imp<wbr \/>ort javax.management.MBeanServer; imp<wbr \/>ort javax.management.remote.JMXConnectorServer; imp<wbr \/>ort javax.management.remote.JMXConnectorServerFactory; imp<wbr \/>ort javax.management.remote.JMXServiceURL; imp<wbr \/>ort java.io.IOException; imp<wbr \/>ort java.lang.management.ManagementFactory; imp<wbr \/>ort java.net.MalformedURLException;  public class JmxTest { public static void main(String[] args) { MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();  JMXServiceURL url = null; try { url = new JMXServiceURL( \"service:jmx:rmi:\/\/localhost:12199\/jndi\/rmi:\/\/localhost:8933\/jmxrmi\"); } catch (MalformedURLException e) { e.printStackTrace(); }  JMXConnectorServer connectorServer = null; try { connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbeanServer); } catch (IOException e) { e.printStackTrace(); }  try { System.setProperty(\"java.rmi.server.randomIDs\", \"true\"); LocateRegistry.getRegistry(8933); connectorServer.start(); } catch (IOException e) { e.printStackTrace();  }  } }<\/pre>\n<p>hostname -i \u4e3a127.0.0.1<\/p>\n<p>\u6d4b\u8bd5<a title=\"\u670d\u52a1\u5668\u914d\u7f6e\" href=\"http:\/\/www.haogongju.net\/tag\/%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%85%8D%E7%BD%AE\" target=\"_blank\" rel=\"nofollow\">\u670d\u52a1\u5668\u914d\u7f6e<\/a>\u5b8c\u540e\uff0c\u5728\u672c\u673a\u4f7f\u7528jconsole\u8fde\u63a5\uff0c<a title=\"\u8f93\u5165\" href=\"http:\/\/www.haogongju.net\/tag\/%E8%BE%93%E5%85%A5\" target=\"_blank\" rel=\"nofollow\">\u8f93\u5165<\/a>\u6d4b\u8bd5<a title=\"\u670d\u52a1\u5668\" href=\"http:\/\/www.haogongju.net\/tag\/%E6%9C%8D%E5%8A%A1%E5%99%A8\" target=\"_blank\" rel=\"nofollow\">\u670d\u52a1\u5668<\/a>\u5e10\u53f7\u5bc6\u7801\u5373\u53ef\u8fde\u4e0a\u3002\u7f51\u4e0a<a title=\"\u8d44\u6599\" href=\"http:\/\/www.haogongju.net\/tag\/%E8%B5%84%E6%96%99\" target=\"_blank\" rel=\"nofollow\">\u8d44\u6599<\/a>\u8bf4\u8981\u6539hostname\uff0c\u6ca1\u6709\u66f4\u6539hostname\u4e5f\u53ef\u884c<\/p>\n<p>\u7ebf\u4e0a\u5148\u5f00\u4e86\u670d\u52a1\u5668\u7aef\u53e3\uff0c\u53c8\u5f00\u4e86 \u672c\u673a\u7aef\u53e3\uff0ctel<a title=\"net\" href=\"http:\/\/www.haogongju.net\/tag\/net\" target=\"_blank\" rel=\"nofollow\">net<\/a><a title=\"\u53ef\u4ee5\" href=\"http:\/\/www.haogongju.net\/tag\/%E5%8F%AF%E4%BB%A5\" target=\"_blank\" rel=\"nofollow\">\u53ef\u4ee5<\/a>\u8fde\u4e0a\uff0c\u4f46jconsole\u65e0\u6cd5\u8fde\u63a5\uff0c\u67e5google\uff0c\u8bf4\uff1a<\/p>\n<p>the jvm you&#8217;re trying to connect to actually exposes *two* ports, the\u00a0<a title=\"on&lt;wbr&gt;e\" href=\"http:\/\/www.haogongju.net\/tag\/one\" target=\"_blank\" rel=\"nofollow\">on<wbr \/>e<\/a>\u00a0specified via -D<a title=\"com\" href=\"http:\/\/www.haogongju.net\/tag\/com\" target=\"_blank\" rel=\"nofollow\">com<\/a>.sun.management.jmxremote.port, and some other on<wbr \/>e. The 2nd on<wbr \/>e is random, but jconsole wants to connect to it, so if you have a firewall, and you&#8217;ve on<wbr \/>ly opened up the above port, you&#8217;re hosed.<\/p>\n<p>\u53ea\u5f00\u653e\u4e86\u4e00\u4e2a\u7aef\u53e3\u5c31\u4e0d\u53ef\u4ee5\uff1f<a title=\"\u5fc5\u987b\" href=\"http:\/\/www.haogongju.net\/tag\/%E5%BF%85%E9%A1%BB\" target=\"_blank\" rel=\"nofollow\">\u5fc5\u987b<\/a>\u5916\u7f51\u670d\u52a1\u5668\u6240\u6709\u7aef\u53e3\u90fd\u5bf9\u5185\u7f51\u5f00\u653e\uff1f<a title=\"\u7ee7\u7eed\" href=\"http:\/\/www.haogongju.net\/tag\/%E7%BB%A7%E7%BB%AD\" target=\"_blank\" rel=\"nofollow\">\u7ee7\u7eed<\/a>\u8ddf\u8e2a\u3002<\/p>\n<p>jmap jconsole jstack\u90fd\u662fjava\u81ea\u5e26\u7684jmx\u00a0<a title=\"\u95ee\u9898\" href=\"http:\/\/www.haogongju.net\/tag\/%E9%97%AE%E9%A2%98\" target=\"_blank\" rel=\"nofollow\">\u95ee\u9898<\/a>\u8ddf\u8e2a<a title=\"\u5de5\u5177\" href=\"http:\/\/www.haogongju.net\/tag\/%E5%B7%A5%E5%85%B7\" target=\"_blank\" rel=\"nofollow\">\u5de5\u5177<\/a>\uff0c \u53ef\u4ee5<a title=\"\u5b66\u4e60\" href=\"http:\/\/www.haogongju.net\/tag\/%E5%AD%A6%E4%B9%A0\" target=\"_blank\" rel=\"nofollow\">\u5b66\u4e60<\/a>\u4e00\u4e0b\u5e2e\u52a9<a title=\"\u5206\u6790\" href=\"http:\/\/www.haogongju.net\/tag\/%E5%88%86%E6%9E%90\" target=\"_blank\" rel=\"nofollow\">\u5206\u6790<\/a><a title=\"\u5b9a\u4f4d\" href=\"http:\/\/www.haogongju.net\/tag\/%E5%AE%9A%E4%BD%8D\" target=\"_blank\" rel=\"nofollow\">\u5b9a\u4f4d<\/a><a title=\"\u5185\u5b58\" href=\"http:\/\/www.haogongju.net\/tag\/%E5%86%85%E5%AD%98\" target=\"_blank\" rel=\"nofollow\">\u5185\u5b58<\/a>\u6ea2\u51fa \u7a0b\u5e8f\u6b7b\u9501\u4e4b\u7c7b\u7684\u7a0b\u5e8f\u95ee\u9898<\/p>\n<p>\u4f7f\u7528 jmap \u67e5\u770b\u5185\u5b58\u72b6\u51b5<\/p>\n<p>jmap -histo:live pid<\/p>\n<p>\u670d\u52a1\u81ea\u5efa\u7c7b\u7684\u6570\u91cf\u5e76\u4e0d\u591a<\/p>\n<p>jstack \u8ddf\u8e2a\u5806\u6808\u4e5f\u6ca1\u770b\u51fa\u4e2a\u6240\u4ee5\u7136<\/p>\n<p>\u7ee7\u7eedjconsole\u8c03\u67e5 google \u201cjconsole remote set random port to certain\u201d \u627e\u5230\u4e00\u7bc7\u50cf\u6837\u7684<a title=\"\u6587\u7ae0\" href=\"http:\/\/www.haogongju.net\/tag\/%E6%96%87%E7%AB%A0\" target=\"_blank\" rel=\"nofollow\">\u6587\u7ae0<\/a>\uff1a<\/p>\n<p>http:\/\/www.componative.com\/content\/controller\/developer\/insights\/jconsole3\/<\/p>\n<p>\u4e8e\u662f\u5199\u4e86servlet\u53bb<a title=\"\u6ce8\u518c\" href=\"http:\/\/www.haogongju.net\/tag\/%E6%B3%A8%E5%86%8C\" target=\"_blank\" rel=\"nofollow\">\u6ce8\u518c<\/a>\u6307\u5b9a\u7aef\u53e3 \u672a\u679c<\/p>\n<p>\u5728\u6d4b\u8bd5\u673a\u4e0a\u5148\u8bd5\u8bd5 \u5199java<a title=\"\u6587\u4ef6\" href=\"http:\/\/www.haogongju.net\/tag\/%E6%96%87%E4%BB%B6\" target=\"_blank\" rel=\"nofollow\">\u6587\u4ef6<\/a>\uff1a<\/p>\n<p>\u51fa\u73b0 java.rmi.AccessException: Cannot modify this registry \u9519\u8bef<\/p>\n<p>\u6ce8\u91ca\u6389 catalina.sh\u7684\u542f\u52a8\u8bbe\u7f6e -Dcom.sun.management.jmxremote.port=8933 \u4e5f\u4e0d\u884c<\/p>\n<p>\u6700\u7ec8\u653e\u5f03\u4e86jconsole<br \/>\n\u4f7f\u7528 java.lang.management..ThreadMXBean<br \/>\n\u7528\u7131\u54e5<a title=\"\u8f6c\u53d1\" href=\"http:\/\/www.haogongju.net\/tag\/%E8%BD%AC%E5%8F%91\" target=\"_blank\" rel=\"nofollow\">\u8f6c\u53d1<\/a>\u00a0\u65b0\u9633<a title=\"\u63d0\u4f9b\" href=\"http:\/\/www.haogongju.net\/tag\/%E6%8F%90%E4%BE%9B\" target=\"_blank\" rel=\"nofollow\">\u63d0\u4f9b<\/a>\u7684 jsp<a title=\"\u9875\u9762\" href=\"http:\/\/www.haogongju.net\/tag\/%E9%A1%B5%E9%9D%A2\" target=\"_blank\" rel=\"nofollow\">\u9875\u9762<\/a>\u00a0\u5206\u6790<a title=\"\u6027\u80fd\" href=\"http:\/\/www.haogongju.net\/tag\/%E6%80%A7%E8%83%BD\" target=\"_blank\" rel=\"nofollow\">\u6027\u80fd<\/a>\u95ee\u9898\uff0c\u4e3b\u8981\u662f\u770b\u7ebf\u7a0b\u963b\u585e\u60c5\u51b5<br \/>\n\u4e3b\u8981\u4ee3\u7801\uff1a<\/p>\n<div>\n<pre>ThreadMXBean tm = ManagementFactory.getThreadMXBean(); tm.setThreadContentionMonitoringEnabled(true); &lt;% long [] tid = tm.getAllThreadIds(); ThreadInfo [] tia = tm.getThreadInfo(tid, Integer.MAX_VALUE);  long [][] threadArray = new long[tia.length][2];  for (int i = 0; i &lt; tia.length; i++) { long threadId = tia[i].getThreadId();  long cpuTime = tm.getThreadCpuTime(tia[i].getThreadId())\/(1000*1000*1000); threadArray[i][0] = threadId; threadArray[i][1] = cpuTime; }<\/pre>\n<\/div>\n<p><a title=\"\u68c0\u6d4b\" href=\"http:\/\/www.haogongju.net\/tag\/%E6%A3%80%E6%B5%8B\" target=\"_blank\" rel=\"nofollow\">\u68c0\u6d4b<\/a>\u5230\u5982\u4e0b\u7ebf\u7a0b\u95ee\u9898:<br \/>\nThread ID: 89<br \/>\nThread Name: http-6080-Processor73<br \/>\nThread State: RUNNABLE<br \/>\nThread Lock Name: null<br \/>\nThread Lock Owner Name: null<br \/>\nThread CPU Time: 35678 sec<br \/>\nStack Info: (depth:31)<br \/>\n+java.util.HashMap.get(HashMap.java:303)<br \/>\n+com.netqin.baike.server.nqrs.CloudSecurityCommand.writePkgsLog(CloudSecurityCommand.java:466)<br \/>\n+com.netqin.baike.server.nqrs.CloudSecurityCommand.execute(CloudSecurityCommand.java:153)<br \/>\n+com.netqin.baike.server.BaikeServer.service(BaikeServer.java:64)<br \/>\n+sun.reflect.GeneratedMethodAccessor33.invoke(Unknown Source)<br \/>\nCPU\u5360\u7528<a title=\"\u65f6\u95f4\" href=\"http:\/\/www.haogongju.net\/tag\/%E6%97%B6%E9%97%B4\" target=\"_blank\" rel=\"nofollow\">\u65f6\u95f4<\/a>\u8fbe\u5230 35678\u79d2 \uff0c\u5230\u4e0b\u5348\u5230\u4e8650000\u79d2\u5de6\u53f3\uff0ctomcat\u7684CPU\u5360\u7528\u8fbe\u5230\u4e86200%<br \/>\n\u5206\u6790\u4ee3\u7801\uff0c\u53d1\u73b0\u662f\u5355\u4f8bbean\u4e2d\u4f7f\u7528\u4e86 hashmap \u4f5c\u4e3a\u7c7b\u5bf9\u8c61\uff0c<a title=\"\u591a\u7ebf\u7a0b\" href=\"http:\/\/www.haogongju.net\/tag\/%E5%A4%9A%E7%BA%BF%E7%A8%8B\" target=\"_blank\" rel=\"nofollow\">\u591a\u7ebf\u7a0b<\/a><a title=\"\u8bbf\u95ee\" href=\"http:\/\/www.haogongju.net\/tag\/%E8%AE%BF%E9%97%AE\" target=\"_blank\" rel=\"nofollow\">\u8bbf\u95ee<\/a>\u65f6 \u7c7b\u6210\u5458hashmap\u5e76\u4e0d\u662f\u7ebf\u7a0b<a title=\"\u5b89\u5168\" href=\"http:\/\/www.haogongju.net\/tag\/%E5%AE%89%E5%85%A8\" target=\"_blank\" rel=\"nofollow\">\u5b89\u5168<\/a>\u7684 \u975e\u5355\u4f8b\uff0c\u5f15\u8d77\u4e86\u95ee\u9898\u3002\u66f4\u6b63\u4ee3\u7801\u540e\uff0c\u51e0\u4e2a\u6708\u6ca1\u6709\u53d1\u73b0\u95ee\u9898<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>http:\/\/blog.csdn.net\/chen3888015\/article\/details\/743286 <a href='https:\/\/www.icocean.com\/blog\/?p=4008' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"class_list":["post-4008","post","type-post","status-publish","format-standard","hentry","category-lamp","category-24-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4008","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4008"}],"version-history":[{"count":1,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4008\/revisions"}],"predecessor-version":[{"id":4017,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4008\/revisions\/4017"}],"wp:attachment":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4008"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4008"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4008"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}