Created
February 15, 2019 11:12
-
-
Save oraoto/bcf51158d2923de5a76976f50584b26e to your computer and use it in GitHub Desktop.
Block IO size and latency tracing
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
#!/usr/bin/env bpftrace | |
BEGIN { | |
printf("Tracing block io, Ctrl-C to get result\n"); | |
} | |
tracepoint:block:block_rq_issue / args->sector > 0 / | |
{ | |
@start[args->sector] = nsecs; | |
@kbs[args->sector] = args->bytes / 1024; | |
} | |
tracepoint:block:block_rq_complete /args->sector > 0 && @start[args->sector] / | |
{ | |
$now = nsecs; | |
$sector = args->sector; | |
$s = @start[$sector]; | |
$lat = ($now - $s) / 1000000; | |
delete(@start[$sector]); | |
$k = @kbs[$sector]; | |
delete(@kbs[$sector]); | |
@kbytes = hist($k); | |
@latency_ms = hist($lat); | |
} | |
END { | |
delete(@start); | |
delete(@kbs); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment