Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
graysky
executable file 108 lines (97 sloc) 3.934 kb
#!/bin/bash
test_path="/mnt/data/bench" # location of files on physical disk
ramdisk="/scratch/bench" # where to do the test - select a ramdisk to min hdd usage
source="linux-3.6.9" # name of the dir containing the preconfigured linux source
limit="37" # number of times to run echo benchmark
PHYSICALCORES="4" # number of physical cores NOT counting hyperthreads ones
MAKEFLAGS="8" # number of make flags which should be one more than the physical+virtual cores
NAME=$(uname -r)
#####
do_make() {
BENCH=make
echo "Running Make..."
[[ ! -d $ramdisk/$source ]] ; tar xf $test_path/$source.tar -C $ramdisk
cd "$ramdisk/$source"
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
end=$(date +%s.%N)
diff=$(echo "scale=6; $end - $start" | bc)
simpdiff=$(echo "scale=2; $end - $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.txt
done
cd $ramdisk && rm -rf $ramdisk/$source # cleanup
}
do_video() {
BENCH=video
echo "Running video..."
rsync -ax $test_path/2m-720p.mpg $ramdisk
cd $ramdisk
x=0
while [ "$x" -lt "$limit" ]; do
x=$(( $x + 1 ))
RUNDATE=$(date "+%F %T")
start=$(date +%s.%N)
#360p video for iphones
ffmpeg -i 2m-720p.mpg -vcodec libx264 -vprofile baseline -preset slow -b:v 250k -maxrate 250k -bufsize 500k -vf scale=-1:360 -threads 0 -acodec copy out.mp4
end=$(date +%s.%N)
diff=$(echo "scale=6; $end - $start" | bc)
simpdiff=$(echo "scale=2; $end - $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,$PHYSICALCORES,$NAME,$diff,$BENCH" >> "$test_path"/results.txt
rm -f out.mp4
done
rm -f $ramdisk/2m-720p.mpg # cleanup
}
do_compress() {
BENCH=compress
echo "Running compress..."
[[ ! -f $ramdisk/$source.tar ]] ; cp $test_path/$source.tar $ramdisk
cd "$ramdisk"
x=0
while [ "$x" -lt "$limit" ]; do
x=$(( $x + 1 ))
RUNDATE=$(date "+%F %T")
start=$(date +%s.%N)
lrzip $source.tar
end=$(date +%s.%N)
diff=$(echo "scale=6; $end - $start" | bc)
simpdiff=$(echo "scale=2; $end - $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,$PHYSICALCORES,$NAME,$diff,$BENCH" >> $test_path/results.txt
rm -f $ramdisk/$source.tar.lrz
done
rm -f $ramdisk/$source.tar # cleanup
}
XSRUNNING=$(pidof xscreensaver)
[[ -n "$XSRUNNING" ]] && kill "$XSRUNNING"
[[ -z $(which bc) ]] && echo "Install bc to allow calculations." && exit 0
[[ -z $(which ffmpeg) ]] && echo "Install ffmpeg to allow for video benchmark." && exit 0
[[ -z $(which lrzip) ]] && echo "Install lrzip to allow for compression benchmark." && 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.txt ]] && echo "run #,run date,hostname,physical cores/threads,kernel,time(sec),benchmark" > $test_path/results.txt
case "$1" in
compress) do_compress ;;
video) do_video ;;
make) do_make ;;
all) do_compress ; do_make ; do_video ;;
*) echo "Usage: $0 {pics|video|make|compress|all}" ; exit 0 ;;
esac
Jump to Line
Something went wrong with that request. Please try again.