-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathbio_sectors.stp
More file actions
executable file
·45 lines (41 loc) · 1.09 KB
/
bio_sectors.stp
File metadata and controls
executable file
·45 lines (41 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/stap
/*
* bio_sectors.stp Measure storage (bio) I/O size distribution.
* For Linux, uses SystemTap (non-debuginfo).
*
* USAGE: ./bio_sectors.stp
*
* This script uses the kernel tracepoint block_rq_insert. The output includes
* the name of the process or thread that was on-CPU when the I/O request was
* inserted on the issue queue.
*
* The code was based on below file,
*
* https://sourceware.org/systemtap/examples/lwtools/bitesize-nd.stp
*
* From systemtap-lwtools: https://github.com/brendangregg/systemtap-lwtools
*
* See the corresponding man page (in systemtap-lwtools) for more info.
*/
global sz;
probe begin
{
printf("Tracing block I/O... Hit Ctrl-C to end.\n");
}
probe kernel.trace("block_rq_insert") {
/*
* You aren't supposed to access __data_len directly as it is internal,
* but I don't see another way...
* Get number of sectors based on bytes
*/
sz[execname()] <<< $rq->__data_len >> 9;
}
probe end
{
printf("\nI/O size (sectors):\n\n");
foreach (name in sz+) {
printf("process name: %s\n", name);
print(@hist_log(sz[name]));
}
delete sz;
}