diff options
Diffstat (limited to 'parse/sched.py')
-rw-r--r-- | parse/sched.py | 6 |
1 files 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 * | |||
13 | 13 | ||
14 | class TimeTracker: | 14 | class TimeTracker: |
15 | '''Store stats for durations of time demarcated by sched_trace records.''' | 15 | '''Store stats for durations of time demarcated by sched_trace records.''' |
16 | def __init__(self, is_valid_duration = lambda x: True, delay_buffer_size = 1, max_pending = 100): | 16 | def __init__(self, is_valid_duration = lambda x: True, delay_buffer_size = 1, max_pending = -1): |
17 | self.validator = is_valid_duration | 17 | self.validator = is_valid_duration |
18 | self.avg = self.max = self.num = 0 | 18 | self.avg = self.max = self.num = 0 |
19 | 19 | ||
@@ -51,13 +51,13 @@ class TimeTracker: | |||
51 | # Give up on some jobs if they've been hanging around too long. | 51 | # Give up on some jobs if they've been hanging around too long. |
52 | # While not strictly needed, it helps improve performance and | 52 | # While not strictly needed, it helps improve performance and |
53 | # it is unlikey to cause too much trouble. | 53 | # it is unlikey to cause too much trouble. |
54 | if(len(self.start_records) > self.max_pending): | 54 | if(self.max_pending >= 0 and len(self.start_records) > self.max_pending): |
55 | to_discard = len(self.start_records) - self.max_pending | 55 | to_discard = len(self.start_records) - self.max_pending |
56 | for i in range(to_discard): | 56 | for i in range(to_discard): |
57 | # pop off the oldest jobs | 57 | # pop off the oldest jobs |
58 | del self.start_records[self.start_records.iterkeys().next()] | 58 | del self.start_records[self.start_records.iterkeys().next()] |
59 | self.discarded += to_discard | 59 | self.discarded += to_discard |
60 | if(len(self.end_records) > self.max_pending): | 60 | if(self.max_pending >= 0 and len(self.end_records) > self.max_pending): |
61 | to_discard = len(self.end_records) - self.max_pending | 61 | to_discard = len(self.end_records) - self.max_pending |
62 | for i in range(to_discard): | 62 | for i in range(to_discard): |
63 | # pop off the oldest jobs | 63 | # pop off the oldest jobs |