/usr/share/systemtap/examples/lwtools
NameSizeModeActions
accept2close-nd.814240644editdlrm
accept2close-nd.meta5970644editdlrm
accept2close-nd.stp17980755editdlrm
accept2close-nd.txt33850644editdlrm
biolatency-nd.816710644editdlrm
biolatency-nd.meta6220644editdlrm
biolatency-nd.stp20710755editdlrm
biolatency-nd_example.txt73620644editdlrm
bitesize-nd.811570644editdlrm
bitesize-nd.meta4910644editdlrm
bitesize-nd.stp15430755editdlrm
bitesize-nd_example.txt34260644editdlrm
execsnoop-nd.812350644editdlrm
execsnoop-nd.meta5700644editdlrm
execsnoop-nd.stp12830755editdlrm
execsnoop-nd_example.txt25850644editdlrm
fslatency-nd.819300644editdlrm
fslatency-nd.meta6600644editdlrm
fslatency-nd.stp39820755editdlrm
fslatency-nd_example.txt133840644editdlrm
fsslower-nd.817530644editdlrm
fsslower-nd.meta6230644editdlrm
fsslower-nd.stp37150755editdlrm
fsslower-nd_example.txt19380644editdlrm
killsnoop-nd.811310644editdlrm
killsnoop-nd.meta3840644editdlrm
killsnoop-nd.stp12810755editdlrm
killsnoop-nd_example.txt19080644editdlrm
opensnoop-nd.812680644editdlrm
opensnoop-nd.meta3570644editdlrm
opensnoop-nd.stp10260755editdlrm
opensnoop-nd_example.txt11240644editdlrm
README1070644editdlrm
rwtime-nd.811460644editdlrm
rwtime-nd.meta4120644editdlrm
rwtime-nd.stp15990755editdlrm
rwtime-nd_example.txt41850644editdlrm
syscallbypid-nd.810890644editdlrm
syscallbypid-nd.meta4040644editdlrm
syscallbypid-nd.stp11000755editdlrm
syscallbypid-nd_example.txt93220644editdlrm
Edit: /usr/share/systemtap/examples/lwtools/biolatency-nd.stp (2071B)
#!/usr/bin/stap /* * biolatency-nd.stp Measure storage (bio) latency distribution. * For Linux, uses SystemTap (non-debuginfo). * * USAGE: ./biolatency-nd.stp [interval [count]] * * This script uses the kernel tracepoints block_rq_issue and block_rq_complete, * to trace the time from storage request to completion. To include extra time * spent queued in the kernel, change block_rq_issue to block_rq_insert. * * From systemtap-lwtools: https://github.com/brendangregg/systemtap-lwtools * * See the corresponding man page (in systemtap-lwtools) for more info. * * Copyright (C) 2015 Brendan Gregg. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * 01-Feb-2015 Brendan Gregg Created this. */ global ts[65536]; # 65536 is max concurrent I/O global lat, interval = 0, secs = 0, count = 0, output = 0; probe begin { printf("Tracing block I/O... "); if (argv_1 != "") { interval = strtol(argv_1, 10); if (argv_2 != "") { count = strtol(argv_2, 10); } printf("Output every %d secs.\n", interval); } else { printf("Hit Ctrl-C to end.\n"); } } probe kernel.trace("block_rq_issue") { ts[$rq] = gettimeofday_ns(); } probe kernel.trace("block_rq_complete") { if (ts[$rq]) { lat <<< gettimeofday_ns() - ts[$rq]; delete ts[$rq]; } } function print_report() { printf("\nbio latency (ns):\n"); if (@count(lat)) { print(@hist_log(lat)); } delete lat; } probe timer.s(1) { if (interval) { if (++secs == interval) { print_report(); secs = 0; count && (++output == count) && exit(); } } } probe end { !interval && print_report(); delete secs; delete output; }