Skip to content

Instantly share code, notes, and snippets.

@methodmissing
Created August 9, 2009 15:54
Show Gist options
  • Select an option

  • Save methodmissing/164801 to your computer and use it in GitHub Desktop.

Select an option

Save methodmissing/164801 to your computer and use it in GitHub Desktop.
#!/usr/sbin/dtrace -Zs
/*
sudo dtrace -Zs walk.d -c 'ruby test.rb'
*/
#pragma D option quiet
#pragma D option switchrate=10
#pragma D option dynvarsize=128m
#pragma D option bufsize=128m
#pragma D option aggsize=64m
self int depth;
self int rb_in_eval;
dtrace:::BEGIN
{
self->depth = 0;
self->rb_in_eval = 0;
printf("Walking MRI 18 eval ...")
}
pid$target::rb_eval:entry{
self->rb_in_eval = 1;
}
pid$target:::return
/self->rb_in_eval/
{
printf( "%*s-> %s()\n", self->depth * 2, "", probefunc );
self->depth++;
}
pid$target:::return
/self->rb_in_eval/
{
self->depth--;
printf( "%*s<- %s()\n", self->depth * 2, "", probefunc );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment