[PATCH v3] perf report: Fix regression when decoding intelPT traces

From: Mathieu Poirier
Date: Mon Dec 18 2017 - 13:18:00 EST


Commit (93d10af26bb7 perf tools: Optimize sample parsing for ordered
events) breaks intelPT trace decoding by invariably returning an error if
the event type isn't a PERF_SAMPLE_TIME.

With this patch the timestamp is initialised and processing is allowed to
continue if the error returned by function
perf_evlist__parse_sample_timestamp() is not a fault.

Signed-off-by: Mathieu Poirier <mathieu.poirier@xxxxxxxxxx>
---
Change for v3:
- Fixed brain bug code spotted by Adrian.
---
tools/perf/util/session.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 54e30f1bcbd7..07221884f725 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1508,10 +1508,10 @@ static s64 perf_session__process_event(struct perf_session *session,
return perf_session__process_user_event(session, event, file_offset);

if (tool->ordered_events) {
- u64 timestamp;
+ u64 timestamp = -1ULL;

ret = perf_evlist__parse_sample_timestamp(evlist, event, &timestamp);
- if (ret)
+ if (ret && ret != -1)
return ret;

ret = perf_session__queue_event(session, event, timestamp, file_offset);
--
2.7.4