Skip to content

Instantly share code, notes, and snippets.

@dotmanila
Created July 16, 2015 08:00
Show Gist options
  • Save dotmanila/1f0ad1475ff8390fe60b to your computer and use it in GitHub Desktop.
Save dotmanila/1f0ad1475ff8390fe60b to your computer and use it in GitHub Desktop.
systemtap Measuring mysqld functions latency
#!/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