summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples/profiling
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2009-02-02 16:00:01 -0500
committerDave Brolley <brolley@redhat.com>2009-02-02 16:00:01 -0500
commitd777f0978faec5ee006deb83a15dec707e920c01 (patch)
treed3014c81bf9bb89785fda9028292826065b100e8 /testsuite/systemtap.examples/profiling
parentf9cf4e363d1372324bf83ca7fc0531319975cb18 (diff)
parent0d65057a8a8b418568a18eb394d3e57f5a8051a5 (diff)
downloadsystemtap-steved-d777f0978faec5ee006deb83a15dec707e920c01.tar.gz
systemtap-steved-d777f0978faec5ee006deb83a15dec707e920c01.tar.xz
systemtap-steved-d777f0978faec5ee006deb83a15dec707e920c01.zip
Merge branch 'master' of git://sources.redhat.com/git/systemtap
Conflicts: ChangeLog NEWS
Diffstat (limited to 'testsuite/systemtap.examples/profiling')
-rw-r--r--testsuite/systemtap.examples/profiling/topsys.meta13
-rw-r--r--testsuite/systemtap.examples/profiling/topsys.stp24
2 files changed, 37 insertions, 0 deletions
diff --git a/testsuite/systemtap.examples/profiling/topsys.meta b/testsuite/systemtap.examples/profiling/topsys.meta
new file mode 100644
index 00000000..3642713d
--- /dev/null
+++ b/testsuite/systemtap.examples/profiling/topsys.meta
@@ -0,0 +1,13 @@
+title: Show Processes Doing Polling Operations
+name: topsys.stp
+version: 1.0
+author: anonymous
+keywords: profiling
+subsystem: kernel syscalls
+status: production
+exit: user-controlled
+output: sorted-list
+scope: system-wide
+description: The topsys.stp script lists out the top twenty systemcalls for the previous 5 seconds. The output is sorted from most frequent to least frequent.
+test_check: stap -p4 topsys.stp
+test_installcheck: stap topsys.stp -c "sleep 1"
diff --git a/testsuite/systemtap.examples/profiling/topsys.stp b/testsuite/systemtap.examples/profiling/topsys.stp
new file mode 100644
index 00000000..34cf826c
--- /dev/null
+++ b/testsuite/systemtap.examples/profiling/topsys.stp
@@ -0,0 +1,24 @@
+#! /usr/bin/env stap
+#
+# This script continuously lists the top 20 systemcalls in the interval
+# 5 seconds
+#
+
+global syscalls_count
+
+probe syscall.* {
+ syscalls_count[name]++
+}
+
+function print_systop () {
+ printf ("%25s %10s\n", "SYSCALL", "COUNT")
+ foreach (syscall in syscalls_count- limit 20) {
+ printf("%25s %10d\n", syscall, syscalls_count[syscall])
+ }
+ delete syscalls_count
+}
+
+probe timer.s(5) {
+ print_systop ()
+ printf("--------------------------------------------------------------\n")
+}