-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshow_tps.sh
More file actions
executable file
·41 lines (39 loc) · 1.38 KB
/
show_tps.sh
File metadata and controls
executable file
·41 lines (39 loc) · 1.38 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
34
35
36
37
38
39
40
41
#!/bin/bash
if [ "$1" = "-a" ]; then
stdbuf -oL tail -f nohup.out | grep -E --line-buffered "block_size|tps|num_txs|num_txs_res" | awk '
{
# Remove ANSI color codes
gsub(/\033\[[0-9;]*[mGK]/, "")
# Check and print lines where block_size > 0
if (match($0, /block_size=[0-9]+/)) {
split(substr($0, RSTART, RLENGTH), a, "=")
if (a[2]+0 > 0) {print; next}
}
# Check and print lines where tps > 0
if (match($0, /tps=[0-9]+/)) {
split(substr($0, RSTART, RLENGTH), a, "=")
if (a[2]+0 > 0) {print; next}
}
# Check and print lines where num_txs > 0
if (match($0, /num_txs=[0-9]+/)) {
split(substr($0, RSTART, RLENGTH), a, "=")
if (a[2]+0 > 0) {print; next}
}
# Check and print lines where num_txs_res > 0
if (match($0, /num_txs_res=[0-9]+/)) {
split(substr($0, RSTART, RLENGTH), a, "=")
if (a[2]+0 > 0) {print; next}
}
}'
else
stdbuf -oL tail -f nohup.out | grep -E --line-buffered "tps" | awk '
{
# Remove ANSI color codes
gsub(/\033\[[0-9;]*[mGK]/, "")
# Check and print lines where tps > 0
if (match($0, /tps=[0-9]+/)) {
split(substr($0, RSTART, RLENGTH), a, "=")
if (a[2]+0 > 0) {print; next}
}
}'
fi