| Server IP : 104.21.25.180 / Your IP : 104.23.197.122 Web Server : Apache/2.4.37 System : Linux almalinux.duckdns.org 4.18.0-553.111.1.el8_10.x86_64 #1 SMP Sun Mar 8 20:06:07 EDT 2026 x86_64 User : ricodeal ( 1046) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/systemtap/examples/profiling/ |
Upload File : |
#!/usr/bin/stap
#
# Copyright (C) 2018 Red Hat, Inc.
# By William Cohen, Red Hat Inc.
# [email protected]
#
# USAGE: stap syscalllatencybypid.stp --suppress-handler-errors
#
# The "--suppress-handler-errors" option allows the script to continue
# run when probes are skipped. The probe skips make the data less accurate,
# but are otherwise harmless.
global arr%[20000], sys%[20000], entry_time%[20000]
probe syscall_any {
entry_time[tid()] = gettimeofday_ns();
sys[tid()] = syscall_nr
}
probe syscall_any.return {
et = entry_time[tid()]
id = sys[tid()]
delete entry_time[tid()]
delete sys[tid()]
if (et)
arr[pid(), id] += (gettimeofday_ns() - et)
}
probe scheduler.process_exit { delete arr[pid(),*] }
function ns2sec:string(v:long) {
return sprintf("%d.%d", v/1000000000, v%1000000000)
}
probe prometheus {
@prometheus_dump_array2_map(arr, "syscall_time", "pid", "syscall",
ns2sec, sprint, syscall_name)
}