summaryrefslogtreecommitdiffstats
path: root/unit_trace/earliest.py
diff options
context:
space:
mode:
authorMac Mollison <mollison@cs.unc.edu>2010-03-14 04:20:38 -0400
committerMac Mollison <mollison@cs.unc.edu>2010-03-14 04:20:38 -0400
commitc8210c3cef340e8280658e847cc70958be77eb26 (patch)
tree32d851453fc02677ea3437c69f9c6ce373cd45e8 /unit_trace/earliest.py
parent361d978921690a7c26a63b933b502d5d2fc3e3d5 (diff)
Add support for intervals
Can now filter by earliest record of interest and latest record of interest, using -e and -l.
Diffstat (limited to 'unit_trace/earliest.py')
-rw-r--r--unit_trace/earliest.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/unit_trace/earliest.py b/unit_trace/earliest.py
new file mode 100644
index 0000000..eaf0cf8
--- /dev/null
+++ b/unit_trace/earliest.py
@@ -0,0 +1,21 @@
1###############################################################################
2# Description
3###############################################################################
4
5# Enforce earliest record
6
7###############################################################################
8# Public functions
9###############################################################################
10
11def earliest(stream, earliest):
12 for record in stream:
13 if record.record_type=="event":
14 if record.when < earliest:
15 pass
16 else:
17 yield record
18 break
19 yield record
20 for record in stream:
21 yield record