From d6be0f0545e4f03b37c93d847048a7a3ae93a132 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Thu, 18 Nov 2010 19:49:34 -0600 Subject: [PATCH] usr/lib/byobu/cpu_freq: scale bogomips by number of processors, if using bogomips to estimate frequency, LP: #675442 --- debian/changelog | 2 ++ usr/lib/byobu/cpu_freq | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 518501c6..c0276d49 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,8 @@ byobu (3.10) unreleased; urgency=low * usr/lib/byobu/custom: fix typo in for loop, LP: #673728, thanks for the triage Jorge E. Gómez * 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 Fri, 12 Nov 2010 22:45:25 -0600 diff --git a/usr/lib/byobu/cpu_freq b/usr/lib/byobu/cpu_freq index 84c827fa..eedb2cfe 100755 --- a/usr/lib/byobu/cpu_freq +++ b/usr/lib/byobu/cpu_freq @@ -28,6 +28,13 @@ fi 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) 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 printf "$(color b c W)%s$(color -)$(color c W)%s$(color -) " "$freq" "GHz"