Browse Source

prevent false positives caused by zero-duration profiles

Darren Ranalli 17 years ago
parent
commit
158e726dc7
1 changed files with 6 additions and 1 deletions
  1. 6 1
      direct/src/task/TaskProfiler.py

+ 6 - 1
direct/src/task/TaskProfiler.py

@@ -46,8 +46,13 @@ class TaskTracker:
                 self.notify.info(s)
         return isSpike
     def addProfileSession(self, session):
-        isSpike = self._checkSpike(session)
         duration = session.getDuration()
+        if duration == 0.:
+            # profiled code was too fast for the clock, throw this result out
+            # if we keep it we may get many false positive spike detects
+            return
+
+        isSpike = self._checkSpike(session)
         self._durationAverager.addValue(duration)
 
         storeAvg = True