-
Notifications
You must be signed in to change notification settings - Fork 0
/
stat_hist.bt
80 lines (64 loc) · 1.98 KB
/
stat_hist.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
#!/usr/bin/env bpftrace
tracepoint:syscalls:sys_exit_newstat,
tracepoint:syscalls:sys_exit_newlstat,
tracepoint:syscalls:sys_exit_newfstat,
tracepoint:syscalls:sys_exit_newfstatat {
@stat_syscall_count[comm] = count();
}
kprobe:vfs_statfs {
@vfs_statfs_count[comm] = count();
}
kprobe:vfs_getattr {
@vfs_getattr_count[comm] = count();
}
tracepoint:nfs:nfs_getattr_enter {
@nfs_getattr_count[comm] = count();
}
tracepoint:nfs:nfs_revalidate_inode_enter {
@nfs_revalidate_inode_count[comm] = count();
}
kprobe:nfs4_xdr_enc_statfs {
@nfs4_statfs_comm_count[comm] = count();
@nfs4_xdr_enc_statfs_total++;
}
kprobe:nfs4_xdr_enc_getattr {
@nfs4_getattr_comm_count[comm] = count();
@nfs4_xdr_enc_getattr_total++;
}
interval:s:10 {
printf("=== count of stat/statfs/getattr by comm [ ");
time("%Y/%m/%d %T %Z");
printf("] ===\n");
printf("+ vfs_statfs_count\n");
print(@vfs_statfs_count);
printf("\n");
clear(@vfs_statfs_count);
printf("+ vfs_getattr_count\n");
print(@vfs_getattr_count);
printf("\n");
clear(@vfs_getattr_count);
printf("+ nfs_getattr_count\n");
print(@nfs_getattr_count);
printf("\n");
clear(@vfs_getattr_count);
printf("+ stat syscalls\n");
print(@stat_syscall_count, 10);
printf("\n");
clear(@stat_syscall_count);
printf("+ nfs_revalidate_inode\n");
print(@nfs_revalidate_inode_count, 10);
printf("\n");
clear(@nfs_revalidate_inode_count);
printf("+ nfs4_xdr_enc_statfs\n");
print(@nfs4_statfs_comm_count);
printf("total nfs4_xdr_enc_statfs_seen: %d\n", @nfs4_xdr_enc_statfs_total);
clear(@nfs4_statfs_comm_count);
clear(@nfs4_xdr_enc_statfs_total);
printf("\n");
printf("+ nfs4_xdr_enc_getattr\n");
print(@nfs4_getattr_comm_count);
printf("total nfs4_xdr_enc_getattrs_seen: %d\n", @nfs4_xdr_enc_getattr_total);
clear(@nfs4_getattr_comm_count);
clear(@nfs4_xdr_enc_getattr_total);
printf("--------------------------\n\n");
}