Windows: cpu support

This commit is contained in:
dylan araps 2016-01-05 16:57:30 +11:00
parent 736b06ea3c
commit cb8444c41a
1 changed files with 15 additions and 0 deletions

View File

@ -446,6 +446,21 @@ getcpu () {
cpu="$(sysctl -n hw.model)" cpu="$(sysctl -n hw.model)"
;; ;;
"Windows")
# Get cpu name
cpu="$(grep 'model name' /proc/cpuinfo)"
cpu=${cpu/model name*: /}
speed=$(grep 'cpu MHz' /proc/cpuinfo)
speed=${speed/cpu MHz*: /}
speed=${speed/\./}
# Convert mhz to ghz without bc
speed=$((${speed} / 1000))
speed=${speed:0:1}.${speed:1}
cpu="$cpu @ ${speed}GHz"
;;
*) *)
cpu="Unknown" cpu="Unknown"
;; ;;