forked from hckuo2/Cozart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjob.sh
executable file
·155 lines (138 loc) · 5.72 KB
/
job.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/bin/bash
source constant.sh
trace() {
make toggle-trace-mode
for app in $@; do
echo "Tracing $app"
make clean
if [[ $app == "boot" ]]; then
./trace-kernel.sh /benchmark-scripts/$app.sh;
else
./trace-kernel.sh /benchmark-scripts/$app.sh local;
fi
mkdir -p config-db/$linux/$base
cp final.config.tmp config-db/$linux/$base/$app.config
done
}
decompose_app() {
# this function is a helper for application stacks and has no effect for
# single application
echo $1 | tr '+' ' '
}
compose() {
for app in $@; do
echo "Aggregate $app"
# ./aggregate-config.sh \
# config-db/$linux/$base/base.config \
# config-db/$linux/$base/base-choice.config \
# config-db/$linux/$base/disable.config \
# config-db/$linux/$base/boot.config \
# $(locate_config_file $(decompose_app $app))
./aggregate-config.sh \
-a $app \
config-db/$linux/$base/base.config \
config-db/$linux/$base/base-choice.config \
config-db/$linux/$base/disable.config \
config-db/$linux/$base/boot.config \
$(locate_config_file $(decompose_app $app))
cd $linux
make clean
make -j`nproc` LOCALVERSION=-$linux-$base-$app
mkdir -p $kernelbuild/$linux/$base/$app
INSTALL_PATH=$kernelbuild/$linux/$base/$app make install
INSTALL_MOD_PATH=$kernelbuild/$linux/$base/$app make modules_install
cd $workdir
make install-kernel-modules
done
find $kernelbuild -iname "*.old" | xargs rm -f
}
compose-fc() {
for app in $@; do
appconfig=$(mktemp)
trap "rm $appconfig" EXIT
cat $workdir/config-db/$linux/$base/$app.config \
| ./appconfiglet_filter.sh > $appconfig
cd $linux
make -j`nproc` mrproper
./scripts/kconfig/merge_config.sh -n \
$workdir/config-db/hypervisors/fc.config $appconfig
make -j`nproc` LOCALVERSION=-fc-$app
mkdir -p $kernelbuild/fc/$app
cp vmlinux $kernelbuild/fc/$app
INSTALL_PATH=$kernelbuild/fc/$app make install
INSTALL_MOD_PATH=$kernelbuild/fc/$app make modules_install
cd $workdir
done
find $kernelbuild -iname "*.old" | xargs rm -f
}
benchmark() {
make toggle-benchmark-mode
for app in $@; do
echo "Benchmark $app on cozarted kernel"
$qemubin -cpu $cpu -enable-kvm -smp $cores -m $mem \
-kernel $kernelbuild/$linux/$base/$app/vmlinuz* \
-drive file="$(pwd)/qemu-disk.ext4",if=ide,format=raw \
-nographic -no-reboot \
-append "panic=-1 console=ttyS0 root=/dev/sda rw init=/benchmark-scripts/$app.sh" \
> ./test/$app/$app.cozart.benchresult;
echo "Benchmark $app on base kernel"
$qemubin -cpu $cpu -enable-kvm -smp $cores -m $mem \
-kernel $kernelbuild/$linux/$base/base/vmlinuz* \
-drive file="$(pwd)/qemu-disk.ext4",if=ide,format=raw \
-nographic -no-reboot \
-append "panic=-1 console=ttyS0 root=/dev/sda rw init=/benchmark-scripts/$app.sh" \
> ./test/$app/$app.base.benchresult;
done
}
# measure the boot time of kernel
boot-time() {
make toggle-benchmark-mode
itr=10
for app in $@; do
> ./test/$app/$app.cozart.boot-time
> ./test/$app/$app.base.boot-time
# echo "Boot-time $app on cozarted kernel"
for i in `seq $itr`; do
echo "$i-th boot"
$qemubin -cpu $cpu -enable-kvm -smp $cores -m $mem \
-kernel $kernelbuild/$linux/$base/$app/vmlinuz* \
-drive file="$(pwd)/qemu-disk.ext4",if=ide,format=raw \
-nographic -no-reboot \
-append "panic=-1 console=ttyS0 root=/dev/sda rw init=/benchmark-scripts/boot-time.sh cozart" \
| grep "Boot cozart" >> ./test/$app/$app.cozart.boot-time;
$qemubin -cpu $cpu -enable-kvm -smp $cores -m $mem \
-kernel $kernelbuild/$linux/$base/base/vmlinuz* \
-drive file="$(pwd)/qemu-disk.ext4",if=ide,format=raw \
-nographic -no-reboot \
-append "panic=-1 console=ttyS0 root=/dev/sda rw init=/benchmark-scripts/boot-time.sh baseline" \
| grep "Boot baseline" >> ./test/$app/$app.base.boot-time;
done
awk '{ sum += $4; n++ } END { if (n > 0) print "avg boot-time = ", sum / n; }' ./test/$app/$app.cozart.boot-time >> ./test/$app/$app.cozart.boot-time
awk '{ sum += $4; n++ } END { if (n > 0) print "avg boot-time = ", sum / n; }' ./test/$app/$app.base.boot-time >> ./test/$app/$app.base.boot-time
done
}
# measure the boot time of kernel
mem-usage() {
make toggle-benchmark-mode
for app in $@; do
echo "Mem-usage $app on cozarted kernel"
$qemubin -cpu $cpu -enable-kvm -smp $cores -m $mem \
-kernel $kernelbuild/$linux/$base/$app/vmlinuz* \
-drive file="$(pwd)/qemu-disk.ext4",if=ide,format=raw \
-nographic -no-reboot \
-append "panic=-1 console=ttyS0 root=/dev/sda rw init=/benchmark-scripts/mem-usage.sh cozart" \
;
# > $app.cozart.benchresult;
echo "Mem-usage $app on base kernel"
$qemubin -cpu $cpu -enable-kvm -smp $cores -m $mem \
-kernel $kernelbuild/$linux/$base/base/vmlinuz* \
-drive file="$(pwd)/qemu-disk.ext4",if=ide,format=raw \
-nographic -no-reboot \
-append "panic=-1 console=ttyS0 root=/dev/sda rw init=/benchmark-scripts/mem-usage.sh baseline" \
;
# > $app.base.benchresult;
done
}
action=$1
shift
$action $@;