Permalink
Fetching contributors…
Cannot retrieve contributors at this time
58 lines (48 sloc) 1.24 KB
/*
Based on Brendan Gregg's work: http://www.brendangregg.com/
usage:
stap -v histogram-kernel2.stp \
'kernel.statement("*@net/ipv4/tcp_ipv4.c:1635")' \
'kernel.statement("*@net/ipv4/tcp_ipv4.c:1637")' 30
*/
global etime[64]
global intervals
global started
global stopped
global unfinished
probe $1 {
started += 1
t1_ns = etime[cpu()]
if (t1_ns != 0) {
unfinished ++
}
etime[cpu()] = gettimeofday_ns()
}
probe $2 {
stopped += 1
t1_ns = etime[cpu()]
if (t1_ns == 0) {
unfinished ++
} else {
etime[cpu()] = 0
intervals <<< (gettimeofday_ns() - t1_ns)/1000
}
}
probe end {
printf("First probe reached: %d times\n", started)
printf("Second probe reached: %d times\n", stopped)
printf("Unfinished measurements: %d\n", unfinished)
printf("Duration min:%dus avg:%dus max:%dus count:%d\n",
@min(intervals), @avg(intervals), @max(intervals),
@count(intervals))
printf("Duration (us):\n")
print(@hist_log(intervals));
printf("\n")
}
%( $# > 1 %?
probe timer.sec($3) {
%:
probe timer.sec(30) {
%)
exit();
}