Created
November 19, 2013 12:25
-
-
Save googya/7544600 to your computer and use it in GitHub Desktop.
ruby 方法执行过程, 估计还有问题, 没看到栈的调用
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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