-
Notifications
You must be signed in to change notification settings - Fork 73
/
top-metrics
executable file
·33 lines (27 loc) · 1.16 KB
/
top-metrics
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# Pass a parameter to control how many results are shown for each metric
LIMIT="$1"
if [ -z "$LIMIT" ] ; then
LIMIT="10"
fi
source ./config
RESULTPSQL="psql -h $RESULTHOST -U $RESULTUSER -p $RESULTPORT -d $RESULTDB"
# max_dirty is qualified here so it doesn't sort by the pretty printed value.
# It's tempting to sort by the total number. That code is mess with how
# the query would be written. It's also not very useful given that
# hit_bps dominates every other field; sorting by that is sufficient.
METRICS="hit_bps read_bps check_bps backend_Bps clean_bps test_stats.max_dirty max_latency"
for METRIC in $METRICS; do
echo "Top test results sorted by ${METRIC}:"
$RESULTPSQL -c "
SELECT
server,script,scale,clients,test,tps,max_latency,
pg_size_pretty(max_dirty) as max_dirty, pg_size_pretty(hit_bps) as hit,
pg_size_pretty(read_bps) as read, pg_size_pretty(check_bps) as check,
pg_size_pretty(clean_Bps) as clean, pg_size_pretty(wal_written_bps) as wal,
pg_size_pretty(backend_Bps) as backend,
pg_size_pretty(hit_bps+read_bps+check_bps+clean_Bps+wal_written_Bps) AS total
FROM test_stats ORDER BY ${METRIC} DESC LIMIT ${LIMIT};
"
echo
done