-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmmreclaim.stp
81 lines (71 loc) · 2.19 KB
/
mmreclaim.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/stap
global traced_pid, command
global reclaims, direct_reclaims, freed
global reactivate, deactivate, pgout
global t_reclaims, t_direct_reclaims, t_freed
global t_reactivate, t_deactivate, t_pgout
function log_event:long ()
{
return (!traced_pid || traced_pid == pid())
}
probe kernel.trace("mm_directreclaim_reclaimall") {
if (!log_event()) next
direct_reclaims[pid()] <<< 1
t_direct_reclaims <<< 1
}
probe kernel.trace("mm_pagereclaim_shrinkinactive") {
if (!log_event()) next
reclaims[pid()] += $reclaimed
t_reclaims += $reclaimed
command[pid()] = execname()
}
probe kernel.trace("mm_pagereclaim_free") {
if (!log_event()) next
freed[pid()] <<< 1
t_freed <<< 1
}
probe kernel.trace("mm_pagereclaim_pgout") {
if (!log_event()) next
pgout[pid()] <<< 1
t_pgout <<< 1
}
probe kernel.trace("mm_pagereclaim_shrinkactive_a2a"),
kernel.trace("mm_pagereclaim_shrinkinactive_i2a") {
if (!log_event()) next
reactivate[pid()] <<< 1
t_reactivate <<< 1
}
probe kernel.trace("mm_pagereclaim_shrinkactive_a2i"),
kernel.trace("mm_pagereclaim_shrinkinactive_i2i") {
if (!log_event()) next
deactivate[pid()] <<< 1
t_deactivate <<< 1
}
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 {
printf("Terminating data collection\n")
printf("%-16s %6s %8s %8s %8s %10s %8s %8s\n",
"Command", "Pid", "Direct", "Activate", "Deactive",
"Reclaims", "Pgout", "Freed")
printf("%-16s %6s %8s %8s %8s %10s %8s %8s\n",
"-------", "-----", "------", "--------", "--------",
"-----", "-----", "-----")
foreach (pid in reclaims-)
printf("%-16s %6d %8d %8d %8d %10d %8d %8d\n",
command[pid], pid,
@count(direct_reclaims[pid]), @count(reactivate[pid]),
@count(deactivate[pid]), reclaims[pid],
@count(pgout[pid]), @count(freed[pid]))
printf("\n")
printf("%-23s %8d %8d %8d %10d %8d %8d\n", "Totals",
@count(t_direct_reclaims), @count(t_reactivate),
@count(t_deactivate), t_reclaims,
@count(t_pgout), @count(t_freed))
}