From 2a21d03686881331b0af0471588674e7e896eeb2 Mon Sep 17 00:00:00 2001 From: Adrian Hunter Date: Fri, 17 Jul 2015 19:33:48 +0300 Subject: perf tools: Fix Intel PT 'instructions' sample period The period on synthesized 'instructions' samples was being set to a fixed value, whereas the correct value is the number of instructions since the last sample, which is a value that the decoder can provide. So do it that way. Signed-off-by: Adrian Hunter Cc: Jiri Olsa Link: http://lkml.kernel.org/r/1437150840-31811-14-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/intel-pt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tools/perf/util/intel-pt.c') diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c index a5acd2fe2447..3b34a64195ea 100644 --- a/tools/perf/util/intel-pt.c +++ b/tools/perf/util/intel-pt.c @@ -126,6 +126,7 @@ struct intel_pt_queue { u64 timestamp; u32 flags; u16 insn_len; + u64 last_insn_cnt; }; static void intel_pt_dump(struct intel_pt *pt __maybe_unused, @@ -920,11 +921,13 @@ static int intel_pt_synth_instruction_sample(struct intel_pt_queue *ptq) sample.addr = ptq->state->to_ip; sample.id = ptq->pt->instructions_id; sample.stream_id = ptq->pt->instructions_id; - sample.period = ptq->pt->instructions_sample_period; + sample.period = ptq->state->tot_insn_cnt - ptq->last_insn_cnt; sample.cpu = ptq->cpu; sample.flags = ptq->flags; sample.insn_len = ptq->insn_len; + ptq->last_insn_cnt = ptq->state->tot_insn_cnt; + if (pt->synth_opts.callchain) { thread_stack__sample(ptq->thread, ptq->chain, pt->synth_opts.callchain_sz, sample.ip); -- cgit v1.2.3