summaryrefslogtreecommitdiffstats
path: root/examples/pf2.stp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/pf2.stp')
-rw-r--r--examples/pf2.stp15
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/pf2.stp b/examples/pf2.stp
new file mode 100644
index 00000000..dce2cdec
--- /dev/null
+++ b/examples/pf2.stp
@@ -0,0 +1,15 @@
+#! stap
+global profile, pcount
+probe timer.profile {
+ pcount ++
+ fn = probefunc ()
+ if (fn != "") profile[fn] ++ # <<< 1 would be better ...
+}
+probe timer.ms(4000) {
+ printf ("\n--- %d samples recorded:\n", pcount)
+ foreach (f in profile- limit 10) { # ... but can only sort scalar arrays (bz #2305)
+ printf ("%s\t%d\n", f, profile[f])
+ }
+ delete profile
+ pcount = 0
+}