Linux view the method of a particular thread or program with a higher CPU consumption of a process

Source: Internet
Author: User


At present our monitoring can find the process that consumes the higher CPU (the threshold is 3 CPU), through monitoring we can find the process number that consumes the higher CPU;

With the process number PID, we can display the CPU resource consumption of each thread in the process via the Top–h–p <pid> command on Linux.

Then, through the Threadump command, you can print out the invocation of a thread at some point in the application JVM, and with the thread number we can find the program called by the threads.

Other:

The Jrcmd command can also be used to view threadump and process execution threads, but the command is a new command for JRockit 5.0, and under WLS81 users we do not have permission to execute, but can contact the middleware to help execute.

1. Go to the Jrockit/bin directory
2. Hit./jrcmd enter to see the PID number of all currently executing Java processes
3./jrcmd [PID] help Enter, you will see the operation supported by the specified Java process
4./jrcmd [PID] print_threads > Xxxfile, can print all thread stack tracks in the current Java process to the specified file

Example:

[email protected] wls]$ Top

PID USER PR NI VIRT RES SHR S%cpu%MEM time+ COMMAND

228961 wls81 0 714m 637m 1804 S 755.7 0.2 383:24.53 java

[[email protected] wls]$ top-h-P 228961

top-13:37:01 up 156 days, 16:11, 8 users, load average:14.24, 13.82, 12.88

tasks:140 Total, running, 117 sleeping, 0 stopped, 0 zombie

Cpu (s): 25.6%us, 1.6%sy, 0.0%ni, 72.6%id, 0.0%wa, 0.0%hi, 0.2%si, 0.0%st

mem:264120292k Total, 217896772k used, 46223520k free, 4547804k buffers

swap:3145720k Total, 464k used, 3145256k free, 153619224k cached

   PID user      pr  ni  virt  res  SHR S%cpu%mem     time+  command                                                                      

229077 wls81 0 714m 637m 1804 R 32.6 0.2 7:11.79 executethread:

229093 wls81 0 714m 637m 1804 R 32.6 0.2 23:41.47 executethread:

229073 wls81     15   0  714m 637m 1804 R 32.2  0.2   2:24.30 Execut ethread:                                                               

229076 wls81     15   0  714m 637m 1804 R 32.2  0.2   2:22.75 Execut ethread:                                                                

229078 wls81 0 714m 637m 1804 R 32.2 0.2 7:21.38 executethread:

229082 wls81 0 714m 637m 1804 R 32.2 0.2 10:14.74 executethread:

229084 wls81 0 714m 637m 1804 R 32.2 0.2 8:43.72 executethread:

229085 wls81 0 714m 637m 1804 R 32.2 0.2 12:45.62 executethread:

229087 wls81 0 714m 637m 1804 R 32.2 0.2 19:11.79 executethread:

229089 wls81 0 714m 637m 1804 R 32.2 0.2 23:22.67 executethread:

229075 wls81 0 714m 637m 1804 R 31.9 0.2 5:06.52 executethread:

229088 wls81 0 714m 637m 1804 R 31.9 0.2 13:19.55 executethread:

229090 wls81 0 714m 637m 1804 R 31.9 0.2 23:53.55 executethread:

229092 wls81 0 714m 637m 1804 R 31.9 0.2 24:20.10 executethread:

229094 wls81 0 714m 637m 1804 R 31.9 0.2 33:25.41 executethread:

229095 wls81 0 714m 637m 1804 R 31.9 0.2 33:41.20 executethread:

229096 wls81 0 714m 637m 1804 R 31.9 0.2 36:22.72 executethread:

229081 wls81 0 714m 637m 1804 R 31.6 0.2 7:28.80 executethread:

229083 wls81 0 714m 637m 1804 R 31.6 0.2 11:05.48 executethread:

229086 wls81 0 714m 637m 1804 R 31.6 0.2 11:40.36 executethread:

229091 wls81 0 714m 637m 1804 R 31.6 0.2 17:53.92 executethread:

229097 wls81 0 714m 637m 1804 R 31.6 0.2 32:41.28 executethread:

229079 wls81     15   0  714m 637m 1804 R 31.2  0.2   7:33.44 Execut ethread:                                                                

229080 wls81     15   0  714m 637m 1804 s  1.3  0.2   0:14.13 E xecutethread:                                                               

228963 wls81     15   0  714m 637m 1804 s  0.7  0.2   0:13.44 ( GC Main thread                                                              

229070 wls81 0 714m 637m 1804 S 0.7 0.2 0:05.97 executethread:

229664 wls81 0 714m 637m 1804 S 0.7 0.2 0:08.69 pool-1-thread-7

Threadump Information Fragment:

229083:

"Executethread: ' for queue: ' Weblogic.kernel.Default '" id=44 idx=0xd4 tid=229083 prio=5 alive, daemon

At Java/util/hashmap.get (hashmap.java:319)

At Com/paic/abbs/biz/service/common/impl/hardcodeserviceimpl.getstring (hardcodeserviceimpl.java:115)

At com/paic/abbs/biz/service/util/impl/utilservicesimpl.isexpected (utilservicesimpl.java:45)

At Com/paic/abbs/biz/service/common/impl/abbsinternetserviceimpl.policyissuing (AbbsInternetServiceImpl.java : 3156)

At Com/paic/abbs/biz/service/common/impl/abbsinternetserviceimpl.procrequest (abbsinternetserviceimpl.java:218)

At Com/paic/abbs/biz/service/common/impl/abbsinternetserviceimpl.handlerequest (AbbsInternetServiceImpl.java:122 )

At Com/paic/abbs/biz/service/common/impl/abbsinternetservice_gwxgqo_eoimpl.handlerequest (AbbsInternetService_ gwxgqo_eoimpl.java:262)

At Sun/reflect/generatedmethodaccessor287.invoke (ljava/lang/object;[ Ljava/lang/object;) ljava/lang/object; (Unknown Source)

At Sun/reflect/delegatingmethodaccessorimpl.invoke (Delegatingmethoda

Linux view the method of a particular thread or program with a higher CPU consumption of a process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.