forked from ThomasKaiser/sbc-bench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.snippets-for-insights.sh
executable file
·145 lines (135 loc) · 6.75 KB
/
.snippets-for-insights.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
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
135
136
137
138
139
140
141
142
143
144
145
#!/bin/bash
#
# some script snippets showing examples how to crawl through sbc-bench results collection
# check some results for memory performance (4 x ODROID XU4 here):
# for i in 1ixL 1iWL 1iLy 3GnC ; do echo -e "\n$(head -n1 $i.txt)" ; egrep '^ standard | 131072 | 4194304 | 67108864 ' $i.txt ; done
CPUUtilization7ZIP() {
# function that takes sbc-bench results in working directory ending with *.txt
# and parses them for 7-zip CPU utilization. Result is a markdown table
echo "| Device | cores | comp single | decomp single | comp multi | decomp multi |"
echo "| ----: | :----: | :----: | :----: | :----: | :----: |"
for file in *.txt ; do
Title="$(head -n1 "${file}" | sed -e 's/sbc-bench //' -e 's/Hardkernel //' -e 's/Xunlong //' -e 's/Raspberry Pi/RPi/' -e 's/ Model //' -e 's/\ (/(/' | cut -f1 -d'(')"
case ${Title} in
"v0.4 "*|*" : "*|"Distributor ID:"*|*AMD*|*Intel*|*extensive*)
# too old, skip
:
;;
*)
CPUs=$(awk -F" " '/CPU hardware threads: / {print $9}' <"${file}" | head -n1)
SinglePercentageComp=$(awk -F" " '/^Avr:/ {print $2}' <"${file}" | head -n1)
[ ${SinglePercentageComp:-0} -gt 100 ] && SinglePercentageComp="-"
SinglePercentageDecomp=$(awk -F" " '/^Avr:/ {print $6}' <"${file}" | head -n1)
[ ${SinglePercentageDecomp:-0} -gt 100 ] && SinglePercentageDecomp="-"
if [ ${CPUs} -eq 1 ]; then
MultiPercentageComp="-"
MultiPercentageDecomp="-"
else
CountofAverageScores=$(grep -c '^Avr:' "${file}")
if [ ${CountofAverageScores} -lt 4 ]; then
# something went wrong while benchmarking
MultiPercentageComp="-"
MultiPercentageDecomp="-"
else
# take last 3 7-zip scores
RawComp=$(grep '^Avr:' "${file}" | tail -n3 | awk -F" " '/^Avr:/ {s+=$2} END {printf "%.0f", s}')
MultiPercentageComp=$(( ${RawComp} / $(( ${CPUs} * 3 )) ))
RawDecomp=$(grep '^Avr:' "${file}" | tail -n3 | awk -F" " '/^Avr:/ {s+=$6} END {printf "%.0f", s}')
MultiPercentageDecomp=$(( ${RawDecomp} / $(( ${CPUs} * 3 )) ))
fi
fi
SoCName="$(awk -F": " '/^SoC guess/ {print $2}' "${file}")"
[ "X${SoCName}" = "X" ] || Title="$(cut -f1 -d' ' <<<"${Title}") ${SoCName}"
echo -e "| [${Title}](http://ix.io/${file%.*}) | ${CPUs} | ${SinglePercentageComp} | ${SinglePercentageDecomp} | ${MultiPercentageComp} | ${MultiPercentageDecomp} |"
;;
esac
done
} # CPUUtilization7ZIP
CheckRAID6PerfAndAlgo() {
# If you collected a bunch of armhwinfo files (fetched from ix.io)
# then you can do some sort of data mining with it, e.g. checking
# for the RAID algo and achieved MB/s the kernel chose.
# One use case of this collection is to determine best RAID6 PQ algo
# per ARM core family. Then adopting this kernel patch here:
# https://bugs.launchpad.net/ubuntu/+source/linux-gcp/+bug/1812728
# Then add e.g. CONFIG_RAID6_PQ_DEFAULT_ALG=neonx4 to kernel cmdline
# on boards with little cores (neonx8 seems best with A72/A73, neonx2
# with Cortex-A9 and so on). Would save approx. 1 second on each boot
# for every Armbian device out there. But since Armbian is now all
# about desktop and GUI there's no-one left caring about such details.
echo -e "# raid6 performance and algorithm\n"
echo -e "See function CheckRAID6PerfAndAlgo in https://github.com/ThomasKaiser/sbc-bench/blob/master/results/.snippets-for-insights.sh\n"
echo "| MB/s / algo | Board | Kernel | URL |"
echo "| :----- | :----: | :---- | :----|"
( ProcessARMhwinfo ; ProcessSBCbenchs ) | sort -n -r | grep "^[1-9][0-9]" | sed -e 's/^/| /'
} # CheckRAID6PerfAndAlgo
ProcessSBCbenchs() {
for file in *.txt ; do
RAID6Raw="$(grep -a 'using algorithm' $file | awk -F" " '{print $6" ("$4")"}')"
if [ "X${RAID6Raw}" != "X" ]; then
RAID6Perf=$(sort -n -r <<<"${RAID6Raw}" | head -n1)
BoardName="$(tail -n1 $file | awk -F"|" '{print $2}')"
[ "X${BoardName}" = "X" ] && BoardName="$(head -n1 $file | cut -f1 -d'(' | awk -F" " '{print $3" "$4" "$5}')"
KernelVersions="$(grep '^Linux ' $file | awk -F" " '{print $2}' | head -n1 | cut -f1 -d'-')"
URL="http://ix.io/${file%.*}"
case ${RAID6Perf} in
*neon*)
# filter out x86 and crappy kernel configs leaving out NEON support
echo -e "${RAID6Perf} | ${BoardName} | ${KernelVersions} | [${URL}](${URL}) |"
;;
esac
fi
echo -e ".\c" >&2
done
} # ProcessSBCbenchs
ProcessARMhwinfo() {
for file in *.armhwinfo ; do
RAID6Raw="$(grep -a 'using algorithm' $file | awk -F" " '{print $8" ("$6")"}')"
if [ "X${RAID6Raw}" != "X" ]; then
# dmesg output contains raid6 info, let's grab lowest/highest
RAID6Min=$(sort -n <<<"${RAID6Raw}" | head -n1)
RAID6Max=$(sort -n -r <<<"${RAID6Raw}" | head -n1)
PerfRelation="$(awk '{print $1/$2}' <<<"$(cut -f1 -d' ' <<<"${RAID6Max}") $(cut -f1 -d' ' <<<"${RAID6Min}")")"
if [ $(awk '{printf ("%0.0f",$1*100); }' <<<"${PerfRelation}") -lt 110 ]; then
# difference between lowest and highest less than 10% so don't bother
RAID6Perf="${RAID6Max}"
else
# report both values
RAID6Perf="${RAID6Max} / <span style=\"color:red\">**${RAID6Min}**</span>"
fi
BoardName="$(grep -a 'Machine model: ' $file | awk -F"model: " '{print $2}' | head -n1)"
[ "X${BoardName}" = "X" ] && BoardName="$(grep -a -B2 '### dmesg:' $file | cut -f2 -d'|' | head -n1)"
KernelVersions="$(grep -a -B2 '### dmesg:' $file | awk -F"|" '/\|/ {print $6}' | cut -f1 -d'-' | sort | uniq | tr '\n' '/' | sed -e 's/\ //g' -e 's/\/$//')"
URL="http://ix.io/${file%.*}"
echo -e "${RAID6Perf} | ${BoardName} | ${KernelVersions} | [${URL}](${URL}) |"
fi
echo -e ".\c" >&2
done
} # ProcessARMhwinfo
CheckThermalSources() {
grep "^Thermal source:" *.txt | while read ; do
URL="$(cut -f1 -d'.' <<<"${REPLY}")"
Board="$(tail -n1 ${URL}.txt | cut -f2 -d'|')"
echo " * [${Board}](http://ix.io/${URL})$(awk -F".txt" '{print $2}' <<<"${REPLY}")"
done
} # CheckThermalSources
CheckcpufreqVSdistro() {
for board in "Khadas VIM3" "Khadas VIM3L" "ODROID-N2" "ODROID-N2Plus" "Radxa ROCK 3 Model A" "Radxa ROCK 5B" ; do
echo -e "\n${board} "
grep "${board} " *.txt | cut -f1 -d':' | while read ; do
OSRelease="Armbian $(awk -F"=" '/^VERSION/ {print $2}' "${REPLY}")"
[ "X${OSRelease}" = "XArmbian " ] && OSRelease="Armbian $(awk -F"," '/^Armbian info/ {print $4}' "${REPLY}" | sed 's/\ //')"
[ "X${OSRelease}" = "XArmbian " ] && OSRelease="$(awk -F":" '/^Description/ {print $2}' "${REPLY}" | sed 's/\t//')"
Clockspeeds=$(tail -n1 "${REPLY}" | awk -F"|" '{print $3}')
if [ "x${Clockspeeds}" != "X" ]; then
echo ${OSRelease}: ${Clockspeeds}
else
A53=$(awk -F" " '/^ 0/ {print $5}' "${REPLY}")
A73=$(awk -F" " '/^ 2/ {print $5}' "${REPLY}")
echo ${OSRelease}: ${A53}/${A73} MHz
fi
done | sort
done
} # CheckcpufreqVSdistro
# CPUUtilization7ZIP >7-zip-cpu-utilisation.md
# CheckRAID6PerfAndAlgo >raid6-perf-and-algo.md