|
Windows环境
使用 Process Explorer
下面是仅使用 pslist 和 Thread Dump 的步骤示例:
|
| java 1720: Tid Pri Cswtch State User Time Kernel Time Elapsed Time 1520 8 9705 Wait:UserReq 0:00:23.734 0:00:01.772 0:04:55.264 1968 9 2233 Wait:UserReq 0:00:04.606 0:00:00.040 0:04:54.874 1748 15 146 Wait:UserReq 0:00:00.010 0:00:00.010 0:04:54.863 1744 11 62 Wait:UserReq 0:00:00.010 0:00:00.000 0:04:54.853 1420 15 3 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:54.563 1856 15 7 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:54.563 1860 9 3157 Wait:UserReq 0:00:03.314 0:00:00.160 0:04:54.563 412 15 5888 Wait:DelayExec 0:00:00.000 0:00:00.000 0:04:54.553 1864 8 3 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:50.567 1660 15 61 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:42.125 2020 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:42.025 1532 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:42.015 1332 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:42.005 1696 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.995 2060 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.995 1552 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.985 2072 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.985 2068 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.975 2044 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.975 2000 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.965 588 9 4744 Wait:UserReq 0:00:02.814 0:00:00.110 0:04:41.965 1784 9 132 Wait:UserReq 0:00:00.080 0:00:00.000 0:04:41.955 1756 9 196 Wait:UserReq 0:00:00.931 0:00:00.000 0:04:41.955 1716 8 6 Wait:Queue 0:00:00.000 0:00:00.000 0:04:41.945 1800 9 1457 Wait:Queue 0:00:00.761 0:00:00.210 0:04:41.945 1996 8 47 Wait:UserReq 0:00:00.170 0:00:00.000 0:04:41.835 1992 11 18 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.434 1988 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.424 1984 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.414 1976 8 231 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.274 1956 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.234 1740 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.224 1944 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.214 1964 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.204 1972 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.204 1280 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.194 1960 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.194 1872 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.184 1884 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.184 1952 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.174 1940 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.174 1936 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:41.164 1932 6 4 Wait:UserReq 0:00:00.010 0:00:00.000 0:04:39.291 1928 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:31.880 1916 8 3 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:31.870 1912 8 4 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:31.860 1908 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:31.860 1904 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:31.850 1900 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:31.840 1896 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:30.889 2064 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:30.879 1828 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:30.869 1892 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:30.859 1888 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:30.859 1852 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:30.849 1848 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:30.849 1844 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:30.839 1412 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:30.839 332 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:30.829 1840 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:30.829 1440 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:30.819 1796 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:30.819 1240 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:30.809 568 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:30.809 1732 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:29.797 2056 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:15.006 1688 8 4 Wait:UserReq 0:00:00.000 0:00:00.010 0:04:14.996 1776 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:14.986 1648 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:14.976 1768 8 3 Wait:UserReq 0:00:00.000 0:00:00.000 0:04:14.976 284 8 188 Wait:UserReq 0:00:00.190 0:00:00.040 0:04:08.887 576 9 123 Wait:UserReq 0:00:00.070 0:00:00.020 0:04:07.515 |
|
| java 1720: Tid Pri Cswtch State User Time Kernel Time Elapsed Time 1520 8 9705 Wait:UserReq 0:00:23.734 0:00:01.772 0:08:14.511 1968 8 6527 Wait:UserReq 0:00:06.309 0:00:00.070 0:08:14.120 1748 15 157 Wait:UserReq 0:00:00.010 0:00:00.010 0:08:14.110 1744 10 68 Wait:UserReq 0:00:00.010 0:00:00.000 0:08:14.100 1420 15 3 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:13.810 1856 15 18 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:13.810 1860 8 3169 Wait:UserReq 0:00:03.314 0:00:00.160 0:08:13.810 412 15 9890 Wait:DelayExec 0:00:00.000 0:00:00.000 0:08:13.800 1864 8 3 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:09.814 1660 15 188 Wait:UserReq 0:00:00.010 0:00:00.010 0:08:01.372 2020 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:01.272 1532 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:01.262 1332 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:01.252 1696 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:01.241 2060 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:01.241 1552 9 40 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:01.231 2072 8 13 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:01.231 2068 8 20 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:01.221 2044 8 15 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:01.221 2000 8 657 Wait:UserReq 0:00:00.090 0:00:00.010 0:08:01.211 588 10 59123 Wait:UserReq 0:00:48.830 0:00:02.633 0:08:01.211 1784 8 150 Wait:UserReq 0:00:00.090 0:00:00.000 0:08:01.201 1756 8 251 Wait:UserReq 0:00:00.941 0:00:00.000 0:08:01.201 1716 8 6 Wait:Queue 0:00:00.000 0:00:00.000 0:08:01.191 1800 8 1457 Wait:Queue 0:00:00.761 0:00:00.210 0:08:01.191 1996 8 47 Wait:UserReq 0:00:00.170 0:00:00.000 0:08:01.081 1992 10 29 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:00.681 1988 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:00.671 1984 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:00.661 1976 9 400 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:00.520 1956 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:00.480 1740 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:00.470 1944 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:00.460 1964 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:00.450 1972 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:00.450 1280 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:00.440 1960 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:00.440 1872 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:00.430 1884 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:00.430 1952 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:00.420 1940 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:00.420 1936 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:08:00.410 1932 6 4 Wait:UserReq 0:00:00.010 0:00:00.000 0:07:58.538 1928 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:51.127 1916 8 3 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:51.117 1912 8 5 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:51.107 1908 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:51.107 1904 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:51.097 1900 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:51.087 1896 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:50.136 2064 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:50.126 1828 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:50.115 1892 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:50.105 1888 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:50.105 1852 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:50.095 1848 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:50.095 1844 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:50.085 1412 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:50.085 332 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:50.075 1840 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:50.075 1440 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:50.065 1796 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:50.065 1240 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:50.055 568 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:50.055 1732 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:49.044 2056 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:34.253 1688 8 4 Wait:UserReq 0:00:00.000 0:00:00.010 0:07:34.243 1776 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:34.233 1648 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:34.223 1768 8 3 Wait:UserReq 0:00:00.000 0:00:00.000 0:07:34.223 284 9 416 Ready 0:00:00.420 0:00:00.100 0:07:28.134 576 8 123 Wait:UserReq 0:00:00.070 0:00:00.020 0:07:26.762 |
|
注意,线程 ID 588 正在使用最多的用户/内核时间,因此占用最多的 CPU 资源。显然,该线程有问题。
|
| "ExecuteThread: '10' for queue: 'default'" daemon prio=5 tid=0x20d75808 nid=0x24c runnable [219ff000..219ffd90] at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) at java.net.SocketOutputStream.write(SocketOutputStream.java:136) at weblogic.servlet.internal.ChunkUtils.writeChunkTransfer(ChunkUtils.java:222) at weblogic.servlet.internal.ChunkUtils.writeChunks(ChunkUtils.java:198) at weblogic.servlet.internal.ChunkOutput.flush(ChunkOutput.java:284) at weblogic.servlet.internal.ChunkOutput.checkForFlush(ChunkOutput.java:344) at weblogic.servlet.internal.ChunkOutput.write(ChunkOutput.java:221) at weblogic.servlet.internal.ChunkOutput.write(ChunkOutput.java:236) at weblogic.servlet.internal.ChunkOutputWrapper.write(ChunkOutputWrapper.java:95) at weblogic.servlet.internal.ChunkWriter.write(ChunkWriter.java:37) at java.io.Writer.write(Writer.java:150) - locked <0x11d0d1c0> (a weblogic.servlet.internal.ChunkWriter) at java.io.PrintWriter.write(PrintWriter.java:230) - locked <0x11d0d1c0> (a weblogic.servlet.internal.ChunkWriter) at java.io.PrintWriter.write(PrintWriter.java:247) at java.io.PrintWriter.print(PrintWriter.java:378) at java.io.PrintWriter.println(PrintWriter.java:515) - locked <0x11d0d1c0> (a weblogic.servlet.internal.ChunkWriter) at examples.servlets.HelloWorld2.service(HelloWorld2.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1058) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:401) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:306) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5412) at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:744) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3086) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2544) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134) |
|
| 89 out.println(ExampleUtils.returnHtmlHeader("Hello World 2")); 90 out.println("<h4>"); 91 for (int i=0;i<100000000;i++) { 92 int j = 0; 93 j = j +i; 94 out.println(defaultGreeting + " " + defaultName + "!"); 95 } 96 97 out.println("</h4>"); 98 out.println(ExampleUtils.returnHtmlFooter()); |
|
| 外部资源 您可以在以下网址中获得帮助检查 CPU 占用率的实用程序/工具: Process Explorer: http://www.sysinternals.com/ntw2k/freeware/procexp.shtml hp_prstat 实用程序:hp_prstat |