linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Jin Yao <yao.jin@linux.intel.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Andi Kleen <ak@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>,
	Kan Liang <kan.liang@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 06/27] perf report: Fix a no annotate browser displayed issue
Date: Wed, 10 Jan 2018 18:28:23 -0300	[thread overview]
Message-ID: <20180110212844.12441-7-acme@kernel.org> (raw)
In-Reply-To: <20180110212844.12441-1-acme@kernel.org>

From: Jin Yao <yao.jin@linux.intel.com>

When enabling '-b' option in perf record, for example,

  perf record -b ...
  perf report

and then browsing the annotate browser from perf report (press 'A'), it
would fail (annotate browser can't be displayed).

It's because the '.add_entry_cb' op of struct report is overwritten by
hist_iter__branch_callback() in builtin-report.c. But this function doesn't do
something like mapping symbols and sources. So next, do_annotate() will return
directly.

        notes = symbol__annotation(act->ms.sym);
        if (!notes->src)
                return 0;

This patch adds the lost code to hist_iter__branch_callback (refer to
hist_iter__report_callback).

v2:

Fix a crash bug when perform 'perf report --stdio'.

The reason is that we init the symbol annotation only in browser mode, it
doesn't allocate/init resources for stdio mode.

So now in hist_iter__branch_callback(), it will return directly if it's not in
browser mode.

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1514284963-18587-1-git-send-email-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-report.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index eb9ce6327e71..07827cd51480 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -162,12 +162,28 @@ static int hist_iter__branch_callback(struct hist_entry_iter *iter,
 	struct hist_entry *he = iter->he;
 	struct report *rep = arg;
 	struct branch_info *bi;
+	struct perf_sample *sample = iter->sample;
+	struct perf_evsel *evsel = iter->evsel;
+	int err;
+
+	if (!ui__has_annotation())
+		return 0;
+
+	hist__account_cycles(sample->branch_stack, al, sample,
+			     rep->nonany_branch_mode);
 
 	bi = he->branch_info;
+	err = addr_map_symbol__inc_samples(&bi->from, sample, evsel->idx);
+	if (err)
+		goto out;
+
+	err = addr_map_symbol__inc_samples(&bi->to, sample, evsel->idx);
+
 	branch_type_count(&rep->brtype_stat, &bi->flags,
 			  bi->from.addr, bi->to.addr);
 
-	return 0;
+out:
+	return err;
 }
 
 static int process_sample_event(struct perf_tool *tool,
-- 
2.14.3

  parent reply	other threads:[~2018-01-10 21:28 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10 21:28 [GIT PULL 00/27] perf/core improvements and fixes Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 01/27] perf test bpf: Improve message about expected samples Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 02/27] perf test bpf: Use designated struct field initializers Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 03/27] perf test bpf: Hook on epoll_pwait() Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 04/27] perf tools: Fix compile error with libunwind x86 Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 05/27] perf report: Fix a wrong offset issue when using /proc/kcore Arnaldo Carvalho de Melo
2018-01-10 21:28 ` Arnaldo Carvalho de Melo [this message]
2018-01-10 21:28 ` [PATCH 07/27] perf header: Add infrastructure to record first and last sample time Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 08/27] perf record: Record the first and last sample time in the header Arnaldo Carvalho de Melo
2018-01-11 13:29   ` Paul Clarke
2018-01-11 14:46     ` Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 09/27] perf tools: Create function to parse time percent Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 10/27] perf tools: Create function to perform multiple time range checking Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 11/27] perf report: Support time percent and multiple time ranges Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 12/27] perf script: " Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 13/27] perf tools: Enable LIBBABELTRACE by default Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 14/27] perf tools: Display perf_event_attr::namespaces debug info Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 15/27] perf: Allocate context task_ctx_data for child event Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 16/27] perf: Add sample_id to PERF_RECORD_ITRACE_START event comment Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 17/27] perf: Make perf_callchain function static Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 18/27] perf: Return empty callchain instead of NULL Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 19/27] perf: Update PERF_RECORD_MISC_* comment for perf_event_header::misc bit 13 Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 20/27] perf script: Add support to display sample misc field Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 21/27] perf script: Add support to display lost events Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 22/27] perf tools: Make the tool's warning messages optional Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 23/27] perf report: Add --stats option to display quick data statistics Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 24/27] perf trace: Beautify 'gettid' syscall result Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 25/27] perf report: Add --tasks option to display monitored tasks Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 26/27] perf report: Introduce --mmaps Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 27/27] tools headers: Synchronize kernel <-> tooling headers Arnaldo Carvalho de Melo
2018-01-11  5:54 ` [GIT PULL 00/27] perf/core improvements and fixes Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180110212844.12441-7-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=yao.jin@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).