aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-stat.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2012-05-18 12:13:33 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-05-18 12:13:33 -0400
commit16ee6576e25b83806d26eb771138249fcfb5eddc (patch)
tree7c717b80f28b5c59ba673dc00f2ca9bd0fc068d4 /tools/perf/builtin-stat.c
parent16fa7e8200fb9066b77a3f27cbed8e4a9fc71998 (diff)
parent9b63776fa3ca96c4ecda76f6fa947b7b0add66ac (diff)
Merge remote-tracking branch 'tip/perf/urgent' into perf/core
Merge reason: We are going to queue up a dependent patch: "perf tools: Move parse event automated tests to separated object" That depends on: commit e7c72d8 perf tools: Add 'G' and 'H' modifiers to event parsing Conflicts: tools/perf/builtin-stat.c Conflicted with the recent 'perf_target' patches when checking the result of perf_evsel open routines to see if a retry is needed to cope with older kernels where the exclude guest/host perf_event_attr bits were not used. 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.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 0f4b51ae4be7..62ae30d34fa6 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -282,6 +282,8 @@ static int create_perf_stat_counter(struct perf_evsel *evsel,
282{ 282{
283 struct perf_event_attr *attr = &evsel->attr; 283 struct perf_event_attr *attr = &evsel->attr;
284 struct xyarray *group_fd = NULL; 284 struct xyarray *group_fd = NULL;
285 bool exclude_guest_missing = false;
286 int ret;
285 287
286 if (group && evsel != first) 288 if (group && evsel != first)
287 group_fd = first->fd; 289 group_fd = first->fd;
@@ -292,16 +294,39 @@ static int create_perf_stat_counter(struct perf_evsel *evsel,
292 294
293 attr->inherit = !no_inherit; 295 attr->inherit = !no_inherit;
294 296
295 if (perf_target__has_cpu(&target)) 297retry:
296 return perf_evsel__open_per_cpu(evsel, evsel_list->cpus, 298 if (exclude_guest_missing)
297 group, group_fd); 299 evsel->attr.exclude_guest = evsel->attr.exclude_host = 0;
300
301 if (perf_target__has_cpu(&target)) {
302 ret = perf_evsel__open_per_cpu(evsel, evsel_list->cpus,
303 group, group_fd);
304 if (ret)
305 goto check_ret;
306 return 0;
307 }
308
298 if (!perf_target__has_task(&target) && (!group || evsel == first)) { 309 if (!perf_target__has_task(&target) && (!group || evsel == first)) {
299 attr->disabled = 1; 310 attr->disabled = 1;
300 attr->enable_on_exec = 1; 311 attr->enable_on_exec = 1;
301 } 312 }
302 313
303 return perf_evsel__open_per_thread(evsel, evsel_list->threads, 314 ret = perf_evsel__open_per_thread(evsel, evsel_list->threads,
304 group, group_fd); 315 group, group_fd);
316 if (!ret)
317 return 0;
318 /* fall through */
319check_ret:
320 if (ret && errno == EINVAL) {
321 if (!exclude_guest_missing &&
322 (evsel->attr.exclude_guest || evsel->attr.exclude_host)) {
323 pr_debug("Old kernel, cannot exclude "
324 "guest or host samples.\n");
325 exclude_guest_missing = true;
326 goto retry;
327 }
328 }
329 return ret;
305} 330}
306 331
307/* 332/*