commit cb5e1d40c1fe60dbb980a70efc9bf252a53f2597 Author: Damian Johnson atagar@torproject.org Date: Wed Jun 15 08:20:46 2011 -0700
fix: disabling resource usage checks if zero
When the "queries.resourceUsage.rate" is set to zero I'm disabling system resource usage queries rather than peging the cpu. --- src/util/sysTools.py | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/util/sysTools.py b/src/util/sysTools.py index 2775194..98361e5 100644 --- a/src/util/sysTools.py +++ b/src/util/sysTools.py @@ -380,7 +380,8 @@ class ResourceTracker(threading.Thread):
Arguments: processPid - pid of the process being tracked - resolveRate - time between resolving resource usage + resolveRate - time between resolving resource usage, resolution is + disabled if zero """
threading.Thread.__init__(self) @@ -443,7 +444,13 @@ class ResourceTracker(threading.Thread): while not self._halt: timeSinceReset = time.time() - self.lastLookup
- if timeSinceReset < self.resolveRate: + if self.resolveRate == 0: + self._cond.acquire() + if not self._halt: self._cond.wait(0.2) + self._cond.release() + + continue + elif timeSinceReset < self.resolveRate: sleepTime = max(0.2, self.resolveRate - timeSinceReset)
self._cond.acquire()
tor-commits@lists.torproject.org