aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2012-05-02 13:33:34 -0400
committerIngo Molnar <mingo@kernel.org>2012-05-02 13:33:34 -0400
commit4c8570362652ec427e8282d9c528bcc6cbe1075c (patch)
tree6540196a1d3e0b626ca7c3be6708dfd11779814f /tools
parent529acf58981440eefeaf1451387e2a0aa4825c12 (diff)
parent5622c07b4741e0afd7607bce6e850b76eeb23210 (diff)
Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
Fixes for perf/urgent: - Add fallback in 'perf stat' for kernels that don't support perf_event_attr.exclude_guest, from Stephane Eranian. - Fix build id cache add routine to take the size of the buffer and not of a pointer, from Namhyung Kim. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-stat.c33
-rw-r--r--tools/perf/util/header.c2
2 files changed, 30 insertions, 5 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index c941bb640f49..4532a789fbe3 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -283,6 +283,8 @@ static int create_perf_stat_counter(struct perf_evsel *evsel,
283{ 283{
284 struct perf_event_attr *attr = &evsel->attr; 284 struct perf_event_attr *attr = &evsel->attr;
285 struct xyarray *group_fd = NULL; 285 struct xyarray *group_fd = NULL;
286 bool exclude_guest_missing = false;
287 int ret;
286 288
287 if (group && evsel != first) 289 if (group && evsel != first)
288 group_fd = first->fd; 290 group_fd = first->fd;
@@ -293,16 +295,39 @@ static int create_perf_stat_counter(struct perf_evsel *evsel,
293 295
294 attr->inherit = !no_inherit; 296 attr->inherit = !no_inherit;
295 297
296 if (system_wide) 298retry:
297 return perf_evsel__open_per_cpu(evsel, evsel_list->cpus, 299 if (exclude_guest_missing)
300 evsel->attr.exclude_guest = evsel->attr.exclude_host = 0;
301
302 if (system_wide) {
303 ret = perf_evsel__open_per_cpu(evsel, evsel_list->cpus,
298 group, group_fd); 304 group, group_fd);
305 if (ret)
306 goto check_ret;
307 return 0;
308 }
309
299 if (!target_pid && !target_tid && (!group || evsel == first)) { 310 if (!target_pid && !target_tid && (!group || evsel == first)) {
300 attr->disabled = 1; 311 attr->disabled = 1;
301 attr->enable_on_exec = 1; 312 attr->enable_on_exec = 1;
302 } 313 }
303 314
304 return perf_evsel__open_per_thread(evsel, evsel_list->threads, 315 ret = perf_evsel__open_per_thread(evsel, evsel_list->threads,
305 group, group_fd); 316 group, group_fd);
317 if (!ret)
318 return 0;
319 /* fall through */
320check_ret:
321 if (ret && errno == EINVAL) {
322 if (!exclude_guest_missing &&
323 (evsel->attr.exclude_guest || evsel->attr.exclude_host)) {
324 pr_debug("Old kernel, cannot exclude "
325 "guest or host samples.\n");
326 exclude_guest_missing = true;
327 goto retry;
328 }
329 }
330 return ret;
306} 331}
307 332
308/* 333/*
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 4c7c2d73251f..c0b70c697a36 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -296,7 +296,7 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
296 if (mkdir_p(filename, 0755)) 296 if (mkdir_p(filename, 0755))
297 goto out_free; 297 goto out_free;
298 298
299 snprintf(filename + len, sizeof(filename) - len, "/%s", sbuild_id); 299 snprintf(filename + len, size - len, "/%s", sbuild_id);
300 300
301 if (access(filename, F_OK)) { 301 if (access(filename, F_OK)) {
302 if (is_kallsyms) { 302 if (is_kallsyms) {