Fix cpuspeed on *buntu based systems
This commit is contained in:
parent
4096d3c988
commit
515e2fb886
1 changed files with 14 additions and 4 deletions
18
fetch
18
fetch
|
@ -73,7 +73,7 @@ use_wmctrl=0
|
||||||
# CPU
|
# CPU
|
||||||
|
|
||||||
# CPU speed type
|
# CPU speed type
|
||||||
# Only works on Linux
|
# Only works on Linux with cpufreq.
|
||||||
# --speed_type current/min/max
|
# --speed_type current/min/max
|
||||||
speed_type="max"
|
speed_type="max"
|
||||||
|
|
||||||
|
@ -553,13 +553,23 @@ getcpu () {
|
||||||
cpu=${cpu/ @*/}
|
cpu=${cpu/ @*/}
|
||||||
|
|
||||||
# Get cpu speed
|
# Get cpu speed
|
||||||
speed_type=${speed_type/rent/}
|
case "$distro" in
|
||||||
read -r speed < \
|
*"buntu")
|
||||||
/sys/devices/system/cpu/cpu0/cpufreq/scaling_${speed_type}_freq
|
speed=$(awk -F ': ' '/cpu Mhz/ {printf $2}' /proc/cpuinfo)
|
||||||
|
speed=${speed/\./}
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
speed_type=${speed_type/rent/}
|
||||||
|
read -r speed < \
|
||||||
|
/sys/devices/system/cpu/cpu0/cpufreq/scaling_${speed_type}_freq
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Convert mhz to ghz without bc
|
# Convert mhz to ghz without bc
|
||||||
speed=$((speed / 100000))
|
speed=$((speed / 100000))
|
||||||
speed=${speed:0:1}.${speed:1}
|
speed=${speed:0:1}.${speed:1}
|
||||||
|
|
||||||
cpu="$cpu @ ${speed}GHz"
|
cpu="$cpu @ ${speed}GHz"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue