Skip to content

Commit

Permalink
Added entry-counts.d dtrace script for probe analysis.
Browse files Browse the repository at this point in the history
Updated .gitignore to allow .d files outside of shotgun.
  • Loading branch information
crafterm committed Mar 4, 2008
1 parent fa413a5 commit 16253b7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions tools/dtrace/entry-counts.d
@@ -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.