aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-stat.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-11-12 12:34:00 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-11-14 14:51:50 -0500
commitcac21425578abddc4e9f529845832a57ba27ce0f (patch)
tree78e6795bc2c7e86ac8aed3cb25381714845ebe32 /tools/perf/builtin-stat.c
parent6064803313bad9ae4cae233a9d56678adb2b6e7c (diff)
perf tools: Fix attributes for '{}' defined event groups
Fixing events attributes for groups defined via '{}'. Currently 'enable_on_exec' attribute in record command and both 'disabled ' and 'enable_on_exec' attributes in stat command are set based on the 'group' option. This eliminates proper setup for '{}' defined groups as they don't set 'group' option. Making above attributes values based on the 'evsel->leader' as this is common to both group definition. Moving perf_evlist__set_leader call within builtin-record ahead perf_evlist__config_attrs call, because the latter needs possible group leader links in place. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1352741644-16809-2-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-stat.c')
-rw-r--r--tools/perf/builtin-stat.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 6888960ef8b8..557081e0c6d9 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -129,8 +129,7 @@ static struct stats runtime_itlb_cache_stats[MAX_NR_CPUS];
129static struct stats runtime_dtlb_cache_stats[MAX_NR_CPUS]; 129static struct stats runtime_dtlb_cache_stats[MAX_NR_CPUS];
130static struct stats walltime_nsecs_stats; 130static struct stats walltime_nsecs_stats;
131 131
132static int create_perf_stat_counter(struct perf_evsel *evsel, 132static int create_perf_stat_counter(struct perf_evsel *evsel)
133 struct perf_evsel *first)
134{ 133{
135 struct perf_event_attr *attr = &evsel->attr; 134 struct perf_event_attr *attr = &evsel->attr;
136 bool exclude_guest_missing = false; 135 bool exclude_guest_missing = false;
@@ -153,7 +152,7 @@ retry:
153 return 0; 152 return 0;
154 } 153 }
155 154
156 if (!perf_target__has_task(&target) && (!group || evsel == first)) { 155 if (!perf_target__has_task(&target) && (!evsel->leader)) {
157 attr->disabled = 1; 156 attr->disabled = 1;
158 attr->enable_on_exec = 1; 157 attr->enable_on_exec = 1;
159 } 158 }
@@ -272,7 +271,7 @@ static int read_counter(struct perf_evsel *counter)
272static int __run_perf_stat(int argc __maybe_unused, const char **argv) 271static int __run_perf_stat(int argc __maybe_unused, const char **argv)
273{ 272{
274 unsigned long long t0, t1; 273 unsigned long long t0, t1;
275 struct perf_evsel *counter, *first; 274 struct perf_evsel *counter;
276 int status = 0; 275 int status = 0;
277 int child_ready_pipe[2], go_pipe[2]; 276 int child_ready_pipe[2], go_pipe[2];
278 const bool forks = (argc > 0); 277 const bool forks = (argc > 0);
@@ -332,10 +331,8 @@ static int __run_perf_stat(int argc __maybe_unused, const char **argv)
332 if (group) 331 if (group)
333 perf_evlist__set_leader(evsel_list); 332 perf_evlist__set_leader(evsel_list);
334 333
335 first = perf_evlist__first(evsel_list);
336
337 list_for_each_entry(counter, &evsel_list->entries, node) { 334 list_for_each_entry(counter, &evsel_list->entries, node) {
338 if (create_perf_stat_counter(counter, first) < 0) { 335 if (create_perf_stat_counter(counter) < 0) {
339 /* 336 /*
340 * PPC returns ENXIO for HW counters until 2.6.37 337 * PPC returns ENXIO for HW counters until 2.6.37
341 * (behavior changed with commit b0a873e). 338 * (behavior changed with commit b0a873e).