Skip to content

Commit

Permalink
v6.17
Browse files Browse the repository at this point in the history
+ Start of code for bench results:

DO NOT SET LIVE, in testing mode! https://github.com/Fourdee/DietPi/issues/1927
  • Loading branch information
Daniel Knight committed Sep 30, 2018
1 parent 02da1a8 commit d147010
Showing 1 changed file with 111 additions and 2 deletions.
113 changes: 111 additions & 2 deletions .meta/dietpi-survey_report
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
#!/bin/bash
# Created by Micha / [email protected] / dietpi.com

#-----------------------------------------------------------
#Globals - benchmarks
#-----------------------------------------------------------
G_HW_MODEL_MAX=100

aBENCH_INDEX=()
for (( i=0; i<$G_HW_MODEL_MAX; i++ ))
do

aBENCH_INDEX[$i]=0

done

#[$HW_MODEL,${aBENCH_INDEX[$HW_MODEL]}]
declare -A aBENCH_CPU
declare -A aBENCH_ROOTFS_WRITE
declare -A aBENCH_ROOTFS_READ
declare -A aBENCH_RAM_WRITE
declare -A aBENCH_RAM_READ
declare -A aBENCH_CPU_TEMP_START
declare -A aBENCH_CPU_TEMP_END

#Results
BC_SCALE=1
BENCH_RESULT_CPU_MIN=()
BENCH_RESULT_CPU_MAX=()
BENCH_RESULT_CPU_AVG=()

#-----------------------------------------------------------
#Globals - Survey
#-----------------------------------------------------------
SURVEY_COUNT_TOTAL=0
SURVEY_COUNT_EMPTY=0

Expand Down Expand Up @@ -301,17 +333,21 @@ aSOFTWARE_NAME6_17=()
for i in ${!aSOFTWARE_NAME6_16[@]}
do

aSOFTWARE_NAME6_17[$i]="${aSOFTWARE_NAME6_16[$i]}"
aSOFTWARE_NAME6_17[$i]="${aSOFTWARE_NAME6_16[$i]}"

done

#-----------------------------------------------------------
#Main
#-----------------------------------------------------------
# Copy files to RAM to speed up grep
#mkdir -p /tmp/dietpi-survey_report
#cp /home/dietpi-survey/survey/*.txt /tmp/dietpi-survey_report/ # /etc/cron.minutely/dietpi-survey_report: line 310: /bin/cp: Argument list too long
[[ -e /tmp/dietpi-survey_report ]] && rm -R /tmp/dietpi-survey_report
cp -R /home/dietpi-survey/survey /tmp/dietpi-survey_report

for file in /tmp/dietpi-survey_report/*.txt
#DEBUG | ONLY MY UPLOAD for testing
for file in /tmp/dietpi-survey_report/715d1a02-448b-4c12-bfee-c8fcd817fd32.*
do

# Filled and empty survey files
Expand All @@ -327,6 +363,23 @@ do
if grep -q '^#!/bin/bash' $file; then

. $file

# - Add bench to array
if [[ $BENCH_HW_MODEL ]]; then

aBENCH_CPU[$BENCH_HW_MODEL,${aBENCH_INDEX[$BENCH_HW_MODEL]}]=$BENCH_CPU
aBENCH_ROOTFS_WRITE[$BENCH_HW_MODEL,${aBENCH_INDEX[$BENCH_HW_MODEL]}]=$BENCH_ROOTFS_WRITE
aBENCH_ROOTFS_READ[$BENCH_HW_MODEL,${aBENCH_INDEX[$BENCH_HW_MODEL]}]=$BENCH_ROOTFS_READ
aBENCH_RAM_WRITE[$BENCH_HW_MODEL,${aBENCH_INDEX[$BENCH_HW_MODEL]}]=$BENCH_RAM_WRITE
aBENCH_RAM_READ[$BENCH_HW_MODEL,${aBENCH_INDEX[$BENCH_HW_MODEL]}]=$BENCH_RAM_READ
aBENCH_CPU_TEMP_START=[$BENCH_HW_MODEL,${aBENCH_INDEX[$BENCH_HW_MODEL]}]=$BENCH_CPU_TEMP_START
aBENCH_CPU_TEMP_END=[$BENCH_HW_MODEL,${aBENCH_INDEX[$BENCH_HW_MODEL]}]=$BENCH_CPU_TEMP_END

((aBENCH_INDEX[$BENCH_HW_MODEL]++))
unset BENCH_HW_MODEL

fi

continue

fi
Expand Down Expand Up @@ -403,6 +456,62 @@ do

done

#Bench Results, HW_MODEL array:
for (( i=0; i<$G_HW_MODEL_MAX; i++ ))
do

#init results
BENCH_RESULT_CPU_MIN[$i]=10000
BENCH_RESULT_CPU_MAX[$i]=0
BENCH_RESULT_CPU_AVG[$i]=0

#echo ${aBENCH_INDEX[$i]}
for (( j=0; j<${aBENCH_INDEX[$i]}; j++ ))
do

echo ${aBENCH_CPU[$i,$j]}
if (( $(bc -l <<< "scale=$BC_SCALE; ${aBENCH_CPU[$i,$j]} < ${BENCH_RESULT_CPU_MIN[$i]}") )); then

BENCH_RESULT_CPU_MIN[$i]=${aBENCH_CPU[$i,$j]}

fi
if (( $(bc -l <<< "scale=$BC_SCALE; ${aBENCH_CPU[$i,$j]} > ${BENCH_RESULT_CPU_MAX[$i]}") )); then

BENCH_RESULT_CPU_MAX[$i]=${aBENCH_CPU[$i,$j]}

fi

# - Count up averages
BENCH_RESULT_CPU_AVG[$i]=$(bc -l <<< "${aBENCH_CPU[$i,$j]} + ${BENCH_RESULT_CPU_AVG[$i]}")

# - DEBUG
echo ${aBENCH_ROOTFS_WRITE[$i,$j]}
echo ${aBENCH_ROOTFS_READ[$i,$j]}
echo ${aBENCH_RAM_WRITE[$i,$j]}
echo ${aBENCH_RAM_READ[$i,$j]}
echo ${aBENCH_CPU_TEMP_START[$i,$j]}
echo ${aBENCH_CPU_TEMP_END[$i,$j]}
# - DEBUG

# - Work out averages
if (( $j == ${aBENCH_INDEX[$i]} - 1 )); then

BENCH_RESULT_CPU_AVG[$i]=$(bc -l <<< "scale=$BC_SCALE; ${BENCH_RESULT_CPU_AVG[$i]} / ${aBENCH_INDEX[$i]}")

#DEBUG
echo -e "BENCH_RESULT_CPU_AVG $i = ${BENCH_RESULT_CPU_AVG[$i]}"
#DEBUG

fi

done

done

#DEBUG
exit
#DEBUG

cat << _EOF_ > /var/www/survey/index.html
<html>
<head>
Expand Down

0 comments on commit d147010

Please sign in to comment.