Skip to content

Instantly share code, notes, and snippets.

@googya
Created November 19, 2013 12:25
Show Gist options
  • Select an option

  • Save googya/7544600 to your computer and use it in GitHub Desktop.

Select an option

Save googya/7544600 to your computer and use it in GitHub Desktop.
ruby 方法执行过程, 估计还有问题, 没看到栈的调用
#!/usr/sbin/dtrace -Zs
#pragma D option quiet
#pragma D option switchrate=10
self int depth;
ruby*:::method-entry
/pid == $target/
{
this->name = copyinstr(arg1);
printf("%*s-> %s\n", self->depth * 2, "", this->name);
self->depth++;
}
ruby*:::method-return
/pid == $target/
{
this->name = copyinstr(arg1);
self->depth -= self->depth > 0 ? 1 : 0;
printf("%*s<- %s\n",self->depth * 2, "", this->name);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment