Last active
November 27, 2024 21:58
-
-
Save samueleresca/2ef2907401b636a2e3cf527bf95a41a8 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
// On-CPU time tracking tracking | |
tracepoint:sched:sched_switch | |
{ | |
$prev_pid = args->prev_pid; | |
$next_pid = args->next_pid; | |
$prev_state = args->prev_state; | |
// Record on-CPU time for previous task | |
if (has_key(@start, $prev_pid)) | |
{ | |
@cpu[comm, $prev_pid] = sum(nsecs - @start[$prev_pid]); | |
} | |
// Start timing for next thread | |
@start[$next_pid] = nsecs; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment