-
Notifications
You must be signed in to change notification settings - Fork 10
/
job.sh
executable file
·93 lines (82 loc) · 2.9 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
#!/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))
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" \
> $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" \
> $app.base.benchresult;
done
}
action=$1
shift
$action $@;