ministo

A tmux status bar and scripts for CPU miners.
git clone git://git.swab.dev/ministo.git
Log | Files | Refs | README | LICENSE

getAverageCpuMHz.sh (316B)


      1 #! /bin/sh
      2 
      3 cpus=$(awk '/cpu MHz/ { print $4 }' /proc/cpuinfo)
      4 
      5 n=0
      6 i=0
      7 sum=0
      8 
      9 for _ in $cpus; do
     10 	n=$((n+1))
     11 done
     12 
     13 while [ $i -le $n ]; do
     14 	i=$((i+1))
     15 done
     16 
     17 for num in $cpus; do
     18 	sum=$(echo "$sum" + "$num" | bc -l)
     19 done
     20 
     21 mhz="$(echo "$sum" / "$n" | bc -l)"
     22 printf '%0.2fGHz' "$(echo "$mhz" / 1000 | bc -l)"
     23 exit 0;