-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbenchmark.sh
executable file
·76 lines (61 loc) · 1.55 KB
/
benchmark.sh
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# verbose output
set -x
source ../common/set-cpus.sh
source ../common/qemu.sh
IMAGES=$(pwd)/images
QEMU_GUEST=qemu-guest
benchmark() {
taskset -c ${CPU1} ${QEMU_GUEST} \
-k ${1} -m ${3} -g 1234 -p ${CPU2} \
-x -P -- -overcommit mem-lock=on
# start gdb session
gdb --eval-command="target remote :1234" \
-ex "set confirm off" \
-ex "set pagination off" \
-ex "hbreak ukplat_terminate" \
-ex "c" \
-ex "disconnect" \
-ex "set arch i386:x86-64:intel" \
-ex "tar remote localhost:1234" \
-ex "uk trace" \
-ex "quit" \
${1} >> ${2}
kill_qemu
}
parse_boot_times() {
boottime=`cat $1 | awk -e '$0 ~ /trace_boot_end/ {print $1}' | \
sed -r '/^\s*$/d' | \
awk '{ total += $1; count++ } END { print total/(count*1000) }'`
echo "$3 ${boottime}" >> $2
}
suffix=`date '+%d%m%Y%H%M%S'`
mkdir -p rawdata/ results/
kill_qemu
RESULTS=results/static.csv
echo "memory boottime_us" > $RESULTS
LOG=rawdata/1024Mstat-${suffix}.txt
touch $LOG
for j in {1..10}
do
echo "running batch 1024Mstat, ${j}/10" >> $LOG
benchmark ${IMAGES}/unikraft+stat.kernel ${LOG} 1024
parse_boot_times $LOG $RESULTS 1024
done
RESULTS=results/dynamic.csv
echo "memory boottime_us" > $RESULTS
for mem in 32 64 128 256 512 1024 2048 3072;
do
LOG=rawdata/${mem}Mdyn-${suffix}.txt
touch $LOG
for j in {1..10}
do
echo "running batch ${mem}Mdyn, ${j}/10" >> $LOG
if (( $mem > 32 )); then
benchmark ${IMAGES}/unikraft+dyn.kernel ${LOG} $mem
else
benchmark ${IMAGES}/unikraft+dyn32.kernel ${LOG} $mem
fi
parse_boot_times $LOG $RESULTS $mem
done
done