Created
April 25, 2014 14:39
-
-
Save joshkuten/11291880 to your computer and use it in GitHub Desktop.
Dtrace script trying to inspect return values for getaddrinfo
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 | |
dtrace:::BEGIN | |
{ | |
printf("%-20s %-12s %s\n", "TIME", "LATENCY(ms)", "HOST"); | |
} | |
pid$target::getaddrinfo:entry | |
{ | |
self->host = copyinstr(arg0); | |
self->start = timestamp; | |
} | |
pid$target::getaddrinfo:return | |
/self->start/ | |
{ | |
printf("%d %d %d", arg0, arg1, arg2); | |
this->delta = (timestamp - self->start) / 1000000; | |
printf("%-20Y %-12d %s\n", walltimestamp, this->delta, self->host); | |
self->host = 0; | |
self->start = 0; | |
@ = quantize((int32_t)arg1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
from
netdb.h