|
Server : Apache System : Linux server.mata-lashes.com 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64 User : matalashes ( 1004) PHP Version : 8.1.29 Disable Function : NONE Directory : /proc/17567/root/usr/share/systemtap/examples/process/ |
Upload File : |
#!/usr/bin/stap
# inspired by Tom Zanussi's example from https://lkml.org/lkml/2017/2/8/996
global ts0%, latency%
function now() { return gettimeofday_us() }
probe kernel.trace("sched_wakeup") { ts0[$p->pid] = now() }
probe kernel.trace("sched_switch") {
if (ts0[$next->pid]) latency[$next->pid,$next->prio] <<< now() - ts0[$next->pid];
}
probe timer.s(5) {
foreach ([pid+,x] in latency) {
println("pid:", pid, " prio:", x) print(@hist_log(latency[pid,x]))
}
delete latency
}