Skip to content

Instantly share code, notes, and snippets.

@seiji
Created November 20, 2012 15:48
Show Gist options
  • Save seiji/4118724 to your computer and use it in GitHub Desktop.
Save seiji/4118724 to your computer and use it in GitHub Desktop.
trace.d
#pragma D option quiet
self int level;
objc$target:::entry
{
printf("%*s[tid=%lld][%s %s]\n",
self->level * 2, " ->",
(long long)tid, probemod, probefunc);
self->ts[probefunc] = timestamp;
self->level++;
}
objc$target:::return
{
time = timestamp - self->ts[probefunc];
self->level--;
printf("%*s[tid=%lld][%s %s] [%dms]\n",
self->level * 2, " <-", (long long)tid,
probemod, probefunc, time / 1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment