diff -u powernap-2.6/debian/changelog powernap-2.6/debian/changelog --- powernap-2.6/debian/changelog +++ powernap-2.6/debian/changelog @@ -1,3 +1,11 @@ +powernap (2.6-0ubuntu2.1) natty-proposed; urgency=low + + * SRU: + - powernap/monitors/LoadMonitor.py: scale monitors threshold. Taken + kirkland's patch commited upstream. (LP: #777361) + + -- Andres Rodriguez Wed, 04 May 2011 15:31:00 -0400 + powernap (2.6-0ubuntu2) natty-proposed; urgency=low * sbin/powernapd: Take recover action when entered to powersave with only in patch2: unchanged: --- powernap-2.6.orig/powernap/monitors/LoadMonitor.py +++ powernap-2.6/powernap/monitors/LoadMonitor.py @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import os, re, commands +import os, multiprocessing from logging import error, debug, info, warn class LoadMonitor(): @@ -25,18 +25,15 @@ def __init__(self, config): self._type = config['monitor'] self._name = config['name'] - if config['threshold'] == "n": - self._threshold = commands.getoutput("getconf _NPROCESSORS_ONLN") - else: - self._threshold = config['threshold'] + self._threshold = config['threshold'] self._absent_seconds = 0 # Check system load def active(self): - f = open("/proc/loadavg") - l = f.read().split() - f.close() - if l[0] > self._threshold: + t = self._threshold + if t == "n": + t = multiprocessing.cpu_count() + if os.getloadavg()[0] > t: return True return False