Skip to content

Instantly share code, notes, and snippets.

@sax
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sax/654f5f665ce607fad47a to your computer and use it in GitHub Desktop.
Save sax/654f5f665ce607fad47a to your computer and use it in GitHub Desktop.
Slow forking analysis
#!/usr/bin/dtrace
syscall::forksys:entry
/pid == $target/
{
self->tracing = 1;
}
syscall::forksys:return
/pid == $target/
{
self->tracing = 0;
}
sched:::off-cpu
/pid == $target/
{
self->start = timestamp;
}
sched:::on-cpu
/self->tracing && self->start && ((timestamp - self->start) > 1000000)/
{
printf("waited: %d ms\\n", (timestamp - self->start) / 1000000);
ustack(15);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment