usr/lib/byobu/cpu_freq: scale bogomips by number of processors, if

using bogomips to estimate frequency, LP: #675442
This commit is contained in:
Dustin Kirkland 2010-11-18 19:49:34 -06:00
commit d6be0f0545
2 changed files with 10 additions and 1 deletions

2
debian/changelog vendored
View file

@ -3,6 +3,8 @@ byobu (3.10) unreleased; urgency=low
* usr/lib/byobu/custom: fix typo in for loop, LP: #673728, thanks for * usr/lib/byobu/custom: fix typo in for loop, LP: #673728, thanks for
the triage Jorge E. Gómez the triage Jorge E. Gómez
* usr/bin/byobu-janitor: make sure this runs to completion, LP: #676605 * usr/bin/byobu-janitor: make sure this runs to completion, LP: #676605
* usr/lib/byobu/cpu_freq: scale bogomips by number of processors, if
using bogomips to estimate frequency, LP: #675442
-- Dustin Kirkland <kirkland@ubuntu.com> Fri, 12 Nov 2010 22:45:25 -0600 -- Dustin Kirkland <kirkland@ubuntu.com> Fri, 12 Nov 2010 22:45:25 -0600

View file

@ -28,6 +28,13 @@ fi
if [ -r "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq" ]; then if [ -r "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq" ]; then
freq=$(awk '{ printf "%.1f", $1 / 1000000 }' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq) freq=$(awk '{ printf "%.1f", $1 / 1000000 }' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq)
else else
freq=$(egrep -i -m 1 "^cpu MHz|^clock|^bogomips" /proc/cpuinfo | awk -F"[:.]" '{ printf "%.1f", $2 / 1000 }') if freq=$(egrep -i -m 1 "^cpu MHz|^clock" /proc/cpuinfo | awk -F"[:.]" '{ printf "%.1f", $2 / 1000 }'); then
true
else
# Must scale frequency by number of processors, if counting bogomips
count=$(getconf _NPROCESSORS_ONLN 2>/dev/null || grep -ci "^processor" /proc/cpuinfo)
freq=$(egrep -i -m 1 "^bogomips" /proc/cpuinfo | awk -F"[:.]" '{ print $2 }')
freq=$(echo "$freq" "$count" | awk '{printf "%.1f\n", $1/$2/1000}')
fi
fi fi
printf "$(color b c W)%s$(color -)$(color c W)%s$(color -) " "$freq" "GHz" printf "$(color b c W)%s$(color -)$(color c W)%s$(color -) " "$freq" "GHz"