-
Notifications
You must be signed in to change notification settings - Fork 251
/
histogram-kernel2.stp
57 lines (48 loc) · 1.24 KB
/
histogram-kernel2.stp
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
46
47
48
49
50
51
52
53
54
55
56
57
/*
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();
}