Skip to content

Instantly share code, notes, and snippets.

@stevenwilliamson
Last active August 29, 2015 14:15
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 stevenwilliamson/0acddf5a8592b406c44b to your computer and use it in GitHub Desktop.
Save stevenwilliamson/0acddf5a8592b406c44b to your computer and use it in GitHub Desktop.
#!/usr/sbin/dtrace -s
#pragma D option quiet
#pragma D option strsize=8096
/*Output mysql queries in slow query log format*/
pid$target::*mysql_parse*:entry / strstr(copyinstr(arg1), "ledger_entries") != NULL / /* This probe is fired when the execution enters mysql_parse */
{
self->s_time = timestamp;
}
pid$target::*mysql_parse*:return / self->s_time / /* This probe is fired when the execution enters mysql_parse */
{
/*@querytime = quantize((timestamp - self->s_time) / 1000000);*/
@querytime = llquantize((timestamp - self->s_time) / 1000, 10, 0 , 6, 10);
self->s_time = 0;
}
tick-30s {
printa(@querytime);
clear(@querytime);
}
Exits with dtrace: processing aborted: No such file or directory, after printing first aggregation when using llquantize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment