Created
September 14, 2017 20:54
-
-
Save misterdjules/31a7c40b0cf792c2bfe2dc089e0c6911 to your computer and use it in GitHub Desktop.
This file contains 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 -s | |
#pragma D option quiet | |
moray*:::query-start | |
/copyinstr(arg1) == "SELECT name FROM buckets_config LIMIT 1"/ | |
{ | |
printf("arg1: %s\n", copyinstr(arg1)); | |
starts[copyinstr(arg0)] = timestamp; | |
} | |
moray*:::query-done | |
/starts[copyinstr(arg0)]/ | |
{ | |
this->l = (timestamp - starts[copyinstr(arg0)]) / 1000; | |
this->t = walltimestamp % 1000000000; | |
printf("[%Y.%09d] Query %5s (%d) done < (%dus)\n", | |
walltimestamp, this->t, copyinstr(arg0), timestamp, this->l); | |
starts[copyinstr(arg0)] = 0; | |
this->l = 0; | |
this->t = 0; | |
} | |
bunyan*:::log-debug | |
/json(copyinstr(arg0), "msg") == "ping: entered"/ | |
{ | |
this->ping_start = timestamp; | |
} | |
bunyan*:::log-debug | |
/json(copyinstr(arg0), "msg") == "ping: done"/ | |
{ | |
this->l = (timestamp - this->ping_start) / 1000; | |
this->t = walltimestamp % 1000000000; | |
printf("%09d (%dus)\n", this->t, this->l); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment