-
-
Save xaprb/f400f5db43830a1ac2bd to your computer and use it in GitHub Desktop.
# This script converts SHOW GLOBAL STATUS into a tabulated format, one line
# per sample in the input, with the metrics divided by the time elapsed
# between samples.
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
#!/bin/sh | |
# This script converts SHOW GLOBAL STATUS into a tabulated format, one line | |
# per sample in the input, with the metrics divided by the time elapsed | |
# between samples. | |
awk ' | |
BEGIN { | |
printf "#ts date time load QPS"; | |
fmt = " %.2f"; | |
} | |
/^TS/ { # The timestamp lines begin with TS. | |
ts = substr($2, 1, index($2, ".") - 1); | |
load = NF - 2; | |
diff = ts - prev_ts; | |
prev_ts = ts; | |
printf "\n%s %s %s %s", ts, $3, $4, substr($load, 1, length($load)-1); | |
} | |
/Queries/ { | |
printf fmt, ($2-Queries)/diff; | |
Queries=$2 | |
} | |
' "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment