-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscore
More file actions
executable file
·134 lines (116 loc) · 4.28 KB
/
score
File metadata and controls
executable file
·134 lines (116 loc) · 4.28 KB
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/bash
#MINI CPU INTEGER BENCHMARK SCRIPT v1.2
#CREATED BY BROODPLANK
#PLEASE READ
#SCRIPT REQUIRES ADB CONNECTION, BUSYBOX AND ROOT ON PHONE
#INSTALLATION ON DEVICE: ./score --install
# Launch when --install as param is given
if [[ $1 = "--install" ]]; then
echo "Installing on device..."
adb root
busybox sleep 1
adb remount
adb push files/bc /system/bin/bc
adb shell 'chmod 755 /system/bin/bc'
adb push files/run /system/bin/run
adb shell 'chmod 755 /system/bin/run'
adb push files/run2 /system/bin/run2
adb shell 'chmod 755 /system/bin/run2'
adb push files/score /system/bin/score
adb shell 'chmod 755 /system/bin/score'
echo "Done!"
echo
echo "To launch benchmark:"
echo "1. Relaunch without the '--install' parameter to benchmark from PC"
echo "2. Execute 'score' from Terminal Emulator on device"
exit
fi;
# Header
echo "Mini CPU Integer benchmark (by broodplank)"
echo
echo "Waiting for device (Make sure USB debugging is enabled)"
adb wait-for-device
export DEVICE=`adb shell "cat /system/build.prop | grep ro.build.product | sed -e 's|ro.build.product=||g' | tail -1"`
export BOARD=`adb shell "cat /system/build.prop | grep ro.board.platform | sed -e 's|ro.board.platform=||g' | tail -1"`
export CPUSPEED=`adb shell "cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq"`
echo "Device with ADB connection been found, continuing"
echo
echo "Starting Benchmark"
echo
# Single thread tests
echo "--> CPU single thread integer test"
echo -n "-- First run: "
adb shell "busybox time -p '/system/bin/run'" | grep real | sed -e 's|real ||g' > cpu1s
cat cpu1s
echo -n "-- Second run: "
adb shell "busybox time -p '/system/bin/run'" | grep real | sed -e 's|real ||g' > cpu2s
cat cpu2s
echo -n "-- Third run: "
adb shell "busybox time -p '/system/bin/run'" | grep real | sed -e 's|real ||g' > cpu3s
cat cpu3s
# Get average time elapsed
echo -n "- Average: "
paste -sd+ cpu1s cpu2s cpu3s > sscore
rm cpu1s cpu2s cpu3s
awk '{s+=$1} END {print s}' sscore > sscorefinal
rm sscore
export READSAVERAGE=`cat sscorefinal`
export READSCORE1=`echo $READSAVERAGE / 3 | bc -l`
echo $READSCORE1 | awk '{printf("%.2f\n", $1)}' > score1final
cat score1final
# Multi thread tests
echo
echo "--> CPU multi thread integer test"
echo -n "-- First run: "
adb shell "busybox time -p '/system/bin/run2'" | grep real | sed -e 's|real ||g' > mcpu1s
cat mcpu1s
echo -n "-- Second run: "
adb shell "busybox time -p '/system/bin/run2'" | grep real | sed -e 's|real ||g' > mcpu2s
cat mcpu2s
echo -n "-- Third run: "
adb shell "busybox time -p '/system/bin/run2'" | grep real | sed -e 's|real ||g' > mcpu3s
cat mcpu3s
# Get average time elapsed
echo -n "- Average: "
paste -sd+ mcpu1s mcpu2s mcpu3s > mscore
rm mcpu1s mcpu2s mcpu3s
awk '{s+=$1} END {print s}' mscore > mscorefinal
rm mscore
export READSMAVERAGE=`cat mscorefinal`
export READSCORE2=`echo $READSMAVERAGE / 3 | bc -l`
echo $READSCORE2 | awk '{printf("%.2f\n", $1)}' > score2final
cat score2final
# Count up score
echo
paste -sd+ score1final score2final > totalscoretemp
awk '{s+=$1} END {print s}' totalscoretemp > totalscore
export TOTALSCORE=`cat totalscore`
echo -n "- Final score: $TOTALSCORE - "
# Show fitting message
if (( $(echo "$TOTALSCORE < 5" | bc -l) )); then
echo "'WOW! Your CPU is blazing fast! Are you sure it's not a PC?'"
fi;
if (( $(echo "$TOTALSCORE > 5 && $TOTALSCORE < 10" | bc -l) )); then
echo "'Very nice, your CPU is somewhere near the top models range'"
fi;
if (( $(echo "$TOTALSCORE > 10 && $TOTALSCORE < 15" | bc -l) )); then
echo "'Nice, your CPU speed is above average (first gen quad core)'"
fi;
if (( $(echo "$TOTALSCORE > 15 && $TOTALSCORE < 20" | bc -l) )); then
echo "'Pretty good, your device is most likely a dual core'"
fi;
if (( $(echo "$TOTALSCORE > 20 && $TOTALSCORE < 25" | bc -l) )); then
echo "'Decent, You probably have one of the first dual cores'"
fi;
if (( $(echo "$TOTALSCORE > 25 && $TOTALSCORE < 30" | bc -l) )); then
echo "'Hmmm, You must be running one of the first smartphones'"
fi;
if (( $(echo "$TOTALSCORE > 30" | bc -l) )); then
echo "'Are you sure you haven't bought an abacus instead of a smartphone?'"
fi;
# Bump device model, board and max cpu freq
echo "- Device: $DEVICE"
echo "- Board: $BOARD"
echo "- MAX CPU Freq: $CPUSPEED"
# Remove leftovers
rm sscorefinal mscorefinal totalscore totalscoretemp score1final score2final