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

[or-cvs] r24062: {arm} Error when initial recource lookups fail (caught by Trystero (arm/trunk/src/util)



Author: atagar
Date: 2011-01-11 18:49:17 +0000 (Tue, 11 Jan 2011)
New Revision: 24062

Modified:
   arm/trunk/src/util/sysTools.py
Log:
Error when initial recource lookups fail (caught by Trystero)



Modified: arm/trunk/src/util/sysTools.py
===================================================================
--- arm/trunk/src/util/sysTools.py	2011-01-11 16:43:31 UTC (rev 24061)
+++ arm/trunk/src/util/sysTools.py	2011-01-11 18:49:17 UTC (rev 24062)
@@ -504,6 +504,7 @@
           if not isSuccessful:
             raise IOError("unrecognized output from ps: %s" % psCall)
       except IOError, exc:
+        newValues = {}
         self._failureCount += 1
         
         if self._useProc:
@@ -531,14 +532,14 @@
           if not self._halt: self._cond.wait(sleepTime)
           self._cond.release()
       
-      # If this is the first run then the cpuSampling stat is meaningless
-      # (there isn't a previous tick to sample from so it's zero at this
-      # point). Setting it to the average, which is a fairer estimate.
-      if self.lastLookup == -1:
-        newValues["cpuSampling"] = newValues["cpuAvg"]
-          
       # sets the new values
       if newValues:
+        # If this is the first run then the cpuSampling stat is meaningless
+        # (there isn't a previous tick to sample from so it's zero at this
+        # point). Setting it to the average, which is a fairer estimate.
+        if self.lastLookup == -1:
+          newValues["cpuSampling"] = newValues["cpuAvg"]
+        
         self._valLock.acquire()
         self.cpuSampling = newValues["cpuSampling"]
         self.cpuAvg = newValues["cpuAvg"]