[PATCH 09/25] perf report: Adjust sample type validation for synthesized branch stacks

From: Adrian Hunter
Date: Fri Sep 25 2015 - 09:23:51 EST


perf report looks at event sample types to determine if branch stacks have
been sampled. Adjust the validation to know about instruction tracing
options.

This change allows the use of the -b option which otherwise would complain
with an error like:

Error:
Selected -b but no branch data. Did you call perf record without -b?
# To display the perf.data header info,
# please use --header/--header-only options.
#

Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
---
tools/perf/builtin-report.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 0d53b485a87b..7af35af5a5e5 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -220,6 +220,9 @@ static int report__setup_sample_type(struct report *rep)
!session->itrace_synth_opts->set))
sample_type |= PERF_SAMPLE_CALLCHAIN;

+ if (session->itrace_synth_opts->last_branch)
+ sample_type |= PERF_SAMPLE_BRANCH_STACK;
+
if (!is_pipe && !(sample_type & PERF_SAMPLE_CALLCHAIN)) {
if (sort__has_parent) {
ui__error("Selected --sort parent, but no "
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/