[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [arm/release] fix: disabling resource usage checks if zero



commit cb5e1d40c1fe60dbb980a70efc9bf252a53f2597
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
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 mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits