forked from hamishcunningham/pi-tronics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdobm.sh
executable file
·88 lines (68 loc) · 2.39 KB
/
dobm.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
#!/bin/bash
# needs Raspberry_Pi_Benchmarks.zip from http://www.raspberrypi.org/phpBB3/viewtopic.php?t=44080&p=374054
# specifically dhry.h dhry_2.c cpuidh.h cpuidc.c whets.c dhry_1.c
# iperf, hdparm, lame, bzip2 should also be installed
# also need a audiodump.wav file for the practical benchmarks
# and then of course configure the settings below...
# compiler options
CFLAGS="-march=native"
#CFLAGS="-march=armv6"
#CFLAGS="-march=armv6 -mfloat-abi=hard -mfpu=vfp"
# hard disk to benchmark
DRIVE="/dev/sdi"
# remote host running iperf -s for network benchmarking
REMOTE="192.168.1.64"
# log file of results
LOGFILE="bm.log"
# program start!
date | tee -a "$LOGFILE"
echo "Checking for executables..." | tee -a "$LOGFILE"
for exe in iperf hdparm lame bzip2
do
which $exe 2>>"$LOGFILE" 1>>"$LOGFILE"
if [ $? -ne 0 ]
then
echo "$exe not found!" | tee -a "$LOGFILE"
exit 1
fi
done
echo "Checking for datafiles..." | tee -a "$LOGFILE"
for fil in audiodump.wav dhry.h dhry_2.c cpuidh.h cpuidc.c whets.c dhry_1.c
do
if [ ! -e $fil ]
then
echo "$fil not found!" | tee -a "$LOGFILE"
exit 1
fi
done
echo "Compiling benchmarks..." | tee -a "$LOGFILE"
gcc dhry_1.c dhry_2.c cpuidc.c -lm -lrt -O3 $CFLAGS -o dhry 2>>"$LOGFILE" 1>>"$LOGFILE"
gcc whets.c cpuidc.c -lm -lrt -O3 $CFLAGS -o whet 2>>"$LOGFILE" 1>>"$LOGFILE"
if [ ! -x dhry ] || [ ! -x whet ]
then
echo "Failed compiling!" | tee -a "$LOGFILE"
exit 1
fi
echo "Starting benchmarks..." | tee -a "$LOGFILE"
echo ""
for C in 1 2 3
do
echo "Benchmark trial $C..." | tee -a "$LOGFILE"
echo " IO Networking $C..." | tee -a "$LOGFILE"
iperf -c "$REMOTE" 2>>"$LOGFILE" 1>>"$LOGFILE"
echo " IO HD $C..." | tee -a "$LOGFILE"
hdparm -tT "$DRIVE" 2>>"$LOGFILE" 1>>"$LOGFILE"
echo " Theoretical Dhrystone $C..." | tee -a "$LOGFILE"
echo "" | ./dhry 2>>"$LOGFILE" 1>>"$LOGFILE"
echo " Theoretical Whetsone $C..." | tee -a "$LOGFILE"
echo "" | ./whet 2>>"$LOGFILE" 1>>"$LOGFILE"
echo " Practical bzip2 $C..." | tee -a "$LOGFILE"
echo 1 > /proc/sys/vm/drop_caches
bash -c "time bzip2 -fk audiodump.wav" 2>>"$LOGFILE" 1>>"$LOGFILE"
echo " Practical lame $C..." | tee -a "$LOGFILE"
echo 1 > /proc/sys/vm/drop_caches
bash -c "time lame -S audiodump.wav" 2>>"$LOGFILE" 1>>"$LOGFILE"
done
echo "Benchmarks complete." | tee -a "$LOGFILE"
date | tee -a "$LOGFILE"
# all done!