Permalink
Browse files

Added entry-counts.d dtrace script for probe analysis.

Updated .gitignore to allow .d files outside of shotgun.
  • Loading branch information...
1 parent fa413a5 commit 16253b78e10d688a04b6033387d6ff1f698b94cf @crafterm crafterm committed Mar 4, 2008
Showing with 22 additions and 2 deletions.
  1. +3 −2 .gitignore
  2. +19 −0 tools/dtrace/entry-counts.d
View
@@ -26,8 +26,9 @@ scratch
!runtime/stable/loader.rbc
runtime/pristine*
runtime/platform.conf
-
-*.d
+.*.d
+shotgun/lib/*.d
+shotgun/lib/subtend/*.d
*.o
*.lo
*.a
@@ -0,0 +1,19 @@
+/*
+ * entry/exit counts
+ *
+ * This script manages a counter for every method invocation. Upon function-entry the probe increments
+ * the counter, upon function-return the counter decrements the counter. At the end of the run
+ * dtrace should print all methods run, with a count of 0 for all of them - indicating that the probes
+ * have fired correctly.
+ *
+ * Example invocation:
+ *
+ * $> sudo dtrace -s entry-counts.d -c 'rbx ~/hello.rb'
+ */
+
+#pragma D option dynvarsize=250m
+#pragma D option bufsize=64m
+
+rubinius$target:::function-entry { @[copyinstr(arg0), copyinstr(arg1)] = sum(1); }
+rubinius$target:::function-return { @[copyinstr(arg0), copyinstr(arg1)] = sum(-1); }
+

0 comments on commit 16253b7

Please sign in to comment.