Commit 034a9265 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

perf report: Enable integrated annotation only if possible

The integrated annotation feature is supported only in TUI mode.  Also
it should be enabled with 'symbol' sort key otherwise resulting hist
entry doesn't need to have same symbol as of a sample so that it can
fail on hist_entry__inc_addr_samples with -ERANGE.

You can easily see it when start perf report TUI without symbol* sort
key.  This patch fixes the problem.
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1347611729-16994-2-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 1af55640
...@@ -93,7 +93,7 @@ static int perf_report__add_branch_hist_entry(struct perf_tool *tool, ...@@ -93,7 +93,7 @@ static int perf_report__add_branch_hist_entry(struct perf_tool *tool,
struct annotation *notes; struct annotation *notes;
err = -ENOMEM; err = -ENOMEM;
bx = he->branch_info; bx = he->branch_info;
if (bx->from.sym && use_browser > 0) { if (bx->from.sym && use_browser == 1 && sort__has_sym) {
notes = symbol__annotation(bx->from.sym); notes = symbol__annotation(bx->from.sym);
if (!notes->src if (!notes->src
&& symbol__alloc_hist(bx->from.sym) < 0) && symbol__alloc_hist(bx->from.sym) < 0)
...@@ -107,7 +107,7 @@ static int perf_report__add_branch_hist_entry(struct perf_tool *tool, ...@@ -107,7 +107,7 @@ static int perf_report__add_branch_hist_entry(struct perf_tool *tool,
goto out; goto out;
} }
if (bx->to.sym && use_browser > 0) { if (bx->to.sym && use_browser == 1 && sort__has_sym) {
notes = symbol__annotation(bx->to.sym); notes = symbol__annotation(bx->to.sym);
if (!notes->src if (!notes->src
&& symbol__alloc_hist(bx->to.sym) < 0) && symbol__alloc_hist(bx->to.sym) < 0)
...@@ -162,7 +162,7 @@ static int perf_evsel__add_hist_entry(struct perf_evsel *evsel, ...@@ -162,7 +162,7 @@ static int perf_evsel__add_hist_entry(struct perf_evsel *evsel,
* so we don't allocated the extra space needed because the stdio * so we don't allocated the extra space needed because the stdio
* code will not use it. * code will not use it.
*/ */
if (he->ms.sym != NULL && use_browser > 0) { if (he->ms.sym != NULL && use_browser == 1 && sort__has_sym) {
struct annotation *notes = symbol__annotation(he->ms.sym); struct annotation *notes = symbol__annotation(he->ms.sym);
assert(evsel != NULL); assert(evsel != NULL);
...@@ -692,12 +692,14 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -692,12 +692,14 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
else else
use_browser = 0; use_browser = 0;
setup_sorting(report_usage, options);
/* /*
* Only in the newt browser we are doing integrated annotation, * Only in the newt browser we are doing integrated annotation,
* so don't allocate extra space that won't be used in the stdio * so don't allocate extra space that won't be used in the stdio
* implementation. * implementation.
*/ */
if (use_browser > 0) { if (use_browser == 1 && sort__has_sym) {
symbol_conf.priv_size = sizeof(struct annotation); symbol_conf.priv_size = sizeof(struct annotation);
report.annotate_init = symbol__annotate_init; report.annotate_init = symbol__annotate_init;
/* /*
...@@ -720,8 +722,6 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -720,8 +722,6 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
if (symbol__init() < 0) if (symbol__init() < 0)
goto error; goto error;
setup_sorting(report_usage, options);
if (parent_pattern != default_parent_pattern) { if (parent_pattern != default_parent_pattern) {
if (sort_dimension__add("parent") < 0) if (sort_dimension__add("parent") < 0)
goto error; goto error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment