From a1f9a095666e7bbf5c484dd3fe58410255ddd8c2 Mon Sep 17 00:00:00 2001 From: Daniel Knight Date: Sun, 7 Oct 2018 07:01:01 +0100 Subject: [PATCH] v6.17 + 'N/A': https://github.com/Fourdee/DietPi/issues/1927#issuecomment-427596500 --- .meta/dietpi-survey_report | 94 ++++++++++++++++++++++---------------- dietpi/func/dietpi-globals | 2 +- 2 files changed, 56 insertions(+), 40 deletions(-) diff --git a/.meta/dietpi-survey_report b/.meta/dietpi-survey_report index d5a83e43f1..1dbbdbe25e 100644 --- a/.meta/dietpi-survey_report +++ b/.meta/dietpi-survey_report @@ -570,44 +570,47 @@ done #Bench Results, HW_MODEL array: + local default_min_value=100000 for (( i=0; i<=$G_HW_MODEL_MAX; i++ )) do + local hw_model_supports_cpu_temps=1 + if [[ ${aBENCH_INDEX[$i]} ]]; then #init results - aBENCH_RESULT_CPU_MIN[$i]=10000 + aBENCH_RESULT_CPU_MIN[$i]=$default_min_value aBENCH_RESULT_CPU_MAX[$i]=0 aBENCH_RESULT_CPU_AVG[$i]=0 - aBENCH_RESULT_ROOTFS_WRITE_MIN[$i]=10000 + aBENCH_RESULT_ROOTFS_WRITE_MIN[$i]=$default_min_value aBENCH_RESULT_ROOTFS_WRITE_MAX[$i]=0 aBENCH_RESULT_ROOTFS_WRITE_AVG[$i]=0 - aBENCH_RESULT_ROOTFS_READ_MIN[$i]=10000 + aBENCH_RESULT_ROOTFS_READ_MIN[$i]=$default_min_value aBENCH_RESULT_ROOTFS_READ_MAX[$i]=0 aBENCH_RESULT_ROOTFS_READ_AVG[$i]=0 - aBENCH_RESULT_RAM_WRITE_MIN[$i]=10000 + aBENCH_RESULT_RAM_WRITE_MIN[$i]=$default_min_value aBENCH_RESULT_RAM_WRITE_MAX[$i]=0 aBENCH_RESULT_RAM_WRITE_AVG[$i]=0 - aBENCH_RESULT_RAM_READ_MIN[$i]=10000 + aBENCH_RESULT_RAM_READ_MIN[$i]=$default_min_value aBENCH_RESULT_RAM_READ_MAX[$i]=0 aBENCH_RESULT_RAM_READ_AVG[$i]=0 - aBENCH_RESULT_CPU_TEMP_START_MIN[$i]=10000 + aBENCH_RESULT_CPU_TEMP_START_MIN[$i]=$default_min_value aBENCH_RESULT_CPU_TEMP_START_MAX[$i]=0 aBENCH_RESULT_CPU_TEMP_START_AVG[$i]=0 - aBENCH_RESULT_CPU_TEMP_END_MIN[$i]=10000 + aBENCH_RESULT_CPU_TEMP_END_MIN[$i]=$default_min_value aBENCH_RESULT_CPU_TEMP_END_MAX[$i]=0 aBENCH_RESULT_CPU_TEMP_END_AVG[$i]=0 - #echo ${aBENCH_INDEX[$i]} for (( j=0; j<${aBENCH_INDEX[$i]}; j++ )) do + #CPU # echo -e "aBENCH_CPU[$i,$j] ${aBENCH_CPU[$i,$j]}" if (( $(bc -l <<< "${aBENCH_CPU[$i,$j]} < ${aBENCH_RESULT_CPU_MIN[$i]}") )); then @@ -621,6 +624,7 @@ fi aBENCH_RESULT_CPU_AVG[$i]=$(bc -l <<< "${aBENCH_CPU[$i,$j]} + ${aBENCH_RESULT_CPU_AVG[$i]}") + #RootFS # echo -e "aBENCH_ROOTFS_WRITE[$i,$j] ${aBENCH_ROOTFS_WRITE[$i,$j]}" if (( $(bc -l <<< "${aBENCH_ROOTFS_WRITE[$i,$j]} < ${aBENCH_RESULT_ROOTFS_WRITE_MIN[$i]}") )); then @@ -647,6 +651,7 @@ fi aBENCH_RESULT_ROOTFS_READ_AVG[$i]=$(bc -l <<< "${aBENCH_ROOTFS_READ[$i,$j]} + ${aBENCH_RESULT_ROOTFS_READ_AVG[$i]}") + #RAM # echo -e "aBENCH_RAM_WRITE[$i,$j] ${aBENCH_RAM_WRITE[$i,$j]}" if (( $(bc -l <<< "${aBENCH_RAM_WRITE[$i,$j]} < ${aBENCH_RESULT_RAM_WRITE_MIN[$i]}") )); then @@ -673,32 +678,40 @@ fi aBENCH_RESULT_RAM_READ_AVG[$i]=$(bc -l <<< "${aBENCH_RAM_READ[$i,$j]} + ${aBENCH_RESULT_RAM_READ_AVG[$i]}") + #CPU temp # echo -e "aBENCH_CPU_TEMP_START[$i,$j] ${aBENCH_CPU_TEMP_START[$i,$j]}" - if (( $(bc -l <<< "${aBENCH_CPU_TEMP_START[$i,$j]} < ${aBENCH_RESULT_CPU_TEMP_START_MIN[$i]}") )); then + if ! grep -q '^[0-9]' <<< ${aBENCH_CPU_TEMP_START[$i,$j]}; then - aBENCH_RESULT_CPU_TEMP_START_MIN[$i]=${aBENCH_CPU_TEMP_START[$i,$j]} + hw_model_supports_cpu_temps=0 - fi - if (( $(bc -l <<< "${aBENCH_CPU_TEMP_START[$i,$j]} > ${aBENCH_RESULT_CPU_TEMP_START_MAX[$i]}") )); then + else - aBENCH_RESULT_CPU_TEMP_START_MAX[$i]=${aBENCH_CPU_TEMP_START[$i,$j]} + if (( $(bc -l <<< "${aBENCH_CPU_TEMP_START[$i,$j]} < ${aBENCH_RESULT_CPU_TEMP_START_MIN[$i]}") )); then - fi - aBENCH_RESULT_CPU_TEMP_START_AVG[$i]=$(bc -l <<< "${aBENCH_CPU_TEMP_START[$i,$j]} + ${aBENCH_RESULT_CPU_TEMP_START_AVG[$i]}") + aBENCH_RESULT_CPU_TEMP_START_MIN[$i]=${aBENCH_CPU_TEMP_START[$i,$j]} - # echo -e "aBENCH_CPU_TEMP_END[$i,$j] ${aBENCH_CPU_TEMP_END[$i,$j]}" - if (( $(bc -l <<< "${aBENCH_CPU_TEMP_END[$i,$j]} < ${aBENCH_RESULT_CPU_TEMP_END_MIN[$i]}") )); then + fi + if (( $(bc -l <<< "${aBENCH_CPU_TEMP_START[$i,$j]} > ${aBENCH_RESULT_CPU_TEMP_START_MAX[$i]}") )); then - aBENCH_RESULT_CPU_TEMP_END_MIN[$i]=${aBENCH_CPU_TEMP_END[$i,$j]} + aBENCH_RESULT_CPU_TEMP_START_MAX[$i]=${aBENCH_CPU_TEMP_START[$i,$j]} - fi - if (( $(bc -l <<< "${aBENCH_CPU_TEMP_END[$i,$j]} > ${aBENCH_RESULT_CPU_TEMP_END_MAX[$i]}") )); then + fi + aBENCH_RESULT_CPU_TEMP_START_AVG[$i]=$(bc -l <<< "${aBENCH_CPU_TEMP_START[$i,$j]} + ${aBENCH_RESULT_CPU_TEMP_START_AVG[$i]}") - aBENCH_RESULT_CPU_TEMP_END_MAX[$i]=${aBENCH_CPU_TEMP_END[$i,$j]} + # echo -e "aBENCH_CPU_TEMP_END[$i,$j] ${aBENCH_CPU_TEMP_END[$i,$j]}" + if (( $(bc -l <<< "${aBENCH_CPU_TEMP_END[$i,$j]} < ${aBENCH_RESULT_CPU_TEMP_END_MIN[$i]}") )); then - fi - aBENCH_RESULT_CPU_TEMP_END_AVG[$i]=$(bc -l <<< "${aBENCH_CPU_TEMP_END[$i,$j]} + ${aBENCH_RESULT_CPU_TEMP_END_AVG[$i]}") + aBENCH_RESULT_CPU_TEMP_END_MIN[$i]=${aBENCH_CPU_TEMP_END[$i,$j]} + + fi + if (( $(bc -l <<< "${aBENCH_CPU_TEMP_END[$i,$j]} > ${aBENCH_RESULT_CPU_TEMP_END_MAX[$i]}") )); then + + aBENCH_RESULT_CPU_TEMP_END_MAX[$i]=${aBENCH_CPU_TEMP_END[$i,$j]} + fi + aBENCH_RESULT_CPU_TEMP_END_AVG[$i]=$(bc -l <<< "${aBENCH_CPU_TEMP_END[$i,$j]} + ${aBENCH_RESULT_CPU_TEMP_END_AVG[$i]}") + + fi # - DEBUG # echo ${aBENCH_ROOTFS_WRITE[$i,$j]} # echo ${aBENCH_ROOTFS_READ[$i,$j]} @@ -708,7 +721,7 @@ # echo ${aBENCH_CPU_TEMP_END[$i,$j]} # - DEBUG - # - Last item in current array. Work out averages + #Last item in current array. Work out averages if (( $j == ${aBENCH_INDEX[$i]} - 1 )); then aBENCH_RESULT_CPU_AVG[$i]=$(bc -l <<< "scale=$BENCH_RESULTS_CPU_SCALE; ${aBENCH_RESULT_CPU_AVG[$i]} / ${aBENCH_INDEX[$i]}") @@ -716,32 +729,35 @@ aBENCH_RESULT_ROOTFS_READ_AVG[$i]=$(bc -l <<< "scale=$BENCH_RESULTS_FILESYSTEM_SCALE; ${aBENCH_RESULT_ROOTFS_READ_AVG[$i]} / ${aBENCH_INDEX[$i]}") aBENCH_RESULT_RAM_WRITE_AVG[$i]=$(bc -l <<< "scale=$BENCH_RESULTS_FILESYSTEM_SCALE; ${aBENCH_RESULT_RAM_WRITE_AVG[$i]} / ${aBENCH_INDEX[$i]}") aBENCH_RESULT_RAM_READ_AVG[$i]=$(bc -l <<< "scale=$BENCH_RESULTS_FILESYSTEM_SCALE; ${aBENCH_RESULT_RAM_READ_AVG[$i]} / ${aBENCH_INDEX[$i]}") - aBENCH_RESULT_CPU_TEMP_START_AVG[$i]=$(bc -l <<< "scale=$BENCH_RESULTS_CPUTEMP_SCALE; ${aBENCH_RESULT_CPU_TEMP_START_AVG[$i]} / ${aBENCH_INDEX[$i]}") - aBENCH_RESULT_CPU_TEMP_END_AVG[$i]=$(bc -l <<< "scale=$BENCH_RESULTS_CPUTEMP_SCALE; ${aBENCH_RESULT_CPU_TEMP_END_AVG[$i]} / ${aBENCH_INDEX[$i]}") - #DEBUG - # echo -e "aBENCH_RESULT_CPU_AVG $i = ${aBENCH_RESULT_CPU_AVG[$i]}" - # echo -e "aBENCH_RESULT_ROOTFS_WRITE_AVG $i = ${aBENCH_RESULT_ROOTFS_WRITE_AVG[$i]}" - # echo -e "aBENCH_RESULT_ROOTFS_READ_AVG $i = ${aBENCH_RESULT_ROOTFS_READ_AVG[$i]}" - # echo -e "aBENCH_RESULT_RAM_WRITE_AVG $i = ${aBENCH_RESULT_RAM_WRITE_AVG[$i]}" - # echo -e "aBENCH_RESULT_RAM_READ_AVG $i = ${aBENCH_RESULT_RAM_READ_AVG[$i]}" - # echo -e "aBENCH_RESULT_CPU_TEMP_START_AVG $i = ${aBENCH_RESULT_CPU_TEMP_START_AVG[$i]}" - # echo -e "aBENCH_RESULT_CPU_TEMP_END_AVG $i = ${aBENCH_RESULT_CPU_TEMP_END_AVG[$i]}" - #DEBUG + if (( $hw_model_supports_cpu_temps )); then - #Overrides - # - No CPU temp support - if [[ ${aBENCH_RESULT_CPU_TEMP_START_AVG[$i]} == '1' ]]; then + aBENCH_RESULT_CPU_TEMP_START_AVG[$i]=$(bc -l <<< "scale=$BENCH_RESULTS_CPUTEMP_SCALE; ${aBENCH_RESULT_CPU_TEMP_START_AVG[$i]} / ${aBENCH_INDEX[$i]}") + aBENCH_RESULT_CPU_TEMP_END_AVG[$i]=$(bc -l <<< "scale=$BENCH_RESULTS_CPUTEMP_SCALE; ${aBENCH_RESULT_CPU_TEMP_END_AVG[$i]} / ${aBENCH_INDEX[$i]}") + + else aBENCH_RESULT_CPU_TEMP_START_AVG[$i]='N/A' + aBENCH_RESULT_CPU_TEMP_END_AVG[$i]='N/A' + aBENCH_RESULT_CPU_TEMP_START_MIN[$i]='N/A' aBENCH_RESULT_CPU_TEMP_START_MAX[$i]='N/A' - aBENCH_RESULT_CPU_TEMP_END_AVG[$i]='N/A' + aBENCH_RESULT_CPU_TEMP_END_MIN[$i]='N/A' aBENCH_RESULT_CPU_TEMP_END_MAX[$i]='N/A' fi + #DEBUG + # echo -e "aBENCH_RESULT_CPU_AVG $i = ${aBENCH_RESULT_CPU_AVG[$i]}" + # echo -e "aBENCH_RESULT_ROOTFS_WRITE_AVG $i = ${aBENCH_RESULT_ROOTFS_WRITE_AVG[$i]}" + # echo -e "aBENCH_RESULT_ROOTFS_READ_AVG $i = ${aBENCH_RESULT_ROOTFS_READ_AVG[$i]}" + # echo -e "aBENCH_RESULT_RAM_WRITE_AVG $i = ${aBENCH_RESULT_RAM_WRITE_AVG[$i]}" + # echo -e "aBENCH_RESULT_RAM_READ_AVG $i = ${aBENCH_RESULT_RAM_READ_AVG[$i]}" + # echo -e "aBENCH_RESULT_CPU_TEMP_START_AVG $i = ${aBENCH_RESULT_CPU_TEMP_START_AVG[$i]}" + # echo -e "aBENCH_RESULT_CPU_TEMP_END_AVG $i = ${aBENCH_RESULT_CPU_TEMP_END_AVG[$i]}" + #DEBUG + fi done diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index 43c42dbb1e..3d62a67209 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -1952,7 +1952,7 @@ $print_logfile_info #Returns current CPU temp 'C G_OBTAIN_CPU_TEMP(){ - local cpu_temp_current=1 #We must always return a value, due to VM lacking this feature + benchmark online + local cpu_temp_current='N/A' #We must always return a value, due to VM lacking this feature + benchmark online # - Array to store possible locations for temp read. afp_temperature=(