Created
July 16, 2015 08:00
-
-
Save dotmanila/1f0ad1475ff8390fe60b to your computer and use it in GitHub Desktop.
systemtap Measuring mysqld functions latency
This file contains hidden or 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
#!/bin/env stap | |
# | |
global latency, latency_histogram | |
probe begin { | |
printf("Begin.\n") | |
} | |
probe process("/usr/sbin/mysqld").function("*") { | |
latency[probefunc()] = gettimeofday_s() | |
} | |
probe process("/usr/sbin/mysqld").function("*").return { | |
l = gettimeofday_s() - latency[ppfunc()] | |
printf("%s %d\n", ppfunc(), l) | |
if (l > 1) latency_histogram[ppfunc()] <<< latency[ppfunc()] | |
} | |
probe end { | |
foreach (lh in latency_histogram) { | |
printf("\n>>>>>>> %s latency\n", lh) | |
println(@hist_linear(latency_histogram[lh], 0, 10, 1)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment