Tomasz Nurkiewicz wrote a nice blog entry (“Which Java thread consumes my CPU?“) in which he shows a simple method that relies on standard GNU/Linux command-line tools to gather information about the Java threads that keep your CPU very busy.
I wondered whether it would be possible to make it slightly simpler by removing some dependencies and regular expressions and came up with the following Bash shell script:
I think it can be made even simpler and with less dependencies.
Feel free to accept this as a challenge and enlighten me😉
PS: According to Oracle’s jstack web page
This utility is unsupported and may or may not be available in future versions of the J2SE SDK. jstack is not currently available on Windows platforms or on the Linux Itanium platform.
Apparently jstack is still going strong as of 2012, at least on an up-to-date Ubuntu GNU/Linux system, but who knows what awaits us in the future, especially if it is controlled by Oracle😉