aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-05-20 21:53:04 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-20 21:53:04 -0400
commit17eea0df5f7068fc04959e655ef8f0a0ed097e19 (patch)
treed44b5cceb813dddfd1e62fe9f92556cf113d62fd /tools
parent9b905fe68433378032b851c4d81a59187689fa52 (diff)
parent76e10d158efb6d4516018846f60c2ab5501900bc (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/Makefile4
-rw-r--r--tools/perf/builtin-stat.c40
-rw-r--r--tools/perf/util/header.c2
3 files changed, 38 insertions, 8 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 9bf3fc759344..92271d32bc30 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -774,10 +774,10 @@ $(OUTPUT)perf.o perf.spec \
774# over the general rule for .o 774# over the general rule for .o
775 775
776$(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS 776$(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS
777 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Iutil/ -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $< 777 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Iutil/ -w $<
778 778
779$(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS 779$(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS
780 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -Iutil/ -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $< 780 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -Iutil/ -w $<
781 781
782$(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS 782$(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS
783 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< 783 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index c941bb640f49..1e5e9b270f5e 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/*
@@ -463,8 +488,13 @@ static int run_perf_stat(int argc __used, const char **argv)
463 488
464 list_for_each_entry(counter, &evsel_list->entries, node) { 489 list_for_each_entry(counter, &evsel_list->entries, node) {
465 if (create_perf_stat_counter(counter, first) < 0) { 490 if (create_perf_stat_counter(counter, first) < 0) {
491 /*
492 * PPC returns ENXIO for HW counters until 2.6.37
493 * (behavior changed with commit b0a873e).
494 */
466 if (errno == EINVAL || errno == ENOSYS || 495 if (errno == EINVAL || errno == ENOSYS ||
467 errno == ENOENT || errno == EOPNOTSUPP) { 496 errno == ENOENT || errno == EOPNOTSUPP ||
497 errno == ENXIO) {
468 if (verbose) 498 if (verbose)
469 ui__warning("%s event is not supported by the kernel.\n", 499 ui__warning("%s event is not supported by the kernel.\n",
470 event_name(counter)); 500 event_name(counter));
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) {