aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2019-05-10 08:41:43 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-05-16 13:17:24 -0400
commit1b6599a9d8e6c9f7e9b0476012383b1777f7fc93 (patch)
tree54bba364c23b4e795e08a6930761a0ce24da3ec3
parent61b6e08dc8e3ea80b7485c9b3f875ddd45c8466b (diff)
perf intel-pt: Fix sample timestamp wrt non-taken branches
The sample timestamp is updated to ensure that the timestamp represents the time of the sample and not a branch that the decoder is still walking towards. The sample timestamp is updated when the decoder returns, but the decoder does not return for non-taken branches. Update the sample timestamp then also. Note that commit 3f04d98e972b5 ("perf intel-pt: Improve sample timestamp") was also a stable fix and appears, for example, in v4.4 stable tree as commit a4ebb58fd124 ("perf intel-pt: Improve sample timestamp"). Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: stable@vger.kernel.org # v4.4+ Fixes: 3f04d98e972b ("perf intel-pt: Improve sample timestamp") Link: http://lkml.kernel.org/r/20190510124143.27054-4-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/util/intel-pt-decoder/intel-pt-decoder.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
index 9cbd587489bf..f4c3c84b090f 100644
--- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
+++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
@@ -1318,8 +1318,11 @@ static int intel_pt_walk_tnt(struct intel_pt_decoder *decoder)
1318 return 0; 1318 return 0;
1319 } 1319 }
1320 decoder->ip += intel_pt_insn.length; 1320 decoder->ip += intel_pt_insn.length;
1321 if (!decoder->tnt.count) 1321 if (!decoder->tnt.count) {
1322 decoder->sample_timestamp = decoder->timestamp;
1323 decoder->sample_insn_cnt = decoder->timestamp_insn_cnt;
1322 return -EAGAIN; 1324 return -EAGAIN;
1325 }
1323 decoder->tnt.payload <<= 1; 1326 decoder->tnt.payload <<= 1;
1324 continue; 1327 continue;
1325 } 1328 }