Created
December 7, 2024 21:56
-
-
Save samueleresca/9c65ec73ffd67d4250a1e371557a451d to your computer and use it in GitHub Desktop.
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
END | |
{ | |
printf("\nThread state analysis:\n"); | |
printf("%-16s %-6s %6s %6s %6s %6s %6s %6s %6s \n", "COMM", "PID", "CPU", "RUNQ", "SLP", "USL", "SUS", "LCK", "DEA"); | |
// Convert nanoseconds to milliseconds | |
$ms = (uint64) 1000000; | |
for ($kv : @cpu) | |
{ | |
$comm = $kv.0.0; | |
$pid = $kv.0.1; | |
$cpu_ms = @cpu[$comm, $pid] / $ms; | |
$runq_ms = @runq[$comm, $pid] / $ms; | |
$slp_ms = @slp[$comm, $pid] / $ms; | |
$usl_ms = @usl[$comm, $pid] / $ms; | |
$sus_ms = @sus[$comm, $pid] / $ms; | |
$lck_ms = @lck[$comm, $pid] / $ms; | |
$dea_ms = @dea[$comm, $pid] / $ms; | |
printf("%-16s %-6d %6d %6d %6d %6d %6d %6d %6d\n", $comm, $pid, $cpu_ms, $runq_ms, $slp_ms, $usl_ms, $sus_ms, $lck_ms, $dea_ms); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment