summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples/memory/mmwriteback.stp
diff options
context:
space:
mode:
authorWilliam Cohen <wcohen@redhat.com>2009-08-31 16:53:40 -0400
committerWilliam Cohen <wcohen@redhat.com>2009-08-31 16:53:40 -0400
commit0dc23d1d3435d0a1b8721618e6c898b9216a27e2 (patch)
tree45073bf69363dc8f0517561dacde002d4f18e19c /testsuite/systemtap.examples/memory/mmwriteback.stp
parentd97876c8cd8488865753fa6a6055ab3a58d7219a (diff)
downloadsystemtap-steved-0dc23d1d3435d0a1b8721618e6c898b9216a27e2.tar.gz
systemtap-steved-0dc23d1d3435d0a1b8721618e6c898b9216a27e2.tar.xz
systemtap-steved-0dc23d1d3435d0a1b8721618e6c898b9216a27e2.zip
Add virtual memory subsystem tracepoint examples.
Diffstat (limited to 'testsuite/systemtap.examples/memory/mmwriteback.stp')
-rwxr-xr-xtestsuite/systemtap.examples/memory/mmwriteback.stp54
1 files changed, 54 insertions, 0 deletions
diff --git a/testsuite/systemtap.examples/memory/mmwriteback.stp b/testsuite/systemtap.examples/memory/mmwriteback.stp
new file mode 100755
index 00000000..8481543b
--- /dev/null
+++ b/testsuite/systemtap.examples/memory/mmwriteback.stp
@@ -0,0 +1,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]))
+}