-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroundtrip.monkey.bt
89 lines (83 loc) · 1.47 KB
/
roundtrip.monkey.bt
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env bpftrace
BEGIN
{
printf("Hit Ctrl-C to end.\n");
}
END
{
clear(@follow);
clear(@read_ns);
clear(@write_ns);
clear(@open_ns);
clear(@close_ns);
}
usdt:$2:read_enter
/pid == $1 && !@follow/
{
@follow = nsecs;
@event_count["read"]++;
}
usdt:$2:write_enter
/pid == $1 && !@follow/
{
@follow = nsecs;
@event_count["write"]++;
}
usdt:$2:open_enter
/pid == $1 && !@follow/
{
@follow = nsecs;
@event_count["open"]++;
}
usdt:$2:close_enter
/pid == $1 && !@follow/
{
@follow = nsecs;
@event_count["close"]++;
}
usdt:$2:read_exit
/pid == $1 && @follow/
{
$total = nsecs - @follow;
@read_ns[@event_count["read"]] = $total;
delete(@follow);
@read_ns_hist = stats($total);
}
usdt:$2:write_exit
/pid == $1 && @follow/
{
$total = nsecs - @follow;
@write_ns[@event_count["write"]] = $total;
delete(@follow);
@write_ns_hist = stats($total);
}
usdt:$2:open_exit
/pid == $1 && @follow/
{
$total = nsecs - @follow;
@open_ns[@event_count["open"]] = $total;
delete(@follow);
@open_ns_hist = stats($total);
}
usdt:$2:close_exit
/pid == $1 && @follow/
{
$total = nsecs - @follow;
@close_ns[@event_count["close"]] = $total;
delete(@follow);
@close_ns_hist = stats($total);
}
//interval:s:1
//{
// print(@read_ns);
// clear(@read_ns);
//
// print(@write_ns);
// clear(@write_ns);
//
// print(@open_ns);
// clear(@open_ns);
//
// print(@close_ns);
// clear(@close_ns);
//}