Fix jelos-info reporting CPUFreq info.

This commit is contained in:
fewtarius 2023-01-03 06:14:42 -05:00
parent 22a9843b61
commit f24b324b17
No known key found for this signature in database
GPG key ID: F4AE55305D1B8C1A

View file

@ -42,31 +42,36 @@ do
fi fi
done done
declare -a CF MF
CNTR=0 case ${HW_ARCH} in
for CPUFREQ in /sys/devices/system/cpu/cpufreq/* aarch64)
do declare -a CF MF
if [[ "${CPUFREQ}" =~ boost ]]
then CNTR=0
continue for CPUFREQ in /sys/devices/system/cpu/cpufreq/*
fi do
if [ "${CNTR}" -eq 0 ] if [[ "${CPUFREQ}" =~ boost ]]
then then
CF+=("CURRENT FREQUENCY:") continue
MF+=("MAXIMUM FREQUENCY:") fi
fi if [ "${CNTR}" -eq 0 ]
RELCPUS=$(cat ${CPUFREQ}/related_cpus) then
if [ "${#RELCPUS}" -gt 1 ] CF+=("CURRENT FREQUENCY:")
then MF+=("MAXIMUM FREQUENCY:")
FIELD="$(cat ${CPUFREQ}/related_cpus 2>/dev/null | awk '{print $1"-"$NF}')" fi
else RELCPUS=$(cat ${CPUFREQ}/related_cpus)
FIELD="$(cat ${CPUFREQ}/related_cpus)" if [ "${#RELCPUS}" -gt 1 ]
fi then
CF+=("CORES ${FIELD}: $(( $(cat ${CPUFREQ}/scaling_cur_freq | sort | tail -n 1) / 1000))MHz") FIELD="$(cat ${CPUFREQ}/related_cpus 2>/dev/null | awk '{print $1"-"$NF}')"
MF+=("CORES ${FIELD}: $(( $(cat ${CPUFREQ}/scaling_max_freq | sort | tail -n 1) / 1000))MHz") else
CNTR=$(( CNTR + 1 )) FIELD="$(cat ${CPUFREQ}/related_cpus)"
done fi
CF+=("CORES ${FIELD}: $(( $(cat ${CPUFREQ}/scaling_cur_freq | sort | tail -n 1) / 1000))MHz")
MF+=("CORES ${FIELD}: $(( $(cat ${CPUFREQ}/scaling_max_freq | sort | tail -n 1) / 1000))MHz")
CNTR=$(( CNTR + 1 ))
done
;;
esac
# temperature # temperature
# Unit: millidegree Celsius # Unit: millidegree Celsius
@ -111,11 +116,15 @@ then
fi fi
echo "CPU FAN: ${FANSPEED}" echo "CPU FAN: ${FANSPEED}"
fi fi
for C in "${CF[@]}" case ${HW_ARCH} in
do aarch64)
echo ${C} for C in "${CF[@]}"
done do
for M in "${MF[@]}" echo ${C}
do done
echo ${M} for M in "${MF[@]}"
done do
echo ${M}
done
;;
esac