Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bpftrace
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bpftrace
Commits
1da09dbc
Commit
1da09dbc
authored
Mar 20, 2018
by
Brendan Gregg
Committed by
Alastair Robertson
Mar 24, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add biosnoop tool
parent
454cdd08
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
0 deletions
+83
-0
tools/biosnoop.bt
tools/biosnoop.bt
+40
-0
tools/biosnoop_example.txt
tools/biosnoop_example.txt
+43
-0
No files found.
tools/biosnoop.bt
0 → 100644
View file @
1da09dbc
//
// biosnoop.bt - basic block I/O tracing tool, showing per I/O latency.
// For Linux, uses bpftrace, eBPF.
//
// TODO: switch to block tracepoints. Add device, offset, and size columns.
//
// 15-Nov-2017 Brendan Gregg Created this.
//
BEGIN
{
printf("%-12s %-16s %-6s %7s\n", "TIME(ms)", "COMM", "PID", "LAT(ms)");
@epoch = nsecs;
}
kprobe:blk_account_io_start
{
@start[arg0] = nsecs;
@iopid[arg0] = pid;
@iocomm[arg0] = comm;
}
kprobe:blk_account_io_completion
/@start[arg0] != 0 && @iopid[arg0] != 0 && @iocomm[arg0] != ""/
{
$now = nsecs;
printf("%-12u %-16s %-6d %7d\n",
($now - @epoch) / 1000000, @iocomm[arg0], @iopid[arg0],
($now - @start[arg0]) / 1000000);
@start[arg0] = delete();
@iopid[arg0] = delete();
@iocomm[arg0] = delete();
}
END
{
@epoch = delete();
}
tools/biosnoop_example.txt
0 → 100644
View file @
1da09dbc
Demonstrations of biosnoop, the Linux BPF/bpftrace version.
This traces block I/O, and shows the issuing process (at least, the process
that was on-CPU at the time of queue insert) and the latency of the I/O:
# bpftrace biosnoop.bt
Attaching 4 probes...
TIME(ms) COMM PID LAT(ms)
611 bash 4179 10
611 cksum 4179 0
627 cksum 4179 15
641 cksum 4179 13
644 cksum 4179 3
658 cksum 4179 13
673 cksum 4179 14
686 cksum 4179 13
701 cksum 4179 14
710 cksum 4179 8
717 cksum 4179 6
728 cksum 4179 10
735 cksum 4179 6
751 cksum 4179 10
758 cksum 4179 17
783 cksum 4179 12
796 cksum 4179 25
802 cksum 4179 32
[...]
This output shows the cksum process was issuing block I/O, which were
completing with around 12 milliseconds of latency. Each block I/O event is
printed out, with a completion time as the first column, measured from
program start.
An example of some background flushing:
# bpftrace biosnoop.bt
Attaching 4 probes...
TIME(ms) COMM PID LAT(ms)
2966 jbd2/nvme0n1-8 615 0
2967 jbd2/nvme0n1-8 615 0
[...]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment