{"id":4416,"date":"2015-06-15T17:34:43","date_gmt":"2015-06-15T09:34:43","guid":{"rendered":"https:\/\/www.hmouse.tk\/?p=4416"},"modified":"2015-06-16T10:12:05","modified_gmt":"2015-06-16T02:12:05","slug":"java%e7%9a%84%e9%97%ae%e9%a2%98%e6%8e%92%e6%9f%a5","status":"publish","type":"post","link":"https:\/\/www.hmouse.cn\/?p=4416","title":{"rendered":"java\u7684\u95ee\u9898\u6392\u67e5"},"content":{"rendered":"<p>\u6700\u8fd1 \u516c\u53f8\u4f7f\u7528\u7684jboss \u8001\u662f\u51fa\u73b0cpu\u5f88\u641e\u5f97\u95ee\u9898\uff0c\u67e5\u7684\u6211\u5934\u90fd\u5927\u4e86\uff0c\u540e\u6765\u67e5\u770b\u5f88\u591a\u6587\u7ae0\uff0c\u53d1\u73b0\u5f00\u653ejmx\u5bf9\u95ee\u9898\u7684\u6392\u67e5\u5f88\u662f\u6709\u5e2e\u52a9\u3002<\/p>\n<p>\u4e0b\u9762\u7684\u5927\u4f53\u4e0a\u6709\u6240\u6709\u7684\u89e3\u51b3\u65b9\u6848\u4e86\uff0c\u5f53\u65f6\u6211\u5904\u7406\u7684\u65f6\u5019\u7528\u7684\u662f\u53e6\u4e00\u4e2a\u63d2\u4ef6\uff1a<\/p>\n<p>jconsole.exe -pluginpath ..\\demo\\management\\JTop\\JTop.jar&nbsp;&nbsp;&nbsp; <\/p>\n<p>\u5f53\u7136\u4e5f\u53ef\u4ee5\u4f7f\u7528  <\/p>\n<p>jconsole.exe -pluginpath ..\\demo\\management\\JTop\\JTop.jar&nbsp;&nbsp;&nbsp; <\/p>\n<p>\u540e\u6765\u53d1\u73b0\u8fd8\u662fjvisualvm.exe \u597d\u7528\uff0c\u7c7b\u4f3c\u4e8e\u96c6\u6210\u5de5\u5177\uff01 <\/p>\n<p>\u53c2\u8003url\uff1a<a title=\"http:\/\/blog.csdn.net\/xeseo\/article\/details\/11889761\" href=\"http:\/\/blog.csdn.net\/xeseo\/article\/details\/11889761\">http:\/\/blog.csdn.net\/xeseo\/article\/details\/11889761<\/a><\/p>\n<p>&nbsp;<\/p>\n<h3>1. \u5148\u627e\u5230Java\u7684\u8fdb\u7a0b\u53f7<\/h3>\n<p>Linux\u4e0b\uff1a  <\/p>\n<p>\u7528top\u547d\u4ee4\u67e5\u770b\u6240\u6709\u8fdb\u7a0b\uff0c\u53ef\u4ee5\u660e\u663e\u770b\u5230Java\u7684\uff0c\u56e0\u4e3aCPU\u5360\u7528\u7387\u5f88\u9ad8\u88ab\u6392\u5728\u524d\u9762\u3002\u6bd4\u5982,  <\/p>\n<p><a href=\"http:\/\/www.blogjava.net\/images\/blogjava_net\/hankchen\/WindowsLiveWriter\/CPU_121DA\/clip_image002_2.jpg\"><img loading=\"lazy\" decoding=\"async\" title=\"clip_image002\" border=\"0\" alt=\"clip_image002\" src=\"http:\/\/www.blogjava.net\/images\/blogjava_net\/hankchen\/WindowsLiveWriter\/CPU_121DA\/clip_image002_thumb.jpg\" width=\"600\" height=\"216\"><\/a>  <\/p>\n<p>Windows\u4e0b\uff1a  <\/p>\n<p>\u6253\u5f00\u4efb\u52a1\u7ba1\u7406\u5668\uff0c\u7136\u540e\u70b9\u51fb &#8220;\u67e5\u770b&#8221; \u83dc\u5355\uff0c\u7136\u540e\u70b9\u51fb &#8220;\u9009\u62e9\u5217&#8221;\uff0c\u628apid\u52fe\u4e0a\uff0c\u7136\u540e\u5c31\u53ef\u4ee5\u5728\u4efb\u52a1\u7ba1\u7406\u5668\u91cc\u9762\u770b\u5230\u6240\u6709\u8fdb\u7a0b\u7684pid\u503c\u4e86\u3002(\u4e5f\u53ef\u4ee5\u7528\u7b2c\u4e09\u6b65\u4e2d\u63d0\u5230\u7684\u5de5\u5177\u76f4\u63a5\u67e5\u770b)  <\/p>\n<p><a href=\"http:\/\/static.oschina.net\/uploads\/img\/201304\/24223119_tlRi.jpg\"><img decoding=\"async\" alt=\"\" src=\"http:\/\/static.oschina.net\/uploads\/img\/201304\/24223119_tlRi.jpg\"><\/a>  <\/p>\n<h3><a name=\"t1\"><\/a>2. \u505adump (\u53ef\u9009)<\/h3>\n<p>jdk\u81ea\u5e26\u7684jstack\u5de5\u5177\u53ef\u4ee5\u67e5\u770bJava\u7ebf\u7a0b\u4fe1\u606f\uff0c\u53ef\u4ee5\u5b9e\u65f6\u67e5\u770b\uff0c\u4e5f\u53ef\u4ee5\u5bfc\u51fa\u6765\u3002\u5982\u679c\u53d1\u73b0\u5b9e\u65f6\u67e5\u770b\u4e0d\u662f\u5f88\u65b9\u4fbf\u6216\u8005\u65e0\u6cd5\u5b9e\u65f6\u67e5\u770b\uff0c\u5728\u505a\u4e0b\u5217\u6b65\u9aa4\u524d\u53ef\u4ee5\u5148dump\u3002  <\/p>\n<p>jstack -l &lt;pid&gt; &gt; dump.stack  <\/p>\n<p>\u5982\u679c\u8fdb\u7a0b\u5df2\u7ecfhang\u4f4f\u4e86\uff0c\u52a0-F\u53c2\u6570  <\/p>\n<p>jstack -l -F &lt;pid&gt; &gt; dump.stack  <\/p>\n<p>\u5f53\u7136\uff0c\u5982\u679c\u662fUnix\u4e0b\uff0c\u8fd8\u6709\u79cd\u65b9\u6cd5\uff1a  <\/p>\n<p>kill -3 &lt;pid&gt;  <\/p>\n<h3><a name=\"t2\"><\/a>3. \u627e\u5230\u91cc\u9762\u662f\u54ea\u4e2a\u7ebf\u7a0b\u5360\u7528\u7387\u6700\u9ad8<\/h3>\n<p>Linux\u4e0b\uff1a  <\/p>\n<p>\u7528 top -H -p &lt;pid&gt; \u67e5\u770b\u8be5\u8fdb\u7a0b\u6240\u6709\u7ebf\u7a0b\u4fe1\u606f\uff0c\u627e\u5230\u5360\u7528\u7387\u6700\u9ad8\u7684\u90a3\u4e2a  <\/p>\n<p>Windows\u4e0b\uff1a  <\/p>\n<p>\u9664\u4e86\u4f7f\u7528jvisualvm\u6216\u8005\u5e26\u4e0atop-thread\u63d2\u4ef6\u7684jconsole\u4e4b\u5916\uff0c\u53ef\u4ee5\u7528Windows\u81ea\u5df1\u63d0\u4f9b\u7684\u4e09\u65b9\u5de5\u5177\u2014\u2014 Process Explorer v15.3  <\/p>\n<p>\u4e0b\u8f7d\u5730\u5740http:\/\/technet.microsoft.com\/en-us\/sysinternals\/bb896653.aspx  <\/p>\n<p><a href=\"http:\/\/static.oschina.net\/uploads\/img\/201304\/24223120_0cy2.jpg\"><img decoding=\"async\" alt=\"\" src=\"http:\/\/static.oschina.net\/uploads\/img\/201304\/24223120_0cy2.jpg\"><\/a>  <\/p>\n<p><a href=\"http:\/\/static.oschina.net\/uploads\/img\/201304\/24223121_25Xn.jpg\"><img decoding=\"async\" alt=\"\" src=\"http:\/\/static.oschina.net\/uploads\/img\/201304\/24223121_25Xn.jpg\"><\/a>  <\/p>\n<h3><a name=\"t3\"><\/a>3. \u5f97\u5230\u7ebf\u7a0b\u53f7\u768416\u8fdb\u5236<\/h3>\n<p>\u5f97\u5230\u5360\u7528\u7387\u6700\u9ad8\u7684\u7ebf\u7a0bID\u540e\uff0c\u8981\u628a\u5b83\u8f6c\u621016\u8fdb\u5236  <\/p>\n<p>Linux\u4e0b\uff1a  <\/p>\n<p>printf &#8220;%x\\n&#8221; &lt;pid&gt;  <\/p>\n<p>Windows\u4e0b\uff1a  <\/p>\n<p>\u81ea\u5e26\u7684\u8ba1\u7b97\u5668\u53ef\u4ee5\u63d0\u4f9b\u8be5\u529f\u80fd  <\/p>\n<p><a href=\"http:\/\/static.oschina.net\/uploads\/img\/201304\/24223121_WZ5M.jpg\"><img decoding=\"async\" alt=\"\" src=\"http:\/\/static.oschina.net\/uploads\/img\/201304\/24223121_WZ5M.jpg\"><\/a>  <\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"http:\/\/static.oschina.net\/uploads\/img\/201304\/24223122_6aph.jpg\">  <\/p>\n<p><a href=\"http:\/\/static.oschina.net\/uploads\/img\/201304\/24223122_JhbZ.jpg\"><img decoding=\"async\" alt=\"\" src=\"http:\/\/static.oschina.net\/uploads\/img\/201304\/24223122_JhbZ.jpg\"><\/a>  <\/p>\n<h3><a name=\"t4\"><\/a>4. \u5206\u6790dump\u67e5\u627e\u95ee\u9898\u4ee3\u7801\u7247<\/h3>\n<p>\u53ef\u4ee5\u7528 jstack &lt;pid&gt; | grep &lt;tid&gt;&nbsp; -A&nbsp; 30 \u6765\u5b9e\u65f6\u83b7\u53d6\u5185\u5b58\u4e2d\u8be5\u7ebf\u7a0b\u4ee3\u7801\u7247\uff0c\u8fd9\u91cc&lt;tid&gt;\u662f\u7b2c3\u6b65\u4e2d\u5f97\u5230\u768416\u8fdb\u5236\u7684id  <\/p>\n<p>\u4e5f\u53ef\u4ee5\u5728\u7b2c2\u6b65\u4e2d\u5bfc\u51fa\u7684dump\u91cc\u9762\u67e5\u627e\u7b2c3\u6b65\u4e2d\u5f97\u5230\u7684\u7ebf\u7a0bid\u7684\u5341\u516d\u8fdb\u5236\u800c\u627e\u5230\u4ee3\u7801\u7247\u3002  <\/p>\n<h3><a name=\"t5\"><\/a>5. \u5982\u679c\u6709UI\uff0c\u53ef\u4ee5\u6709\u66f4\u7b80\u5355\u7684\u529e\u6cd5<\/h3>\n<p>JDK\u81ea\u5e26\u5de5\u5177jvisualvm\u548cjconsole\u662f\u975e\u5e38\u5f3a\u5927\u7684\u3002\u5176\u4e2djvisualvm\u539f\u58f0\u652f\u6301\u5b9e\u65f6\u67e5\u770b\u7ebf\u7a0bCPU\u4f7f\u7528\u60c5\u51b5\u3002  <\/p>\n<p>\u542f\u52a8jvisualvm\uff0c\u5e76\u67e5\u770b\u76ee\u6807java\u8fdb\u7a0b\u4fe1\u606f\uff0c\u7136\u540e\u9009\u62e9Sampler -&gt; CPU -&gt; Thread CPU Time  <\/p>\n<p>\u4f46\u662f\uff0c\u8fd9\u4e2asampler\u9700\u8981JMX\u652f\u6301\uff0c\u6240\u4ee5\u5982\u679c\u65e0\u6cd5\u8fde\u63a5\u76ee\u6807\u7a0b\u5e8f\u7684JMX\uff0c\u5c31\u65e0\u6cd5\u4f7f\u7528\u4e86\u3002  <\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"http:\/\/img.blog.csdn.net\/20130922105232078?watermark\/2\/text\/aHR0cDovL2Jsb2cuY3Nkbi5uZXQveGVzZW8=\/font\/5a6L5L2T\/fontsize\/400\/fill\/I0JBQkFCMA==\/dissolve\/70\/gravity\/SouthEast\">  <\/p>\n<p>jconsole\u5e76\u4e0d\u80fd\u76f4\u63a5\u67e5\u770b\uff0c\u4f46\u662f\u5728jdk1.6 \u4e2d\uff0cdemo\u76ee\u5f55\u4e0b\u63d0\u4f9b\u4e86\u4e00\u4e2atop-thread\u7684\u63d2\u4ef6\u53ef\u4ee5\u67e5\u770b\u30021.7\u4e0d\u77e5\u9053\u4e3a\u4ec0\u4e48\u6ca1\u4e86\uff0c\u53ef\u4ee5\u731b\u51fb<a href=\"http:\/\/lsd.luminis.eu\/wp-content\/uploads\/2011\/01\/topthreads-1.1.jar\">\u8fd9\u91cc<\/a>\u4e0b\u8f7d\u3002  <\/p>\n<p>\u542f\u52a8jconsole\u65f6\uff0c\u5e26\u4e0a\u63d2\u4ef6\u53c2\u6570\uff1a  <\/p>\n<p>jconsole -pluginpath topthreads-1.1.jar  <\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"http:\/\/img.blog.csdn.net\/20130922105155250?watermark\/2\/text\/aHR0cDovL2Jsb2cuY3Nkbi5uZXQveGVzZW8=\/font\/5a6L5L2T\/fontsize\/400\/fill\/I0JBQkFCMA==\/dissolve\/70\/gravity\/SouthEast\">  <\/p>\n<p>\u5982\u679c\u662f\u811a\u672c\u542f\u52a8jconsole,\u6bd4\u5982JBOSS7\u81ea\u5e26\u7684jconsole.sh\u7684\u8bdd\uff0c\u628a\u8be5jar\u5305\u52a0\u5165\u5176classpath\u53ef\u4ee5OK\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1 \u516c\u53f8\u4f7f\u7528\u7684jboss \u8001\u662f\u51fa\u73b0cpu\u5f88\u641e\u5f97\u95ee\u9898\uff0c\u67e5\u7684\u6211\u5934\u90fd\u5927\u4e86\uff0c\u540e\u6765\u67e5\u770b\u5f88\u591a\u6587\u7ae0\uff0c\u53d1\u73b0\u5f00\u653ejmx\u5bf9\u95ee\u9898\u7684\u6392\u67e5\u5f88\u662f\u6709\u5e2e\u52a9\u3002<\/p>\n<p>\u4e0b\u9762\u7684\u5927\u4f53\u4e0a\u6709\u6240\u6709\u7684\u89e3\u51b3\u65b9\u6848\u4e86\uff0c\u5f53\u65f6\u6211\u5904\u7406\u7684\u65f6\u5019\u7528\u7684\u662f\u53e6\u4e00\u4e2a\u63d2\u4ef6\uff1a<\/p>\n<p>jconsole.exe -pluginpath ..\\demo\\management\\JTop\\JTop.jar&nbsp;&nbsp;&nbsp; <\/p>\n<p>\u5f53\u7136\u4e5f\u53ef\u4ee5\u4f7f\u7528  <\/p>\n<p>jconsole.exe -pluginpath ..\\demo\\management\\JTop\\JTop.jar&nbsp;&nbsp;&nbsp; <\/p>\n<p>\u540e\u6765\u53d1\u73b0\u8fd8\u662fjvisualvm.exe \u597d\u7528\uff0c\u7c7b\u4f3c\u4e8e\u96c6\u6210\u5de5\u5177\uff01 <\/p>\n<p>\u53c2\u8003url\uff1a<a title=\"http:\/\/blog.csdn.net\/xeseo\/article\/details\/11889761\" href=\"http:\/\/blog.csdn.net\/xeseo\/article\/details\/11889761\">http:\/\/blog.csdn.net\/xeseo\/article\/details\/11889761<\/a><\/p>\n<p>&nbsp;<\/p>\n<h3>1. \u5148\u627e\u5230Java\u7684\u8fdb\u7a0b\u53f7<\/h3>\n<p>Linux\u4e0b\uff1a  <\/p>\n<p>\u7528top\u547d\u4ee4\u67e5\u770b\u6240\u6709\u8fdb\u7a0b\uff0c\u53ef\u4ee5\u660e\u663e\u770b\u5230Java\u7684\uff0c\u56e0\u4e3aCPU\u5360\u7528\u7387\u5f88\u9ad8\u88ab\u6392\u5728\u524d\u9762\u3002\u6bd4\u5982,  <\/p>\n<p><a href=\"http:\/\/www.blogjava.net\/images\/blogjava_net\/hankchen\/WindowsLiveWriter\/CPU_121DA\/clip_image002_2.jpg\"><img loading=\"lazy\" decoding=\"async\" title=\"clip_image002\" border=\"0\" alt=\"clip_image002\" src=\"http:\/\/www.blogjava.net\/images\/blogjava_net\/hankchen\/WindowsLiveWriter\/CPU_121DA\/clip_image002_thumb.jpg\" width=\"600\" height=\"216\"><\/a>  <\/p>\n<p>Windows\u4e0b\uff1a  <\/p>\n<p>\u6253\u5f00\u4efb\u52a1\u7ba1\u7406\u5668\uff0c\u7136\u540e\u70b9\u51fb &#8220;\u67e5\u770b&#8221; \u83dc\u5355\uff0c\u7136\u540e\u70b9\u51fb &#8220;\u9009\u62e9\u5217&#8221;\uff0c\u628apid\u52fe\u4e0a\uff0c\u7136\u540e\u5c31\u53ef\u4ee5\u5728\u4efb\u52a1\u7ba1\u7406\u5668\u91cc\u9762\u770b\u5230\u6240\u6709\u8fdb\u7a0b\u7684pid\u503c\u4e86\u3002(\u4e5f\u53ef\u4ee5\u7528\u7b2c\u4e09\u6b65\u4e2d\u63d0\u5230\u7684\u5de5\u5177\u76f4\u63a5\u67e5\u770b)  <\/p>\n<p><a href=\"http:\/\/static.oschina.net\/uploads\/img\/201304\/24223119_tlRi.jpg\"><img decoding=\"async\" alt=\"\" src=\"http:\/\/static.oschina.net\/uploads\/img\/201304\/24223119_tlRi.jpg\"><\/a>  <\/p>\n<h3><a name=\"t1\"><\/a>2. \u505adump (\u53ef\u9009)<\/h3>\n<p>jdk\u81ea\u5e26\u7684jstack\u5de5\u5177\u53ef\u4ee5\u67e5\u770bJava\u7ebf\u7a0b\u4fe1\u606f\uff0c\u53ef\u4ee5\u5b9e\u65f6\u67e5\u770b\uff0c\u4e5f\u53ef\u4ee5\u5bfc\u51fa\u6765\u3002\u5982\u679c\u53d1\u73b0\u5b9e\u65f6\u67e5\u770b\u4e0d\u662f\u5f88\u65b9\u4fbf\u6216\u8005\u65e0\u6cd5\u5b9e\u65f6\u67e5\u770b\uff0c\u5728\u505a\u4e0b\u5217\u6b65\u9aa4\u524d\u53ef\u4ee5\u5148dump\u3002  <\/p>\n<p>jstack -l &lt;pid&gt; &gt; dump.stack  <\/p>\n<p>\u5982\u679c\u8fdb\u7a0b\u5df2\u7ecfhang\u4f4f\u4e86\uff0c\u52a0-F\u53c2\u6570  <\/p>\n<p>jstack -l -F &lt;pid&gt; &gt; dump.stack  <\/p>\n<p>\u5f53\u7136\uff0c\u5982\u679c\u662fUnix\u4e0b\uff0c\u8fd8\u6709\u79cd\u65b9\u6cd5\uff1a  <\/p>\n<p>kill -3 &lt;pid&gt;  <\/p>\n<h3><a name=\"t2\"><\/a>3. \u627e\u5230\u91cc\u9762\u662f\u54ea\u4e2a\u7ebf\u7a0b\u5360\u7528\u7387\u6700\u9ad8<\/h3>\n<p>Linux\u4e0b\uff1a  <\/p>\n<p>\u7528 top -H -p &lt;pid&gt; \u67e5\u770b\u8be5\u8fdb\u7a0b\u6240\u6709\u7ebf\u7a0b\u4fe1\u606f\uff0c\u627e\u5230\u5360\u7528\u7387\u6700\u9ad8\u7684\u90a3\u4e2a  <\/p>\n<p>Windows\u4e0b\uff1a  <\/p>\n<p>\u9664\u4e86\u4f7f\u7528jvisualvm\u6216\u8005\u5e26\u4e0atop-thread\u63d2\u4ef6\u7684jconsole\u4e4b\u5916\uff0c\u53ef\u4ee5\u7528Windows\u81ea\u5df1\u63d0\u4f9b\u7684\u4e09\u65b9\u5de5\u5177\u2014\u2014 Process Explorer v15.3  <\/p>\n<p>\u4e0b\u8f7d\u5730\u5740http:\/\/technet.microsoft.com\/en-us\/sysinternals\/bb896653.aspx  <\/p>\n<p><a href=\"http:\/\/static.oschina.net\/uploads\/img\/201304\/24223120_0cy2.jpg\"><img decoding=\"async\" alt=\"\" src=\"http:\/\/static.oschina.net\/uploads\/img\/201304\/24223120_0cy2.jpg\"><\/a>  <\/p>\n<p><a href=\"http:\/\/static.oschina.net\/uploads\/img\/201304\/24223121_25Xn.jpg\"><img decoding=\"async\" alt=\"\" src=\"http:\/\/static.oschina.net\/uploads\/img\/201304\/24223121_25Xn.jpg\"><\/a>  <\/p>\n<h3><a name=\"t3\"><\/a>3. \u5f97\u5230\u7ebf\u7a0b\u53f7\u768416\u8fdb\u5236<\/h3>\n<p>\u5f97\u5230\u5360\u7528\u7387\u6700\u9ad8\u7684\u7ebf\u7a0bID\u540e\uff0c\u8981\u628a\u5b83\u8f6c\u621016\u8fdb\u5236  <\/p>\n<p>Linux\u4e0b\uff1a  <\/p>\n<p>printf &#8220;%x\\n&#8221; &lt;pid&gt;  <\/p>\n<p>Windows\u4e0b\uff1a  <\/p>\n<p>\u81ea\u5e26\u7684\u8ba1\u7b97\u5668\u53ef\u4ee5\u63d0\u4f9b\u8be5\u529f\u80fd  <\/p>\n<p><a href=\"http:\/\/static.oschina.net\/uploads\/img\/201304\/24223121_WZ5M.jpg\"><img decoding=\"async\" alt=\"\" src=\"http:\/\/static.oschina.net\/uploads\/img\/201304\/24223121_WZ5M.jpg\"><\/a>  <\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"http:\/\/static.oschina.net\/uploads\/img\/201304\/24223122_6aph.jpg\">  <\/p>\n<p><a href=\"http:\/\/static.oschina.net\/uploads\/img\/201304\/24223122_JhbZ.jpg\"><img decoding=\"async\" alt=\"\" src=\"http:\/\/static.oschina.net\/uploads\/img\/201304\/24223122_JhbZ.jpg\"><\/a>  <\/p>\n<h3><a name=\"t4\"><\/a>4. \u5206\u6790dump\u67e5\u627e\u95ee\u9898\u4ee3\u7801\u7247<\/h3>\n<p>\u53ef\u4ee5\u7528 jstack &lt;pid&gt; | grep &lt;tid&gt;&nbsp; -A&nbsp; 30 \u6765\u5b9e\u65f6\u83b7\u53d6\u5185\u5b58\u4e2d\u8be5\u7ebf\u7a0b\u4ee3\u7801\u7247\uff0c\u8fd9\u91cc&lt;tid&gt;\u662f\u7b2c3\u6b65\u4e2d\u5f97\u5230\u768416\u8fdb\u5236\u7684id  <\/p>\n<p>\u4e5f\u53ef\u4ee5\u5728\u7b2c2\u6b65\u4e2d\u5bfc\u51fa\u7684dump\u91cc\u9762\u67e5\u627e\u7b2c3\u6b65\u4e2d\u5f97\u5230\u7684\u7ebf\u7a0bid\u7684\u5341\u516d\u8fdb\u5236\u800c\u627e\u5230\u4ee3\u7801\u7247\u3002  <\/p>\n<h3><a name=\"t5\"><\/a>5. \u5982\u679c\u6709UI\uff0c\u53ef\u4ee5\u6709\u66f4\u7b80\u5355\u7684\u529e\u6cd5<\/h3>\n<p>JDK\u81ea\u5e26\u5de5\u5177jvisualvm\u548cjconsole\u662f\u975e\u5e38\u5f3a\u5927\u7684\u3002\u5176\u4e2djvisualvm\u539f\u58f0\u652f\u6301\u5b9e\u65f6\u67e5\u770b\u7ebf\u7a0bCPU\u4f7f\u7528\u60c5\u51b5\u3002  <\/p>\n<p>\u542f\u52a8jvisualvm\uff0c\u5e76\u67e5\u770b\u76ee\u6807java\u8fdb\u7a0b\u4fe1\u606f\uff0c\u7136\u540e\u9009\u62e9Sampler -&gt; CPU -&gt; Thread CPU Time  <\/p>\n<p>\u4f46\u662f\uff0c\u8fd9\u4e2asampler\u9700\u8981JMX\u652f\u6301\uff0c\u6240\u4ee5\u5982\u679c\u65e0\u6cd5\u8fde\u63a5\u76ee\u6807\u7a0b\u5e8f\u7684JMX\uff0c\u5c31\u65e0\u6cd5\u4f7f\u7528\u4e86\u3002  <\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"http:\/\/img.blog.csdn.net\/20130922105232078?watermark\/2\/text\/aHR0cDovL2Jsb2cuY3Nkbi5uZXQveGVzZW8=\/font\/5a6L5L2T\/fontsize\/400\/fill\/I0JBQkFCMA==\/dissolve\/70\/gravity\/SouthEast\">  <\/p>\n<p>jconsole\u5e76\u4e0d\u80fd\u76f4\u63a5\u67e5\u770b\uff0c\u4f46\u662f\u5728jdk1.6 \u4e2d\uff0cdemo\u76ee\u5f55\u4e0b\u63d0\u4f9b\u4e86\u4e00\u4e2atop-thread\u7684\u63d2\u4ef6\u53ef\u4ee5\u67e5\u770b\u30021.7\u4e0d\u77e5\u9053\u4e3a\u4ec0\u4e48\u6ca1\u4e86\uff0c\u53ef\u4ee5\u731b\u51fb<a href=\"http:\/\/lsd.luminis.eu\/wp-content\/uploads\/2011\/01\/topthreads-1.1.jar\">\u8fd9\u91cc<\/a>\u4e0b\u8f7d\u3002  <\/p>\n<p>\u542f\u52a8jconsole\u65f6\uff0c\u5e26\u4e0a\u63d2\u4ef6\u53c2\u6570\uff1a  <\/p>\n<p>jconsole -pluginpath topthreads-1.1.jar  <\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"http:\/\/img.blog.csdn.net\/20130922105155250?watermark\/2\/text\/aHR0cDovL2Jsb2cuY3Nkbi5uZXQveGVzZW8=\/font\/5a6L5L2T\/fontsize\/400\/fill\/I0JBQkFCMA==\/dissolve\/70\/gravity\/SouthEast\">  <\/p>\n<p>\u5982\u679c\u662f\u811a\u672c\u542f\u52a8jconsole,\u6bd4\u5982JBOSS7\u81ea\u5e26\u7684jconsole.sh\u7684\u8bdd\uff0c\u628a\u8be5jar\u5305\u52a0\u5165\u5176classpath\u53ef\u4ee5OK\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[156,155],"class_list":["post-4416","post","type-post","status-publish","format-standard","hentry","category-5","tag-cpu","tag-java","category-5-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hmouse.cn\/index.php?rest_route=\/wp\/v2\/posts\/4416","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hmouse.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hmouse.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hmouse.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hmouse.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4416"}],"version-history":[{"count":3,"href":"https:\/\/www.hmouse.cn\/index.php?rest_route=\/wp\/v2\/posts\/4416\/revisions"}],"predecessor-version":[{"id":4421,"href":"https:\/\/www.hmouse.cn\/index.php?rest_route=\/wp\/v2\/posts\/4416\/revisions\/4421"}],"wp:attachment":[{"href":"https:\/\/www.hmouse.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hmouse.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hmouse.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}