Skip to content

Instantly share code, notes, and snippets.

@misterdjules
Created September 14, 2017 22:36
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 misterdjules/00f02f3423d17a30e4e5773ebb73d65d to your computer and use it in GitHub Desktop.
Save misterdjules/00f02f3423d17a30e4e5773ebb73d65d to your computer and use it in GitHub Desktop.
#!/usr/sbin/dtrace -s
#pragma D option quiet
bunyan*:::log-debug
/json(copyinstr(arg0), "msg") == "pinging moray..."/
{
this->profiling_enabled = 1;
}
profile-997
/pid == 21884 && this->profiling_enabled == 1/
{
@stacks[jstack(150, 8000)] = count();
}
bunyan*:::log-debug
/json(copyinstr(arg0), "msg") == "successfully pinged moray"/
{
this->profiling_enabled = 0;
clear(@stacks);
}
bunyan*:::log-debug
/json(copyinstr(arg0), "msg") == "moray ping error"/
{
printf("Error!\n");
this->profiling_enabled = 0;
printa(@stacks);
clear(@stacks);
exit(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment