| Server IP : 182.53.201.61 / Your IP : 216.73.217.175 Web Server : Apache/2.2.15 (Fedora) System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 User : apache ( 48) PHP Version : 5.3.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/systemtap-1.0/examples/memory/ |
Upload File : |
#!/usr/bin/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]))
}