mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
optimize the performance of obtaining CPU temperature (#6398)
Preformance Test (on NanoPi R2s, repeat 1000 times): old command: temp="$(awk "BEGIN{printf (\"%.1f\n\",$(cat /sys/class/thermal/thermal_zone0/temp)/1000) }")°C" ``` real 0m 9.20s user 0m 3.29s sys 0m 6.24s ``` new command: temp="$(awk '{ printf("%.1f °C", $0 / 1000) }' /sys/class/thermal/thermal_zone0/temp)" ``` real 0m 5.57s user 0m 1.78s sys 0m 3.97s ``` Signed-off-by: Chuck <fanck0605@qq.com>
This commit is contained in:
parent
aaba169f2f
commit
e17961f67e
@ -17,7 +17,7 @@ fi
|
||||
if grep -q "ipq40xx" "/etc/openwrt_release"; then
|
||||
sys_temp="$(sensors | grep -Eo '\+[0-9]+.+C' | sed ':a;N;$!ba;s/\n/ /g;s/+//g')"
|
||||
else
|
||||
sys_temp="$(awk "BEGIN{printf (\"%.1f\n\",$(cat /sys/class/thermal/thermal_zone0/temp)/1000) }")°C"
|
||||
sys_temp="$(awk '{ printf("%.1f °C", $0 / 1000) }' /sys/class/thermal/thermal_zone0/temp)"
|
||||
fi
|
||||
|
||||
echo -n "${cpu_arch} x ${cpu_cores} (${cpu_freq}, ${sys_temp})"
|
||||
|
Loading…
Reference in New Issue
Block a user