public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: acme@kernel.org
Cc: jolsa@redhat.com, linux-kernel@vger.kernel.org,
	namhyung@kernel.org, eranian@google.com,
	Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 02/10] perf, tools, report: Add flag for non ANY branch mode
Date: Sun, 10 May 2015 06:51:58 -0700	[thread overview]
Message-ID: <1431265926-4766-3-git-send-email-andi@firstfloor.org> (raw)
In-Reply-To: <1431265926-4766-1-git-send-email-andi@firstfloor.org>

From: Andi Kleen <ak@linux.intel.com>

Later patches need to cheaply check that the branch mode is in ANY.
Add a new function to check all event attrs and add a flag to the
report state, which is then initialized.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 tools/perf/builtin-report.c |  7 +++++++
 tools/perf/util/evlist.c    | 10 ++++++++++
 tools/perf/util/evlist.h    |  1 +
 3 files changed, 18 insertions(+)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 18cb0ff..3b35f1e 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -53,6 +53,7 @@ struct report {
 	bool			mem_mode;
 	bool			header;
 	bool			header_only;
+	bool			nonstd_branch_mode;
 	int			max_stack;
 	struct perf_read_values	show_threads_values;
 	const char		*pretty_printing_style;
@@ -256,6 +257,12 @@ static int report__setup_sample_type(struct report *rep)
 		else
 			callchain_param.record_mode = CALLCHAIN_FP;
 	}
+
+	/* ??? handle more cases than just ANY? */
+	if (!(perf_evlist__combined_branch_type(session->evlist) &
+				PERF_SAMPLE_BRANCH_ANY))
+		rep->nonstd_branch_mode = true;
+
 	return 0;
 }
 
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 7ec1bf9..ee0a610 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1216,6 +1216,16 @@ u64 perf_evlist__combined_sample_type(struct perf_evlist *evlist)
 	return __perf_evlist__combined_sample_type(evlist);
 }
 
+u64 perf_evlist__combined_branch_type(struct perf_evlist *evlist)
+{
+	struct perf_evsel *evsel;
+	u64 branch_type = 0;
+
+	evlist__for_each(evlist, evsel)
+		branch_type |= evsel->attr.branch_sample_type;
+	return branch_type;
+}
+
 bool perf_evlist__valid_read_format(struct perf_evlist *evlist)
 {
 	struct perf_evsel *first = perf_evlist__first(evlist), *pos = first;
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index c07b1a9..3277851 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -166,6 +166,7 @@ void perf_evlist__set_leader(struct perf_evlist *evlist);
 u64 perf_evlist__read_format(struct perf_evlist *evlist);
 u64 __perf_evlist__combined_sample_type(struct perf_evlist *evlist);
 u64 perf_evlist__combined_sample_type(struct perf_evlist *evlist);
+u64 perf_evlist__combined_branch_type(struct perf_evlist *evlist);
 bool perf_evlist__sample_id_all(struct perf_evlist *evlist);
 u16 perf_evlist__id_hdr_size(struct perf_evlist *evlist);
 
-- 
1.9.3


  parent reply	other threads:[~2015-05-10 13:52 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-10 13:51 Cycles annotation support for perf tools Andi Kleen
2015-05-10 13:51 ` [PATCH 01/10] perf, tools: Add tools support for cycles, weight branch_info field Andi Kleen
2015-05-10 13:51 ` Andi Kleen [this message]
2015-05-10 13:51 ` [PATCH 03/10] perf, tools, report: Add infrastructure for a cycles histogram Andi Kleen
2015-05-10 13:52 ` [PATCH 04/10] perf, tools, report: Add processing for cycle histograms Andi Kleen
2015-05-26 10:09   ` Jiri Olsa
2015-05-26 17:37     ` Andi Kleen
2015-06-01 13:02       ` Jiri Olsa
2015-06-01 13:07         ` Andi Kleen
2015-05-10 13:52 ` [PATCH 05/10] perf, tools: Compute IPC and basic block cycles for annotate Andi Kleen
2015-05-10 13:52 ` [PATCH 06/10] perf, tools, annotate: Finally display IPC and cycle accounting Andi Kleen
2015-05-10 13:52 ` [PATCH 07/10] perf, tools, report: Move branch option parsing to own file Andi Kleen
2015-05-26 10:09   ` Jiri Olsa
2015-05-10 13:52 ` [PATCH 08/10] perf, tools, top: Add branch annotation code to top Andi Kleen
2015-05-10 13:52 ` [PATCH 09/10] perf, tools, report: Display cycles in branch sort mode Andi Kleen
2015-05-10 13:52 ` [PATCH 10/10] test patch: Add fake branch cycles to input data in report/top Andi Kleen
2015-05-18 19:06 ` Cycles annotation support for perf tools Andi Kleen
2015-05-19  9:55   ` Jiri Olsa
2015-05-24 18:55 ` Jiri Olsa
2015-05-24 19:19   ` Andi Kleen
2015-05-26 10:08 ` Jiri Olsa
2015-05-26 16:56   ` Andi Kleen
2015-05-26 21:40     ` Andi Kleen

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=1431265926-4766-3-git-send-email-andi@firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@kernel.org \
    /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