Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 61 lines (50 sloc) 1.7 KB
#!/bin/bash
# location of files on physical disk and where results will be written
test_path="~"
# where to do the test - using tmpfs is HIGHLY recommended
ramdisk="/scratch/bench"
# name of the dir containing the preconfigured linux source
source="linux-4.9"
# number of times to run echo benchmark
limit="36"
# number of make flags which should be one more than the physical+virtual cores
MAKEFLAGS="9"
NAME=$(uname -r)
#####
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,$RUNDATE,$HOSTNAME,$MAKEFLAGS,$NAME,$diff,$BENCH" >> "$test_path/results.csv"
}
do_make() {
BENCH=make
echo "Running Make..."
[[ ! -d $ramdisk/$source ]] &&
tar xf "$test_path/$source.tar" -C "$ramdisk"
cd "$ramdisk/$source" || exit
x=0
while [[ "$x" -lt "$limit" ]]; do
x=$(( x + 1 ))
make clean &>/dev/null
RUNDATE=$(date "+%F %T")
start=$(date +%s.%N)
make -j"$MAKEFLAGS" bzImage &>/dev/null
finish=$(date +%s.%N)
calc
done
rm -rf "$ramdisk/$source"
}
XSRUNNING=$(pidof xscreensaver)
[[ -n "$XSRUNNING" ]] && kill "$XSRUNNING"
[[ -z $(which bc) ]] && echo "Install bc to allow calculations." && exit 0
[[ -z $(which gcc) ]] && echo "Install base-devel group to allow for make benchmark." && exit 0
[[ ! -d "$ramdisk" ]] && mkdir -p "$ramdisk"
[[ ! -f "$test_path"/results.csv ]] &&
echo "run #,run date,hostname,makeflags,kernel,time(sec),benchmark" \
> "$test_path/results.csv"
do_make