Skip to content

Commit ed25feb

Browse files
committed
plot_memory: hook up exit handler properly
1 parent e778640 commit ed25feb

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

contrib/load-tester/plot_memory.sh

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,20 @@ function plot {
1414
gnuplot memory.plot
1515
}
1616

17-
SLEEP=5
18-
COUNT=0
19-
while true; do
20-
vmdata=`getdatum VmData`
21-
vmrss=`getdatum VmRSS`
22-
echo "$(($COUNT * $SLEEP)) $vmdata" >> vmdata.log
23-
echo "$(($COUNT * $SLEEP)) $vmrss" >> vmrss.log
24-
COUNT=$(($COUNT + 1))
25-
sleep $SLEEP
26-
done
17+
function main {
18+
SLEEP=5
19+
COUNT=0
20+
while true; do
21+
vmdata=`getdatum VmData`
22+
vmrss=`getdatum VmRSS`
23+
echo "$(($COUNT * $SLEEP)) $vmdata" >> vmdata.log
24+
echo "$(($COUNT * $SLEEP)) $vmrss" >> vmrss.log
25+
COUNT=$(($COUNT + 1))
26+
sleep $SLEEP
27+
done
28+
}
2729

30+
main
2831

2932
# on exit, do plot
3033
trap plot EXIT

0 commit comments

Comments
 (0)