From 160c52110d14300bf317eca5fe64379766ac47cd Mon Sep 17 00:00:00 2001 From: Glenn Elliott Date: Tue, 21 Jan 2014 18:48:05 -0500 Subject: Keep as many records around as needed in parsing. --- parse/sched.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/parse/sched.py b/parse/sched.py index d773c8a..83004f2 100644 --- a/parse/sched.py +++ b/parse/sched.py @@ -13,7 +13,7 @@ from heapq import * class TimeTracker: '''Store stats for durations of time demarcated by sched_trace records.''' - def __init__(self, is_valid_duration = lambda x: True, delay_buffer_size = 1, max_pending = 100): + def __init__(self, is_valid_duration = lambda x: True, delay_buffer_size = 1, max_pending = -1): self.validator = is_valid_duration self.avg = self.max = self.num = 0 @@ -51,13 +51,13 @@ class TimeTracker: # Give up on some jobs if they've been hanging around too long. # While not strictly needed, it helps improve performance and # it is unlikey to cause too much trouble. - if(len(self.start_records) > self.max_pending): + if(self.max_pending >= 0 and len(self.start_records) > self.max_pending): to_discard = len(self.start_records) - self.max_pending for i in range(to_discard): # pop off the oldest jobs del self.start_records[self.start_records.iterkeys().next()] self.discarded += to_discard - if(len(self.end_records) > self.max_pending): + if(self.max_pending >= 0 and len(self.end_records) > self.max_pending): to_discard = len(self.end_records) - self.max_pending for i in range(to_discard): # pop off the oldest jobs -- cgit v1.2.2