summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples/memory/mmfilepage.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/mmfilepage.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/mmfilepage.stp')
-rwxr-xr-xtestsuite/systemtap.examples/memory/mmfilepage.stp66
1 files changed, 66 insertions, 0 deletions
diff --git a/testsuite/systemtap.examples/memory/mmfilepage.stp b/testsuite/systemtap.examples/memory/mmfilepage.stp
new file mode 100755
index 00000000..07017b45
--- /dev/null
+++ b/testsuite/systemtap.examples/memory/mmfilepage.stp
@@ -0,0 +1,66 @@
+#! /usr/bin/env stap
+
+global traced_pid, command
+global allocation, free
+global file_fault, file_cow, file_uunmap, file_kunmap
+
+function log_event:long ()
+{
+ return (!traced_pid || traced_pid == pid())
+}
+
+probe kernel.trace("mm_page_allocation") {
+ if (!log_event()) next
+ allocation[pid()] <<< 1
+ command[pid()] = execname()
+}
+
+probe kernel.trace("mm_page_free") {
+ if (!log_event()) next
+ free[pid()] <<< 1
+}
+
+probe kernel.trace("mm_filemap_fault") {
+ if (!log_event()) next
+ file_fault[pid()] <<< 1
+}
+
+probe kernel.trace("mm_filemap_cow") {
+ if (!log_event()) next
+ file_cow[pid()] <<< 1
+}
+
+probe kernel.trace("mm_filemap_unmap") {
+ if (!log_event()) next
+ file_kunmap[pid()] <<< 1
+}
+
+probe kernel.trace("mm_filemap_userunmap") {
+ if (!log_event()) next
+ file_uunmap[pid()] <<< 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 %9s %9s %8s %8s %8s %8s\n",
+ "Command", "Pid", "Alloc", "Free", "F_fault",
+ "F_cow", "F_kunmap", "F_uunmap")
+ printf("%-16s %6s %9s %9s %8s %8s %8s %8s\n",
+ "-------", "---", "-----", "----", "-------",
+ "-----", "--------", "--------")
+ foreach (pid in allocation-)
+ printf("%-16s %6d %9d %9d %8d %8d %8d %8d\n",
+ command[pid], pid,
+ @count(allocation[pid]), @count(free[pid]),
+ @count(file_fault[pid]), @count(file_cow[pid]),
+ @count(file_kunmap[pid]), @count(file_uunmap[pid]))
+}