Skip to content

Instantly share code, notes, and snippets.

@rsevilla87
Created October 27, 2020 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsevilla87/4d17b63929bc34979201a7ae0c5391f4 to your computer and use it in GitHub Desktop.
Save rsevilla87/4d17b63929bc34979201a7ae0c5391f4 to your computer and use it in GitHub Desktop.
PID fsync histogram
#!/usr/bin/bpftrace
BEGIN
{
printf("Tracing fsync and fdatasync syscalls... Hit Ctrl-C to end.\n");
}
tracepoint:syscalls:sys_enter_fsync,
tracepoint:syscalls:sys_enter_fdatasync /pid==4320/ {
@start[tid] = nsecs;
}
tracepoint:syscalls:sys_exit_fsync,
tracepoint:syscalls:sys_exit_fdatasync /@start[tid]/ {
$ns=@start[tid];
$ms=((nsecs - $ns) / 1000000);
@lat = lhist($ms, 10, 1000, 100)
}
interval:s:10 {
print(@lat);
}
END
{
clear(@lat);
clear(@start);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment