aboutsummaryrefslogtreecommitdiff
path: root/tests/test_baretrace.py
diff options
context:
space:
mode:
authorValentin Schneider <valentin.schneider@arm.com>2017-09-18 11:49:11 +0100
committerValentin Schneider <valentin.schneider@arm.com>2017-09-18 12:48:01 +0100
commit211eeb5b8c238f6a2934b92b5bc4200b549f0780 (patch)
treeab0a38f388bbf211eda678c30357da76ef68ed02 /tests/test_baretrace.py
parent46660d432e6ecb68dec8ff38180d93ba4e6ec7f0 (diff)
downloadtrappy-211eeb5b8c238f6a2934b92b5bc4200b549f0780.tar.gz
bare_trace: Fix get_duration() for window use
The previous implementation only looked at the maximum timestamp of the traces. However, if trace windows are used to analyse a subset of the full trace, get_duration() would return an erroneous value: (times are normalized) trace = <trace built with window=[5, 10]> print trace.get_duration() > 10.0 This commit adds a lower-bound lookup to fix this issue. tests/test_baretrace.py has also been updated to account for this change.
Diffstat (limited to 'tests/test_baretrace.py')
-rw-r--r--tests/test_baretrace.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/test_baretrace.py b/tests/test_baretrace.py
index 257754d..f1547c3 100644
--- a/tests/test_baretrace.py
+++ b/tests/test_baretrace.py
@@ -56,7 +56,7 @@ class TestBareTrace(unittest.TestCase):
trace.add_parsed_event("pmu_counter", self.dfr[0])
trace.add_parsed_event("load_event", self.dfr[1])
- self.assertEquals(trace.get_duration(), self.dfr[1].index[-1])
+ self.assertEquals(trace.get_duration(), self.dfr[1].index[-1] - self.dfr[0].index[0])
def test_bare_trace_get_duration_normalized(self):
"""BareTrace.get_duration() works if the trace has been normalized"""