forked from dengliu/systemtap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmmwriteback.stp
67 lines (58 loc) · 1.95 KB
/
mmwriteback.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
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/stap
global traced_pid, command
global pgout, bgwriteout, kupdate
function log_event:long ()
{
return (!traced_pid || traced_pid == pid())
}
probe kernel.trace("balance_dirty_pages") !, # v3.2+
kernel.trace("mm_balancedirty_writeout") !, # RHEL6(2.6.32)
kernel.trace("mm_pdflush_bgwriteout") # RHEL5(2.6.18)
{
if (!log_event()) next
bgwriteout[pid()] <<< (@defined($dirtied) ? $dirtied
: (@defined($written) ? $written : $count))
command[pid()] = execname()
}
probe kernel.trace("writeback_pages_written") !, # v2.6.36+
# & RHEL6(2.6.32)
kernel.trace("mm_pdflush_kupdate") # RHEL5(2.6.18)
{
if (!log_event()) next
kupdate[pid()] <<< (@defined($pages_written) ? $pages_written : $count)
command[pid()] = execname()
}
probe kernel.trace("mm_vmscan_writepage") !, # v2.6.36+
# & RHEL6(2.6.32)
kernel.trace("mm_pagereclaim_pgout") # RHEL5(2.6.18)
# & RHEL6(2.6.32)
{
if (!log_event()) next
pgout[pid()] <<< 1
command[pid()] = execname()
}
probe begin {
printf("Starting data collection\n")
traced_pid = target()
if (traced_pid)
printf("mode Specific Pid, traced pid: %d\n\n", traced_pid)
else
printf("mode - All Pids\n\n")
}
probe end, error {
printf("Terminating data collection\n")
printf("%-16s %6s %10s %10s %10s %10s %11s\n",
"", "", "Pdflush", "Pdflush", "Kupdate", "Kupdate", "Pgout")
printf("%-16s %6s %10s %10s %10s %10s %11s\n",
"Command", "Pid", "count", "sum", "count", "sum", "count")
printf("%-16s %6s %10s %10s %10s %10s %11s\n",
"-------", "---", "-------", "-------", "-------", "-------", "-----")
foreach (pid in command-)
printf("%-16s %6d %10d %10d %10d %10d %11d\n",
command[pid], pid,
@count(bgwriteout[pid]),
(@count(bgwriteout[pid]) ? @sum(bgwriteout[pid]) : 0),
@count(kupdate[pid]),
(@count(kupdate[pid]) ? @sum(kupdate[pid]) : 0),
@count(pgout[pid]))
}