Last active
August 27, 2021 15:10
-
-
Save hhue13/d392b6719a11963c23e426da196743c3 to your computer and use it in GitHub Desktop.
Based on a J9 thread dump print out the thread name, Thread-id and used CPU. Invoke it from the command line like: cat javacore.20210827.090629.1350.0004.txt | gawk -f ~/data/projects/pva/getCpuPerThread.awk | sort -n
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN { | |
FS=" " | |
threadName = "" | |
threadId = "" | |
threadNameRegEx = "/^.*\s+(\".*\")\s+.*/" | |
cpuTime = -1 | |
print "cpuTime;threadName;threadId" | |
} | |
/.*3XMTHREADINFO .*/ { handleThreadInfo() } | |
/.*3XMCPUTIME .*/ { handleCpuTime() } | |
################################################################################### | |
## Get the thread info | |
################################################################################### | |
function handleThreadInfo() { | |
row=$0 | |
threadName=gensub(/^.*\s+(\".*\")\s+.*/, "\\1" , "g", row) | |
threadId=gensub(/^.*java\/lang\/Thread\:(.*), state.*/, "\\1" , "g", row) | |
} | |
################################################################################### | |
## Total CPU time in column 5 | |
################################################################################### | |
function handleCpuTime() { | |
cpuTime=$5 | |
print cpuTime ";" threadName ";" threadId | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment