-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathtop-metrics
More file actions
executable file
·33 lines (27 loc) · 1.21 KB
/
top-metrics
File metadata and controls
executable file
·33 lines (27 loc) · 1.21 KB
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::int8) as max_dirty, pg_size_pretty(hit_bps::int8) as hit,
pg_size_pretty(read_bps::int8) as read, pg_size_pretty(check_bps::int8) as check,
pg_size_pretty(clean_Bps::int8) as clean, pg_size_pretty(wal_written_bps::int8) as wal,
pg_size_pretty(backend_Bps::int8) as backend,
pg_size_pretty((hit_bps+read_bps+check_bps+clean_Bps+wal_written_Bps)::int8) AS total
FROM test_stats ORDER BY ${METRIC} DESC LIMIT ${LIMIT};
"
echo
done