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
|
#! /usr/bin/env stap
global traced_pid, command
global pgout, bgwriteout, kupdate
function log_event:long ()
{
return (!traced_pid || traced_pid == pid())
}
probe kernel.trace("mm_pdflush_bgwriteout") {
if (!log_event()) next
bgwriteout[pid()] <<< $count
command[pid()] = execname()
}
probe kernel.trace("mm_pdflush_kupdate") {
if (!log_event()) next
kupdate[pid()] <<< $count
command[pid()] = execname()
}
probe kernel.trace("mm_pagereclaim_pgout") {
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]))
}
|