-
Notifications
You must be signed in to change notification settings - Fork 1
/
bench
executable file
·52 lines (43 loc) · 1.4 KB
/
bench
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
#!/bin/bash
# vim:set ts=2 sw=2 et:
# location of files on physical disk and where results will be written
test_path="$HOME"
# where to do the test - using tmpfs is HIGHLY recommended
ramdisk="/scratch"
# name of the dir containing the preconfigured linux source
source="linux-4.4.260"
# number of times to run benchmark
limit="9"
#####
[[ ! -d "$ramdisk" ]] && mkdir -p "$ramdisk"
[[ ! -f "$test_path"/results.csv ]] && echo "n,diff (sec),run date" > "$test_path"/results.csv
calc() {
diff=$(echo "scale=6; $finish - $start" | bc)
simpdiff=$(echo "scale=2; $finish - $start" | bc)
runsleft=$(echo "scale=2; $limit-$x"| bc)
secleft=$(echo "scale=2; $runsleft*$diff"|bc)
minleft=$(echo "scale=2; $runsleft*$diff/60"|bc)
eta=$(date -d "($date) $secleft sec" +%r)
echo "Run $x/$limit took $simpdiff seconds. ETA: $eta or about $minleft min from now."
echo "$x,$diff,$RUNDATE,xxx" >> "$test_path/results.csv"
}
do_make() {
[[ ! -d $ramdisk/$source ]] && tar axf "$test_path/$source.tar" -C "$ramdisk"
cd "$ramdisk/$source" || exit
x=0
# n= limit for each makeflag
while [[ "$x" -lt "$limit" ]]; do
x=$(( x + 1 ))
make -j9 clean &>/dev/null
RUNDATE=$(date "+%F %T")
start=$(date +%s.%N)
unset DISTCC_HOSTS
export DISTCC_HOSTS=""
sleep 1s
make -j bzImage &>/dev/null
#make -j"$i" bzImage CC=distcc CXX=distcc &>/dev/null
finish=$(date +%s.%N)
calc
done
}
do_make