diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2014-07-14 06:02:28 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-07-16 16:57:34 -0400 |
commit | 39e09d40bea440d9cfe645b55aff251294318669 (patch) | |
tree | fee10bc37b186bc04999ea6fced578b4d0011c89 | |
parent | 022c50d09c2c2bc31506ad16c4bcba7fb418ce34 (diff) |
perf record: Select comm_exec flag if supported
The comm_exec flag on the attribute can later be found in the perf.data
file allowing a tool to know in advance if the captured data has the
flag.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1405332185-4050-5-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/util/record.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/perf/util/record.c b/tools/perf/util/record.c index 049e0a09ccd3..165723152cfb 100644 --- a/tools/perf/util/record.c +++ b/tools/perf/util/record.c | |||
@@ -69,15 +69,26 @@ static void perf_probe_sample_identifier(struct perf_evsel *evsel) | |||
69 | evsel->attr.sample_type |= PERF_SAMPLE_IDENTIFIER; | 69 | evsel->attr.sample_type |= PERF_SAMPLE_IDENTIFIER; |
70 | } | 70 | } |
71 | 71 | ||
72 | static void perf_probe_comm_exec(struct perf_evsel *evsel) | ||
73 | { | ||
74 | evsel->attr.comm_exec = 1; | ||
75 | } | ||
76 | |||
72 | bool perf_can_sample_identifier(void) | 77 | bool perf_can_sample_identifier(void) |
73 | { | 78 | { |
74 | return perf_probe_api(perf_probe_sample_identifier); | 79 | return perf_probe_api(perf_probe_sample_identifier); |
75 | } | 80 | } |
76 | 81 | ||
82 | static bool perf_can_comm_exec(void) | ||
83 | { | ||
84 | return perf_probe_api(perf_probe_comm_exec); | ||
85 | } | ||
86 | |||
77 | void perf_evlist__config(struct perf_evlist *evlist, struct record_opts *opts) | 87 | void perf_evlist__config(struct perf_evlist *evlist, struct record_opts *opts) |
78 | { | 88 | { |
79 | struct perf_evsel *evsel; | 89 | struct perf_evsel *evsel; |
80 | bool use_sample_identifier = false; | 90 | bool use_sample_identifier = false; |
91 | bool use_comm_exec; | ||
81 | 92 | ||
82 | /* | 93 | /* |
83 | * Set the evsel leader links before we configure attributes, | 94 | * Set the evsel leader links before we configure attributes, |
@@ -89,8 +100,13 @@ void perf_evlist__config(struct perf_evlist *evlist, struct record_opts *opts) | |||
89 | if (evlist->cpus->map[0] < 0) | 100 | if (evlist->cpus->map[0] < 0) |
90 | opts->no_inherit = true; | 101 | opts->no_inherit = true; |
91 | 102 | ||
92 | evlist__for_each(evlist, evsel) | 103 | use_comm_exec = perf_can_comm_exec(); |
104 | |||
105 | evlist__for_each(evlist, evsel) { | ||
93 | perf_evsel__config(evsel, opts); | 106 | perf_evsel__config(evsel, opts); |
107 | if (!evsel->idx && use_comm_exec) | ||
108 | evsel->attr.comm_exec = 1; | ||
109 | } | ||
94 | 110 | ||
95 | if (evlist->nr_entries > 1) { | 111 | if (evlist->nr_entries > 1) { |
96 | struct perf_evsel *first = perf_evlist__first(evlist); | 112 | struct perf_evsel *first = perf_evlist__first(evlist); |