ARM-software / trappy

This repository has moved to https://gitlab.arm.com/tooling/trappy
Apache License 2.0
60 stars 39 forks source link

bare_trace: Fix get_duration() for window use #268

Closed valschneider closed 6 years ago

valschneider commented 6 years ago

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.

valschneider commented 6 years ago

@bjackman Woops, I relied on the tests I wrote for LISA's internal trace class... I'll add one here.

valschneider commented 6 years ago

@bjackman I added window tests for ftrace and also "fixed" a test for baretrace. Even without windows, the problem was visible from that test: we were checking that the returned duration was simply the latest timestamp - which was wrong.

bjackman commented 6 years ago

Assuming the 2nd commit is needed to make the 1st commit pass, can you squash those two? Nice to avoid having a commit where the tests fail.

valschneider commented 6 years ago

@bjackman Done