From: Jiri Olsa <jolsa@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Jiri Olsa <jolsa@kernel.org>, Andi Kleen <andi@firstfloor.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Corey Ashford <cjashfor@linux.vnet.ibm.com>,
David Ahern <dsahern@gmail.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Ingo Molnar <mingo@kernel.org>,
"Jen-Cheng(Tommy) Huang" <tommy24@gatech.edu>,
Namhyung Kim <namhyung@kernel.org>,
Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Stephane Eranian <eranian@google.com>
Subject: [PATCH 7/9] perf tools: Allow PERF_FORMAT_GROUP for inherited events
Date: Mon, 25 Aug 2014 16:45:41 +0200 [thread overview]
Message-ID: <1408977943-16594-8-git-send-email-jolsa@kernel.org> (raw)
In-Reply-To: <1408977943-16594-1-git-send-email-jolsa@kernel.org>
Swithing on leader sampling on inherited events.
Following command will now get data from all children processes:
$ perf record -e '{cycles,cache-misses}:S' <workload>
Use following command to display the data:
$ perf report --group
Adding warning for record command if the support
is not detected:
$ perf record -e '{cycles,cache-misses}:S,{instructions,branch}:S' kill
Disabling inherit for sample read events, no kernel support.
...
Reported-by: Jen-Cheng(Tommy) Huang <tommy24@gatech.edu>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jen-Cheng(Tommy) Huang <tommy24@gatech.edu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/perf.h | 1 +
tools/perf/util/evsel.c | 6 +++++-
tools/perf/util/record.c | 12 ++++++++++++
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 510c65f72858..54e1cb42277e 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -45,6 +45,7 @@ struct record_opts {
bool call_graph_enabled;
bool group;
bool inherit_stat;
+ bool inherit_format_group;
bool no_buffering;
bool no_inherit;
bool no_inherit_set;
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 507d458ded2c..7415159bbcea 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -586,7 +586,11 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts)
*/
if (leader->nr_members > 1) {
attr->read_format |= PERF_FORMAT_GROUP;
- attr->inherit = 0;
+ attr->inherit = opts->inherit_format_group;
+ if (!opts->inherit_format_group) {
+ pr_warning_once("Disabling inherit for sample read events, "
+ "no kernel support.\n");
+ }
}
}
diff --git a/tools/perf/util/record.c b/tools/perf/util/record.c
index cf69325b985f..22b1d9c79ac0 100644
--- a/tools/perf/util/record.c
+++ b/tools/perf/util/record.c
@@ -85,6 +85,12 @@ static void perf_probe_comm_exec(struct perf_evsel *evsel)
evsel->attr.comm_exec = 1;
}
+static void perf_probe_inherit_format_group(struct perf_evsel *evsel)
+{
+ evsel->attr.inherit = 1;
+ evsel->attr.read_format |= PERF_FORMAT_GROUP;
+}
+
bool perf_can_sample_identifier(void)
{
return perf_probe_api(perf_probe_sample_identifier);
@@ -95,6 +101,11 @@ static bool perf_can_comm_exec(void)
return perf_probe_api(perf_probe_comm_exec);
}
+static bool perf_can_inherit_format_group(void)
+{
+ return perf_probe_api(perf_probe_inherit_format_group);
+}
+
void perf_evlist__config(struct perf_evlist *evlist, struct record_opts *opts)
{
struct perf_evsel *evsel;
@@ -111,6 +122,7 @@ void perf_evlist__config(struct perf_evlist *evlist, struct record_opts *opts)
if (evlist->cpus->map[0] < 0)
opts->no_inherit = true;
+ opts->inherit_format_group = perf_can_inherit_format_group();
use_comm_exec = perf_can_comm_exec();
evlist__for_each(evlist, evsel) {
--
1.8.3.1
next prev parent reply other threads:[~2014-08-25 14:46 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-25 14:45 [RFCv2 0/9] perf: Allow leader sampling on inherited events Jiri Olsa
2014-08-25 14:45 ` [PATCH 1/9] perf: Remove redundant parent context check from context_equiv Jiri Olsa
2014-09-02 10:50 ` Peter Zijlstra
2014-09-08 9:43 ` Jiri Olsa
2014-09-08 9:45 ` Peter Zijlstra
2014-09-08 9:48 ` Peter Zijlstra
2014-09-08 10:01 ` Peter Zijlstra
2014-09-08 11:39 ` Peter Zijlstra
2014-09-08 12:19 ` Jiri Olsa
2014-09-08 13:20 ` Peter Zijlstra
2014-09-08 12:32 ` Jiri Olsa
2014-09-08 12:01 ` Jiri Olsa
2014-09-08 13:34 ` Peter Zijlstra
2014-09-08 15:13 ` Peter Zijlstra
2014-09-08 16:45 ` Jiri Olsa
2014-09-09 10:20 ` Peter Zijlstra
2014-09-10 13:57 ` Peter Zijlstra
2014-09-10 14:35 ` Jiri Olsa
2014-09-24 14:58 ` [tip:perf/core] Revert "perf: Do not allow optimized switch for non-cloned events" tip-bot for Jiri Olsa
2014-08-25 14:45 ` [PATCH 2/9] perf: Deny optimized switch for events read by PERF_SAMPLE_READ Jiri Olsa
2014-09-02 10:52 ` Peter Zijlstra
2014-09-08 10:00 ` Jiri Olsa
2014-09-08 10:11 ` Peter Zijlstra
2014-09-08 16:39 ` Jiri Olsa
2014-08-25 14:45 ` [PATCH 3/9] perf: Allow PERF_FORMAT_GROUP format on inherited events Jiri Olsa
2014-08-25 14:45 ` [PATCH 4/9] perf tools: Add support to traverse xyarrays Jiri Olsa
2014-08-25 14:45 ` [PATCH 5/9] perf tools: Add pr_warning_once debug macro Jiri Olsa
2014-08-25 14:45 ` [PATCH 6/9] perf tools: Add hash of periods for struct perf_sample_id Jiri Olsa
2014-08-25 14:45 ` Jiri Olsa [this message]
2014-08-25 14:45 ` [PATCH 8/9] perf script: Add period data column Jiri Olsa
2014-08-27 14:33 ` David Ahern
2014-10-17 16:10 ` Jiri Olsa
2014-10-17 18:22 ` Arnaldo Carvalho de Melo
2014-10-18 7:07 ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2014-08-25 14:45 ` [PATCH 9/9] perf script: Add period as a default output column Jiri Olsa
2014-08-27 14:40 ` David Ahern
2014-10-17 16:11 ` Jiri Olsa
2014-10-18 7:07 ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2014-08-25 14:51 ` [RFCv2 0/9] perf: Allow leader sampling on inherited events Jiri Olsa
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=1408977943-16594-8-git-send-email-jolsa@kernel.org \
--to=jolsa@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=andi@firstfloor.org \
--cc=cjashfor@linux.vnet.ibm.com \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
--cc=tommy24@gatech.edu \
/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).