Skip to content

Commit e778640

Browse files
committed
Add memory plot to load-tester; drop privileges
1 parent 92bde50 commit e778640

File tree

3 files changed

+59
-7
lines changed

3 files changed

+59
-7
lines changed

contrib/load-tester/memory.gnuplot

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
set terminal png size 700,550 enhanced font "Helvetica,20"
2+
set output "memory.png"
3+
set xlabel "Time in seconds"
4+
set ylabel "Memory usage in kB"
5+
plot "vmdata.log" using 1:2 with lines title "VmData", \
6+
"vmrss.log" using 1:2 with lines title "VmRSS"
7+

contrib/load-tester/plot_memory.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
# empty
4+
> vmdata.log
5+
> vmrss.log
6+
7+
WD_PID=$1
8+
9+
function getdatum {
10+
grep $1 /proc/$WD_PID/status | cut -f 3 -d " "
11+
}
12+
13+
function plot {
14+
gnuplot memory.plot
15+
}
16+
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
27+
28+
29+
# on exit, do plot
30+
trap plot EXIT

contrib/load-tester/run.sh

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
# echo "core.%e.%p" > /proc/sys/kernel/core_pattern
55
# http://stackoverflow.com/a/18368068
66

7+
8+
if [[ -z "$SUDO_USER" ]]; then
9+
echo "Hey, you should run this with sudo"
10+
exit 1
11+
fi
12+
713
echo "core.%e.%p" > /proc/sys/kernel/core_pattern
814
ulimit -c unlimited
915

@@ -12,38 +18,47 @@ echo "Make sure to configure GatewayInterface in wifidog_mock.conf"
1218

1319
./generate_interfaces.sh start $COUNT || exit 1
1420

15-
./mock_auth.py &
21+
sudo -u "$SUDO_USER" ./mock_auth.py &
1622
MA_PID="$!"
1723

24+
# work around libtool stuff - do not execute wrapper!
25+
#EXEC="../../src/.libs/wifidog"
26+
#export LD_LIBRARY_PATH="../../libhttpd/.libs/"
1827
# trace-children is necessary because of the libtool wrapper -.-
19-
#sudo valgrind --leak-check=full --trace-children=yes --trace-children-skip=/bin/sh \
20-
# --log-file=valgrind.log ../../src/wifidog -d 7 -f -c wifidog-mock.conf 2> wifidog.log &
28+
#valgrind --leak-check=full --trace-children=yes --trace-children-skip=/bin/sh \
29+
# --log-file=valgrind.log $EXEC -d 7 -f -c wifidog-mock.conf -a /tmp/arp 2> wifidog.log &
2130

2231
# for -fsanitize=address
2332
export ASAN_OPTIONS=check_initialization_order=1
2433
export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.5
2534

26-
../../src/wifidog -d 7 -f -c wifidog-mock.conf -a /tmp/arp 2> wifidog.log &
35+
36+
../../src/wifidog -d 7 -f -c wifidog-mock.conf -a /tmp/arp &> wifidog.log &
2737
WD_PID="$!"
2838

29-
IF=`grep GatewayInterface wifidog-mock.conf | cut -f 2 -d ' '`
39+
40+
sudo -u "$SUDO_USER" ./plot_memory.sh $WD_PID &
41+
M_PID="$!"
42+
43+
IF=`sudo -u "$SUDO_USER" grep GatewayInterface wifidog-mock.conf | cut -f 2 -d ' '`
3044

3145
echo "Waiting for wifidog to come up"
3246

3347
sleep 10
3448

35-
./fire_requests.py \
49+
sudo -u "$SUDO_USER" ./fire_requests.py \
3650
--target-interface $IF \
3751
--source-interface-prefix mac \
3852
--source-interface-count $COUNT \
39-
--process-count 2
53+
--process-count 3
4054

4155
#./generate_interfaces.sh stop
4256

4357
function cleanup() {
4458

4559
kill $MA_PID
4660
kill $WD_PID
61+
kill $M_PID
4762
./generate_interfaces.sh stop $COUNT
4863

4964
}

0 commit comments

Comments
 (0)