diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-28 14:38:18 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-28 14:38:18 -0500 |
commit | 3f26b0c876bbfeed74325ada0329de53efbdf7a6 (patch) | |
tree | 10001aca5e2ff11e9d84514f8e4fcd050e944513 | |
parent | 74efe07bc38c538ba7ac40a895910f4f3bee3152 (diff) | |
parent | 1572e45a924f254d9570093abde46430c3172e3d (diff) |
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo Molnar:
"Misc fixes on the kernel and tooling side - nothing in particular
stands out"
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (21 commits)
perf/core: Fix the perf_cpu_time_max_percent check
perf/core: Fix perf_event_enable_on_exec() timekeeping (again)
perf/core: Remove confusing comment and move put_ctx()
perf record: Honor --quiet option properly
perf annotate: Add -q/--quiet option
perf diff: Add -q/--quiet option
perf report: Add -q/--quiet option
perf utils: Check verbose flag properly
perf utils: Add perf_quiet_option()
perf record: Add -a as default target
perf stat: Add -a as default target
perf tools: Fail on using multiple bits long terms without value
perf tools: Move new_term arguments into struct parse_events_term template
perf build: Add special fixdep cleaning rule
perf tools: Replace _SC_NPROCESSORS_CONF with max_present_cpu in cpu_topology_map
perf header: Make build_cpu_topology skip offline/absent CPUs
perf cpumap: Add cpu__max_present_cpu()
perf session: Fix DEBUG=1 build with clang
tools lib traceevent: It's preempt not prempt
perf python: Filter out -specs=/a/b/c from the python binding cc options
...
55 files changed, 260 insertions, 137 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c index 5b4e0b98f4eb..1031bdf9f012 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -455,7 +455,7 @@ int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write, | |||
455 | void __user *buffer, size_t *lenp, | 455 | void __user *buffer, size_t *lenp, |
456 | loff_t *ppos) | 456 | loff_t *ppos) |
457 | { | 457 | { |
458 | int ret = proc_dointvec(table, write, buffer, lenp, ppos); | 458 | int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); |
459 | 459 | ||
460 | if (ret || !write) | 460 | if (ret || !write) |
461 | return ret; | 461 | return ret; |
@@ -3522,6 +3522,8 @@ static void perf_event_enable_on_exec(int ctxn) | |||
3522 | if (enabled) { | 3522 | if (enabled) { |
3523 | clone_ctx = unclone_ctx(ctx); | 3523 | clone_ctx = unclone_ctx(ctx); |
3524 | ctx_resched(cpuctx, ctx, event_type); | 3524 | ctx_resched(cpuctx, ctx, event_type); |
3525 | } else { | ||
3526 | ctx_sched_in(ctx, cpuctx, EVENT_TIME, current); | ||
3525 | } | 3527 | } |
3526 | perf_ctx_unlock(cpuctx, ctx); | 3528 | perf_ctx_unlock(cpuctx, ctx); |
3527 | 3529 | ||
@@ -9955,6 +9957,7 @@ SYSCALL_DEFINE5(perf_event_open, | |||
9955 | * of swizzling perf_event::ctx. | 9957 | * of swizzling perf_event::ctx. |
9956 | */ | 9958 | */ |
9957 | perf_remove_from_context(group_leader, 0); | 9959 | perf_remove_from_context(group_leader, 0); |
9960 | put_ctx(gctx); | ||
9958 | 9961 | ||
9959 | list_for_each_entry(sibling, &group_leader->sibling_list, | 9962 | list_for_each_entry(sibling, &group_leader->sibling_list, |
9960 | group_entry) { | 9963 | group_entry) { |
@@ -9993,13 +9996,6 @@ SYSCALL_DEFINE5(perf_event_open, | |||
9993 | perf_event__state_init(group_leader); | 9996 | perf_event__state_init(group_leader); |
9994 | perf_install_in_context(ctx, group_leader, group_leader->cpu); | 9997 | perf_install_in_context(ctx, group_leader, group_leader->cpu); |
9995 | get_ctx(ctx); | 9998 | get_ctx(ctx); |
9996 | |||
9997 | /* | ||
9998 | * Now that all events are installed in @ctx, nothing | ||
9999 | * references @gctx anymore, so drop the last reference we have | ||
10000 | * on it. | ||
10001 | */ | ||
10002 | put_ctx(gctx); | ||
10003 | } | 9999 | } |
10004 | 10000 | ||
10005 | /* | 10001 | /* |
diff --git a/tools/build/Makefile b/tools/build/Makefile index aaf7ed329a45..477f00eda591 100644 --- a/tools/build/Makefile +++ b/tools/build/Makefile | |||
@@ -35,8 +35,8 @@ all: $(OUTPUT)fixdep | |||
35 | 35 | ||
36 | clean: | 36 | clean: |
37 | $(call QUIET_CLEAN, fixdep) | 37 | $(call QUIET_CLEAN, fixdep) |
38 | $(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete | 38 | $(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete |
39 | $(Q)rm -f fixdep | 39 | $(Q)rm -f $(OUTPUT)fixdep |
40 | 40 | ||
41 | $(OUTPUT)fixdep-in.o: FORCE | 41 | $(OUTPUT)fixdep-in.o: FORCE |
42 | $(Q)$(MAKE) $(build)=fixdep | 42 | $(Q)$(MAKE) $(build)=fixdep |
diff --git a/tools/build/Makefile.include b/tools/build/Makefile.include index ad22e4e7bc59..d360f39a445b 100644 --- a/tools/build/Makefile.include +++ b/tools/build/Makefile.include | |||
@@ -3,4 +3,7 @@ build := -f $(srctree)/tools/build/Makefile.build dir=. obj | |||
3 | fixdep: | 3 | fixdep: |
4 | $(Q)$(MAKE) -C $(srctree)/tools/build CFLAGS= LDFLAGS= $(OUTPUT)fixdep | 4 | $(Q)$(MAKE) -C $(srctree)/tools/build CFLAGS= LDFLAGS= $(OUTPUT)fixdep |
5 | 5 | ||
6 | fixdep-clean: | ||
7 | $(Q)$(MAKE) -C $(srctree)/tools/build clean | ||
8 | |||
6 | .PHONY: fixdep | 9 | .PHONY: fixdep |
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index f2ea78021450..7ce724fc0544 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c | |||
@@ -5225,13 +5225,13 @@ int pevent_data_pid(struct pevent *pevent, struct pevent_record *rec) | |||
5225 | } | 5225 | } |
5226 | 5226 | ||
5227 | /** | 5227 | /** |
5228 | * pevent_data_prempt_count - parse the preempt count from the record | 5228 | * pevent_data_preempt_count - parse the preempt count from the record |
5229 | * @pevent: a handle to the pevent | 5229 | * @pevent: a handle to the pevent |
5230 | * @rec: the record to parse | 5230 | * @rec: the record to parse |
5231 | * | 5231 | * |
5232 | * This returns the preempt count from a record. | 5232 | * This returns the preempt count from a record. |
5233 | */ | 5233 | */ |
5234 | int pevent_data_prempt_count(struct pevent *pevent, struct pevent_record *rec) | 5234 | int pevent_data_preempt_count(struct pevent *pevent, struct pevent_record *rec) |
5235 | { | 5235 | { |
5236 | return parse_common_pc(pevent, rec->data); | 5236 | return parse_common_pc(pevent, rec->data); |
5237 | } | 5237 | } |
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h index 74cecba87daa..66342804161c 100644 --- a/tools/lib/traceevent/event-parse.h +++ b/tools/lib/traceevent/event-parse.h | |||
@@ -710,7 +710,7 @@ void pevent_data_lat_fmt(struct pevent *pevent, | |||
710 | int pevent_data_type(struct pevent *pevent, struct pevent_record *rec); | 710 | int pevent_data_type(struct pevent *pevent, struct pevent_record *rec); |
711 | struct event_format *pevent_data_event_from_type(struct pevent *pevent, int type); | 711 | struct event_format *pevent_data_event_from_type(struct pevent *pevent, int type); |
712 | int pevent_data_pid(struct pevent *pevent, struct pevent_record *rec); | 712 | int pevent_data_pid(struct pevent *pevent, struct pevent_record *rec); |
713 | int pevent_data_prempt_count(struct pevent *pevent, struct pevent_record *rec); | 713 | int pevent_data_preempt_count(struct pevent *pevent, struct pevent_record *rec); |
714 | int pevent_data_flags(struct pevent *pevent, struct pevent_record *rec); | 714 | int pevent_data_flags(struct pevent *pevent, struct pevent_record *rec); |
715 | const char *pevent_data_comm_from_pid(struct pevent *pevent, int pid); | 715 | const char *pevent_data_comm_from_pid(struct pevent *pevent, int pid); |
716 | struct cmdline; | 716 | struct cmdline; |
diff --git a/tools/perf/Documentation/perf-annotate.txt b/tools/perf/Documentation/perf-annotate.txt index 8ffbd272952d..a89273d8e744 100644 --- a/tools/perf/Documentation/perf-annotate.txt +++ b/tools/perf/Documentation/perf-annotate.txt | |||
@@ -39,6 +39,10 @@ OPTIONS | |||
39 | --verbose:: | 39 | --verbose:: |
40 | Be more verbose. (Show symbol address, etc) | 40 | Be more verbose. (Show symbol address, etc) |
41 | 41 | ||
42 | -q:: | ||
43 | --quiet:: | ||
44 | Do not show any message. (Suppress -v) | ||
45 | |||
42 | -D:: | 46 | -D:: |
43 | --dump-raw-trace:: | 47 | --dump-raw-trace:: |
44 | Dump raw trace in ASCII. | 48 | Dump raw trace in ASCII. |
diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt index 66dbe3dee74b..a79c84ae61aa 100644 --- a/tools/perf/Documentation/perf-diff.txt +++ b/tools/perf/Documentation/perf-diff.txt | |||
@@ -73,6 +73,10 @@ OPTIONS | |||
73 | Be verbose, for instance, show the raw counts in addition to the | 73 | Be verbose, for instance, show the raw counts in addition to the |
74 | diff. | 74 | diff. |
75 | 75 | ||
76 | -q:: | ||
77 | --quiet:: | ||
78 | Do not show any message. (Suppress -v) | ||
79 | |||
76 | -f:: | 80 | -f:: |
77 | --force:: | 81 | --force:: |
78 | Don't do ownership validation. | 82 | Don't do ownership validation. |
diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt index 27256bc68eda..b16003ec14a7 100644 --- a/tools/perf/Documentation/perf-record.txt +++ b/tools/perf/Documentation/perf-record.txt | |||
@@ -157,7 +157,7 @@ OPTIONS | |||
157 | 157 | ||
158 | -a:: | 158 | -a:: |
159 | --all-cpus:: | 159 | --all-cpus:: |
160 | System-wide collection from all CPUs. | 160 | System-wide collection from all CPUs (default if no target is specified). |
161 | 161 | ||
162 | -p:: | 162 | -p:: |
163 | --pid=:: | 163 | --pid=:: |
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt index f2914f03ae7b..c04cc0647c16 100644 --- a/tools/perf/Documentation/perf-report.txt +++ b/tools/perf/Documentation/perf-report.txt | |||
@@ -25,6 +25,10 @@ OPTIONS | |||
25 | --verbose:: | 25 | --verbose:: |
26 | Be more verbose. (show symbol address, etc) | 26 | Be more verbose. (show symbol address, etc) |
27 | 27 | ||
28 | -q:: | ||
29 | --quiet:: | ||
30 | Do not show any message. (Suppress -v) | ||
31 | |||
28 | -n:: | 32 | -n:: |
29 | --show-nr-samples:: | 33 | --show-nr-samples:: |
30 | Show the number of samples for each symbol | 34 | Show the number of samples for each symbol |
diff --git a/tools/perf/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt index d96ccd4844df..aecf2a87e7d6 100644 --- a/tools/perf/Documentation/perf-stat.txt +++ b/tools/perf/Documentation/perf-stat.txt | |||
@@ -63,7 +63,7 @@ report:: | |||
63 | 63 | ||
64 | -a:: | 64 | -a:: |
65 | --all-cpus:: | 65 | --all-cpus:: |
66 | system-wide collection from all CPUs | 66 | system-wide collection from all CPUs (default if no target is specified) |
67 | 67 | ||
68 | -c:: | 68 | -c:: |
69 | --scale:: | 69 | --scale:: |
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 2b941efadb04..27c9fbca7bd9 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config | |||
@@ -175,6 +175,10 @@ PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) | |||
175 | PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) | 175 | PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) |
176 | PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) | 176 | PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) |
177 | 177 | ||
178 | ifeq ($(CC), clang) | ||
179 | PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS)) | ||
180 | endif | ||
181 | |||
178 | FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS) | 182 | FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS) |
179 | FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS) | 183 | FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS) |
180 | FEATURE_CHECK_CFLAGS-libpython-version := $(PYTHON_EMBED_CCOPTS) | 184 | FEATURE_CHECK_CFLAGS-libpython-version := $(PYTHON_EMBED_CCOPTS) |
@@ -601,6 +605,9 @@ else | |||
601 | PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) | 605 | PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) |
602 | PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil | 606 | PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil |
603 | PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) | 607 | PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) |
608 | ifeq ($(CC), clang) | ||
609 | PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS)) | ||
610 | endif | ||
604 | FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) | 611 | FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) |
605 | 612 | ||
606 | ifneq ($(feature-libpython), 1) | 613 | ifneq ($(feature-libpython), 1) |
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 4da19b6ba94a..79fe31f20a17 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf | |||
@@ -726,13 +726,13 @@ config-clean: | |||
726 | $(call QUIET_CLEAN, config) | 726 | $(call QUIET_CLEAN, config) |
727 | $(Q)$(MAKE) -C $(srctree)/tools/build/feature/ $(if $(OUTPUT),OUTPUT=$(OUTPUT)feature/,) clean >/dev/null | 727 | $(Q)$(MAKE) -C $(srctree)/tools/build/feature/ $(if $(OUTPUT),OUTPUT=$(OUTPUT)feature/,) clean >/dev/null |
728 | 728 | ||
729 | clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean config-clean | 729 | clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean config-clean fixdep-clean |
730 | $(call QUIET_CLEAN, core-objs) $(RM) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(LANG_BINDINGS) | 730 | $(call QUIET_CLEAN, core-objs) $(RM) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(LANG_BINDINGS) |
731 | $(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete | 731 | $(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete |
732 | $(Q)$(RM) $(OUTPUT).config-detected | 732 | $(Q)$(RM) $(OUTPUT).config-detected |
733 | $(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32 $(OUTPUT)pmu-events/jevents $(OUTPUT)$(LIBJVMTI).so | 733 | $(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32 $(OUTPUT)pmu-events/jevents $(OUTPUT)$(LIBJVMTI).so |
734 | $(call QUIET_CLEAN, core-gen) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* \ | 734 | $(call QUIET_CLEAN, core-gen) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* \ |
735 | $(OUTPUT)util/intel-pt-decoder/inat-tables.c $(OUTPUT)fixdep \ | 735 | $(OUTPUT)util/intel-pt-decoder/inat-tables.c \ |
736 | $(OUTPUT)tests/llvm-src-{base,kbuild,prologue,relocation}.c \ | 736 | $(OUTPUT)tests/llvm-src-{base,kbuild,prologue,relocation}.c \ |
737 | $(OUTPUT)pmu-events/pmu-events.c | 737 | $(OUTPUT)pmu-events/pmu-events.c |
738 | $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean | 738 | $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean |
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index ebb628332a6e..4f52d85f5ebc 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -410,6 +410,7 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused) | |||
410 | OPT_BOOLEAN('f', "force", &file.force, "don't complain, do it"), | 410 | OPT_BOOLEAN('f', "force", &file.force, "don't complain, do it"), |
411 | OPT_INCR('v', "verbose", &verbose, | 411 | OPT_INCR('v', "verbose", &verbose, |
412 | "be more verbose (show symbol address, etc)"), | 412 | "be more verbose (show symbol address, etc)"), |
413 | OPT_BOOLEAN('q', "quiet", &quiet, "do now show any message"), | ||
413 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, | 414 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, |
414 | "dump raw trace in ASCII"), | 415 | "dump raw trace in ASCII"), |
415 | OPT_BOOLEAN(0, "gtk", &annotate.use_gtk, "Use the GTK interface"), | 416 | OPT_BOOLEAN(0, "gtk", &annotate.use_gtk, "Use the GTK interface"), |
@@ -463,6 +464,9 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused) | |||
463 | annotate.sym_hist_filter = argv[0]; | 464 | annotate.sym_hist_filter = argv[0]; |
464 | } | 465 | } |
465 | 466 | ||
467 | if (quiet) | ||
468 | perf_quiet_option(); | ||
469 | |||
466 | file.path = input_name; | 470 | file.path = input_name; |
467 | 471 | ||
468 | annotate.session = perf_session__new(&file, false, &annotate.tool); | 472 | annotate.session = perf_session__new(&file, false, &annotate.tool); |
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 70a289347591..1b96a3122228 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c | |||
@@ -691,7 +691,7 @@ static void hists__process(struct hists *hists) | |||
691 | hists__precompute(hists); | 691 | hists__precompute(hists); |
692 | hists__output_resort(hists, NULL); | 692 | hists__output_resort(hists, NULL); |
693 | 693 | ||
694 | hists__fprintf(hists, true, 0, 0, 0, stdout, | 694 | hists__fprintf(hists, !quiet, 0, 0, 0, stdout, |
695 | symbol_conf.use_callchain); | 695 | symbol_conf.use_callchain); |
696 | } | 696 | } |
697 | 697 | ||
@@ -739,12 +739,14 @@ static void data_process(void) | |||
739 | hists__link(hists_base, hists); | 739 | hists__link(hists_base, hists); |
740 | } | 740 | } |
741 | 741 | ||
742 | fprintf(stdout, "%s# Event '%s'\n#\n", first ? "" : "\n", | 742 | if (!quiet) { |
743 | perf_evsel__name(evsel_base)); | 743 | fprintf(stdout, "%s# Event '%s'\n#\n", first ? "" : "\n", |
744 | perf_evsel__name(evsel_base)); | ||
745 | } | ||
744 | 746 | ||
745 | first = false; | 747 | first = false; |
746 | 748 | ||
747 | if (verbose || data__files_cnt > 2) | 749 | if (verbose > 0 || ((data__files_cnt > 2) && !quiet)) |
748 | data__fprintf(); | 750 | data__fprintf(); |
749 | 751 | ||
750 | /* Don't sort callchain for perf diff */ | 752 | /* Don't sort callchain for perf diff */ |
@@ -807,6 +809,7 @@ static const char * const diff_usage[] = { | |||
807 | static const struct option options[] = { | 809 | static const struct option options[] = { |
808 | OPT_INCR('v', "verbose", &verbose, | 810 | OPT_INCR('v', "verbose", &verbose, |
809 | "be more verbose (show symbol address, etc)"), | 811 | "be more verbose (show symbol address, etc)"), |
812 | OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any message"), | ||
810 | OPT_BOOLEAN('b', "baseline-only", &show_baseline_only, | 813 | OPT_BOOLEAN('b', "baseline-only", &show_baseline_only, |
811 | "Show only items with match in baseline"), | 814 | "Show only items with match in baseline"), |
812 | OPT_CALLBACK('c', "compute", &compute, | 815 | OPT_CALLBACK('c', "compute", &compute, |
@@ -1328,6 +1331,9 @@ int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1328 | 1331 | ||
1329 | argc = parse_options(argc, argv, options, diff_usage, 0); | 1332 | argc = parse_options(argc, argv, options, diff_usage, 0); |
1330 | 1333 | ||
1334 | if (quiet) | ||
1335 | perf_quiet_option(); | ||
1336 | |||
1331 | if (symbol__init(NULL) < 0) | 1337 | if (symbol__init(NULL) < 0) |
1332 | return -1; | 1338 | return -1; |
1333 | 1339 | ||
diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c index cd7bc4d104e2..6114e07ca613 100644 --- a/tools/perf/builtin-mem.c +++ b/tools/perf/builtin-mem.c | |||
@@ -42,8 +42,8 @@ static int parse_record_events(const struct option *opt, | |||
42 | 42 | ||
43 | fprintf(stderr, "%-13s%-*s%s\n", | 43 | fprintf(stderr, "%-13s%-*s%s\n", |
44 | e->tag, | 44 | e->tag, |
45 | verbose ? 25 : 0, | 45 | verbose > 0 ? 25 : 0, |
46 | verbose ? perf_mem_events__name(j) : "", | 46 | verbose > 0 ? perf_mem_events__name(j) : "", |
47 | e->supported ? ": available" : ""); | 47 | e->supported ? ": available" : ""); |
48 | } | 48 | } |
49 | exit(0); | 49 | exit(0); |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 6cd6776052e7..bc84a375295d 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -432,7 +432,7 @@ static int record__open(struct record *rec) | |||
432 | try_again: | 432 | try_again: |
433 | if (perf_evsel__open(pos, pos->cpus, pos->threads) < 0) { | 433 | if (perf_evsel__open(pos, pos->cpus, pos->threads) < 0) { |
434 | if (perf_evsel__fallback(pos, errno, msg, sizeof(msg))) { | 434 | if (perf_evsel__fallback(pos, errno, msg, sizeof(msg))) { |
435 | if (verbose) | 435 | if (verbose > 0) |
436 | ui__warning("%s\n", msg); | 436 | ui__warning("%s\n", msg); |
437 | goto try_again; | 437 | goto try_again; |
438 | } | 438 | } |
@@ -1677,8 +1677,12 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1677 | 1677 | ||
1678 | argc = parse_options(argc, argv, record_options, record_usage, | 1678 | argc = parse_options(argc, argv, record_options, record_usage, |
1679 | PARSE_OPT_STOP_AT_NON_OPTION); | 1679 | PARSE_OPT_STOP_AT_NON_OPTION); |
1680 | if (quiet) | ||
1681 | perf_quiet_option(); | ||
1682 | |||
1683 | /* Make system wide (-a) the default target. */ | ||
1680 | if (!argc && target__none(&rec->opts.target)) | 1684 | if (!argc && target__none(&rec->opts.target)) |
1681 | usage_with_options(record_usage, record_options); | 1685 | rec->opts.target.system_wide = true; |
1682 | 1686 | ||
1683 | if (nr_cgroups && !rec->opts.target.system_wide) { | 1687 | if (nr_cgroups && !rec->opts.target.system_wide) { |
1684 | usage_with_options_msg(record_usage, record_options, | 1688 | usage_with_options_msg(record_usage, record_options, |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index dbd7fa028861..0a88670e56f3 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -320,6 +320,9 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report | |||
320 | size_t size = sizeof(buf); | 320 | size_t size = sizeof(buf); |
321 | int socked_id = hists->socket_filter; | 321 | int socked_id = hists->socket_filter; |
322 | 322 | ||
323 | if (quiet) | ||
324 | return 0; | ||
325 | |||
323 | if (symbol_conf.filter_relative) { | 326 | if (symbol_conf.filter_relative) { |
324 | nr_samples = hists->stats.nr_non_filtered_samples; | 327 | nr_samples = hists->stats.nr_non_filtered_samples; |
325 | nr_events = hists->stats.total_non_filtered_period; | 328 | nr_events = hists->stats.total_non_filtered_period; |
@@ -372,7 +375,11 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist, | |||
372 | { | 375 | { |
373 | struct perf_evsel *pos; | 376 | struct perf_evsel *pos; |
374 | 377 | ||
375 | fprintf(stdout, "#\n# Total Lost Samples: %" PRIu64 "\n#\n", evlist->stats.total_lost_samples); | 378 | if (!quiet) { |
379 | fprintf(stdout, "#\n# Total Lost Samples: %" PRIu64 "\n#\n", | ||
380 | evlist->stats.total_lost_samples); | ||
381 | } | ||
382 | |||
376 | evlist__for_each_entry(evlist, pos) { | 383 | evlist__for_each_entry(evlist, pos) { |
377 | struct hists *hists = evsel__hists(pos); | 384 | struct hists *hists = evsel__hists(pos); |
378 | const char *evname = perf_evsel__name(pos); | 385 | const char *evname = perf_evsel__name(pos); |
@@ -382,7 +389,7 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist, | |||
382 | continue; | 389 | continue; |
383 | 390 | ||
384 | hists__fprintf_nr_sample_events(hists, rep, evname, stdout); | 391 | hists__fprintf_nr_sample_events(hists, rep, evname, stdout); |
385 | hists__fprintf(hists, true, 0, 0, rep->min_percent, stdout, | 392 | hists__fprintf(hists, !quiet, 0, 0, rep->min_percent, stdout, |
386 | symbol_conf.use_callchain); | 393 | symbol_conf.use_callchain); |
387 | fprintf(stdout, "\n\n"); | 394 | fprintf(stdout, "\n\n"); |
388 | } | 395 | } |
@@ -716,6 +723,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) | |||
716 | "input file name"), | 723 | "input file name"), |
717 | OPT_INCR('v', "verbose", &verbose, | 724 | OPT_INCR('v', "verbose", &verbose, |
718 | "be more verbose (show symbol address, etc)"), | 725 | "be more verbose (show symbol address, etc)"), |
726 | OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any message"), | ||
719 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, | 727 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, |
720 | "dump raw trace in ASCII"), | 728 | "dump raw trace in ASCII"), |
721 | OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name, | 729 | OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name, |
@@ -863,6 +871,9 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) | |||
863 | report.symbol_filter_str = argv[0]; | 871 | report.symbol_filter_str = argv[0]; |
864 | } | 872 | } |
865 | 873 | ||
874 | if (quiet) | ||
875 | perf_quiet_option(); | ||
876 | |||
866 | if (symbol_conf.vmlinux_name && | 877 | if (symbol_conf.vmlinux_name && |
867 | access(symbol_conf.vmlinux_name, R_OK)) { | 878 | access(symbol_conf.vmlinux_name, R_OK)) { |
868 | pr_err("Invalid file: %s\n", symbol_conf.vmlinux_name); | 879 | pr_err("Invalid file: %s\n", symbol_conf.vmlinux_name); |
@@ -983,14 +994,14 @@ repeat: | |||
983 | goto error; | 994 | goto error; |
984 | } | 995 | } |
985 | 996 | ||
986 | if (report.header || report.header_only) { | 997 | if ((report.header || report.header_only) && !quiet) { |
987 | perf_session__fprintf_info(session, stdout, | 998 | perf_session__fprintf_info(session, stdout, |
988 | report.show_full_info); | 999 | report.show_full_info); |
989 | if (report.header_only) { | 1000 | if (report.header_only) { |
990 | ret = 0; | 1001 | ret = 0; |
991 | goto error; | 1002 | goto error; |
992 | } | 1003 | } |
993 | } else if (use_browser == 0) { | 1004 | } else if (use_browser == 0 && !quiet) { |
994 | fputs("# To display the perf.data header info, please use --header/--header-only options.\n#\n", | 1005 | fputs("# To display the perf.data header info, please use --header/--header-only options.\n#\n", |
995 | stdout); | 1006 | stdout); |
996 | } | 1007 | } |
@@ -1009,7 +1020,7 @@ repeat: | |||
1009 | * providing it only in verbose mode not to bloat too | 1020 | * providing it only in verbose mode not to bloat too |
1010 | * much struct symbol. | 1021 | * much struct symbol. |
1011 | */ | 1022 | */ |
1012 | if (verbose) { | 1023 | if (verbose > 0) { |
1013 | /* | 1024 | /* |
1014 | * XXX: Need to provide a less kludgy way to ask for | 1025 | * XXX: Need to provide a less kludgy way to ask for |
1015 | * more space per symbol, the u32 is for the index on | 1026 | * more space per symbol, the u32 is for the index on |
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 270eb2d8ca6b..b94cf0de715a 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -460,7 +460,7 @@ static struct task_desc *register_pid(struct perf_sched *sched, | |||
460 | BUG_ON(!sched->tasks); | 460 | BUG_ON(!sched->tasks); |
461 | sched->tasks[task->nr] = task; | 461 | sched->tasks[task->nr] = task; |
462 | 462 | ||
463 | if (verbose) | 463 | if (verbose > 0) |
464 | printf("registered task #%ld, PID %ld (%s)\n", sched->nr_tasks, pid, comm); | 464 | printf("registered task #%ld, PID %ld (%s)\n", sched->nr_tasks, pid, comm); |
465 | 465 | ||
466 | return task; | 466 | return task; |
@@ -794,7 +794,7 @@ replay_wakeup_event(struct perf_sched *sched, | |||
794 | const u32 pid = perf_evsel__intval(evsel, sample, "pid"); | 794 | const u32 pid = perf_evsel__intval(evsel, sample, "pid"); |
795 | struct task_desc *waker, *wakee; | 795 | struct task_desc *waker, *wakee; |
796 | 796 | ||
797 | if (verbose) { | 797 | if (verbose > 0) { |
798 | printf("sched_wakeup event %p\n", evsel); | 798 | printf("sched_wakeup event %p\n", evsel); |
799 | 799 | ||
800 | printf(" ... pid %d woke up %s/%d\n", sample->tid, comm, pid); | 800 | printf(" ... pid %d woke up %s/%d\n", sample->tid, comm, pid); |
@@ -822,7 +822,7 @@ static int replay_switch_event(struct perf_sched *sched, | |||
822 | int cpu = sample->cpu; | 822 | int cpu = sample->cpu; |
823 | s64 delta; | 823 | s64 delta; |
824 | 824 | ||
825 | if (verbose) | 825 | if (verbose > 0) |
826 | printf("sched_switch event %p\n", evsel); | 826 | printf("sched_switch event %p\n", evsel); |
827 | 827 | ||
828 | if (cpu >= MAX_CPUS || cpu < 0) | 828 | if (cpu >= MAX_CPUS || cpu < 0) |
@@ -870,7 +870,7 @@ static int replay_fork_event(struct perf_sched *sched, | |||
870 | goto out_put; | 870 | goto out_put; |
871 | } | 871 | } |
872 | 872 | ||
873 | if (verbose) { | 873 | if (verbose > 0) { |
874 | printf("fork event\n"); | 874 | printf("fork event\n"); |
875 | printf("... parent: %s/%d\n", thread__comm_str(parent), parent->tid); | 875 | printf("... parent: %s/%d\n", thread__comm_str(parent), parent->tid); |
876 | printf("... child: %s/%d\n", thread__comm_str(child), child->tid); | 876 | printf("... child: %s/%d\n", thread__comm_str(child), child->tid); |
@@ -1573,7 +1573,7 @@ static int map_switch_event(struct perf_sched *sched, struct perf_evsel *evsel, | |||
1573 | 1573 | ||
1574 | timestamp__scnprintf_usec(timestamp, stimestamp, sizeof(stimestamp)); | 1574 | timestamp__scnprintf_usec(timestamp, stimestamp, sizeof(stimestamp)); |
1575 | color_fprintf(stdout, color, " %12s secs ", stimestamp); | 1575 | color_fprintf(stdout, color, " %12s secs ", stimestamp); |
1576 | if (new_shortname || (verbose && sched_in->tid)) { | 1576 | if (new_shortname || (verbose > 0 && sched_in->tid)) { |
1577 | const char *pid_color = color; | 1577 | const char *pid_color = color; |
1578 | 1578 | ||
1579 | if (thread__has_color(sched_in)) | 1579 | if (thread__has_color(sched_in)) |
@@ -2050,7 +2050,7 @@ static void save_task_callchain(struct perf_sched *sched, | |||
2050 | 2050 | ||
2051 | if (thread__resolve_callchain(thread, cursor, evsel, sample, | 2051 | if (thread__resolve_callchain(thread, cursor, evsel, sample, |
2052 | NULL, NULL, sched->max_stack + 2) != 0) { | 2052 | NULL, NULL, sched->max_stack + 2) != 0) { |
2053 | if (verbose) | 2053 | if (verbose > 0) |
2054 | error("Failed to resolve callchain. Skipping\n"); | 2054 | error("Failed to resolve callchain. Skipping\n"); |
2055 | 2055 | ||
2056 | return; | 2056 | return; |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index f28719178b51..13b54999ad79 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -573,7 +573,7 @@ try_again: | |||
573 | if (errno == EINVAL || errno == ENOSYS || | 573 | if (errno == EINVAL || errno == ENOSYS || |
574 | errno == ENOENT || errno == EOPNOTSUPP || | 574 | errno == ENOENT || errno == EOPNOTSUPP || |
575 | errno == ENXIO) { | 575 | errno == ENXIO) { |
576 | if (verbose) | 576 | if (verbose > 0) |
577 | ui__warning("%s event is not supported by the kernel.\n", | 577 | ui__warning("%s event is not supported by the kernel.\n", |
578 | perf_evsel__name(counter)); | 578 | perf_evsel__name(counter)); |
579 | counter->supported = false; | 579 | counter->supported = false; |
@@ -582,7 +582,7 @@ try_again: | |||
582 | !(counter->leader->nr_members > 1)) | 582 | !(counter->leader->nr_members > 1)) |
583 | continue; | 583 | continue; |
584 | } else if (perf_evsel__fallback(counter, errno, msg, sizeof(msg))) { | 584 | } else if (perf_evsel__fallback(counter, errno, msg, sizeof(msg))) { |
585 | if (verbose) | 585 | if (verbose > 0) |
586 | ui__warning("%s\n", msg); | 586 | ui__warning("%s\n", msg); |
587 | goto try_again; | 587 | goto try_again; |
588 | } | 588 | } |
@@ -1765,7 +1765,7 @@ static inline int perf_env__get_cpu(struct perf_env *env, struct cpu_map *map, i | |||
1765 | 1765 | ||
1766 | cpu = map->map[idx]; | 1766 | cpu = map->map[idx]; |
1767 | 1767 | ||
1768 | if (cpu >= env->nr_cpus_online) | 1768 | if (cpu >= env->nr_cpus_avail) |
1769 | return -1; | 1769 | return -1; |
1770 | 1770 | ||
1771 | return cpu; | 1771 | return cpu; |
@@ -2445,8 +2445,9 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused) | |||
2445 | } else if (big_num_opt == 0) /* User passed --no-big-num */ | 2445 | } else if (big_num_opt == 0) /* User passed --no-big-num */ |
2446 | big_num = false; | 2446 | big_num = false; |
2447 | 2447 | ||
2448 | /* Make system wide (-a) the default target. */ | ||
2448 | if (!argc && target__none(&target)) | 2449 | if (!argc && target__none(&target)) |
2449 | usage_with_options(stat_usage, stat_options); | 2450 | target.system_wide = true; |
2450 | 2451 | ||
2451 | if (run_count < 0) { | 2452 | if (run_count < 0) { |
2452 | pr_err("Run count must be a positive number\n"); | 2453 | pr_err("Run count must be a positive number\n"); |
@@ -2538,7 +2539,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused) | |||
2538 | 2539 | ||
2539 | status = 0; | 2540 | status = 0; |
2540 | for (run_idx = 0; forever || run_idx < run_count; run_idx++) { | 2541 | for (run_idx = 0; forever || run_idx < run_count; run_idx++) { |
2541 | if (run_count != 1 && verbose) | 2542 | if (run_count != 1 && verbose > 0) |
2542 | fprintf(output, "[ perf stat: executing run #%d ... ]\n", | 2543 | fprintf(output, "[ perf stat: executing run #%d ... ]\n", |
2543 | run_idx + 1); | 2544 | run_idx + 1); |
2544 | 2545 | ||
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 5a7fd7af3a6d..ab9077915763 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -871,7 +871,7 @@ try_again: | |||
871 | if (perf_evsel__open(counter, top->evlist->cpus, | 871 | if (perf_evsel__open(counter, top->evlist->cpus, |
872 | top->evlist->threads) < 0) { | 872 | top->evlist->threads) < 0) { |
873 | if (perf_evsel__fallback(counter, errno, msg, sizeof(msg))) { | 873 | if (perf_evsel__fallback(counter, errno, msg, sizeof(msg))) { |
874 | if (verbose) | 874 | if (verbose > 0) |
875 | ui__warning("%s\n", msg); | 875 | ui__warning("%s\n", msg); |
876 | goto try_again; | 876 | goto try_again; |
877 | } | 877 | } |
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 40ef9b293d1b..256f1fac6f7e 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -1399,7 +1399,7 @@ static struct syscall *trace__syscall_info(struct trace *trace, | |||
1399 | return &trace->syscalls.table[id]; | 1399 | return &trace->syscalls.table[id]; |
1400 | 1400 | ||
1401 | out_cant_read: | 1401 | out_cant_read: |
1402 | if (verbose) { | 1402 | if (verbose > 0) { |
1403 | fprintf(trace->output, "Problems reading syscall %d", id); | 1403 | fprintf(trace->output, "Problems reading syscall %d", id); |
1404 | if (id <= trace->syscalls.max && trace->syscalls.table[id].name != NULL) | 1404 | if (id <= trace->syscalls.max && trace->syscalls.table[id].name != NULL) |
1405 | fprintf(trace->output, "(%s)", trace->syscalls.table[id].name); | 1405 | fprintf(trace->output, "(%s)", trace->syscalls.table[id].name); |
@@ -1801,10 +1801,10 @@ static void print_location(FILE *f, struct perf_sample *sample, | |||
1801 | bool print_dso, bool print_sym) | 1801 | bool print_dso, bool print_sym) |
1802 | { | 1802 | { |
1803 | 1803 | ||
1804 | if ((verbose || print_dso) && al->map) | 1804 | if ((verbose > 0 || print_dso) && al->map) |
1805 | fprintf(f, "%s@", al->map->dso->long_name); | 1805 | fprintf(f, "%s@", al->map->dso->long_name); |
1806 | 1806 | ||
1807 | if ((verbose || print_sym) && al->sym) | 1807 | if ((verbose > 0 || print_sym) && al->sym) |
1808 | fprintf(f, "%s+0x%" PRIx64, al->sym->name, | 1808 | fprintf(f, "%s+0x%" PRIx64, al->sym->name, |
1809 | al->addr - al->sym->start); | 1809 | al->addr - al->sym->start); |
1810 | else if (al->map) | 1810 | else if (al->map) |
diff --git a/tools/perf/pmu-events/json.c b/tools/perf/pmu-events/json.c index f67bbb0aa36e..0544398d6e2d 100644 --- a/tools/perf/pmu-events/json.c +++ b/tools/perf/pmu-events/json.c | |||
@@ -49,7 +49,7 @@ static char *mapfile(const char *fn, size_t *size) | |||
49 | int err; | 49 | int err; |
50 | int fd = open(fn, O_RDONLY); | 50 | int fd = open(fn, O_RDONLY); |
51 | 51 | ||
52 | if (fd < 0 && verbose && fn) { | 52 | if (fd < 0 && verbose > 0 && fn) { |
53 | pr_err("Error opening events file '%s': %s\n", fn, | 53 | pr_err("Error opening events file '%s': %s\n", fn, |
54 | strerror(errno)); | 54 | strerror(errno)); |
55 | } | 55 | } |
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c index 28d1605b0338..88dc51f4c27b 100644 --- a/tools/perf/tests/attr.c +++ b/tools/perf/tests/attr.c | |||
@@ -144,7 +144,7 @@ static int run_dir(const char *d, const char *perf) | |||
144 | int vcnt = min(verbose, (int) sizeof(v) - 1); | 144 | int vcnt = min(verbose, (int) sizeof(v) - 1); |
145 | char cmd[3*PATH_MAX]; | 145 | char cmd[3*PATH_MAX]; |
146 | 146 | ||
147 | if (verbose) | 147 | if (verbose > 0) |
148 | vcnt++; | 148 | vcnt++; |
149 | 149 | ||
150 | snprintf(cmd, 3*PATH_MAX, PYTHON " %s/attr.py -d %s/attr/ -p %s %.*s", | 150 | snprintf(cmd, 3*PATH_MAX, PYTHON " %s/attr.py -d %s/attr/ -p %s %.*s", |
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c index 37e326bfd2dc..83c4669cbc5b 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c | |||
@@ -299,7 +299,7 @@ static int run_test(struct test *test, int subtest) | |||
299 | if (!dont_fork) { | 299 | if (!dont_fork) { |
300 | pr_debug("test child forked, pid %d\n", getpid()); | 300 | pr_debug("test child forked, pid %d\n", getpid()); |
301 | 301 | ||
302 | if (!verbose) { | 302 | if (verbose <= 0) { |
303 | int nullfd = open("/dev/null", O_WRONLY); | 303 | int nullfd = open("/dev/null", O_WRONLY); |
304 | 304 | ||
305 | if (nullfd >= 0) { | 305 | if (nullfd >= 0) { |
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index ff5bc6363a79..d1f693041324 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c | |||
@@ -599,7 +599,7 @@ static int do_test_code_reading(bool try_kcore) | |||
599 | continue; | 599 | continue; |
600 | } | 600 | } |
601 | 601 | ||
602 | if (verbose) { | 602 | if (verbose > 0) { |
603 | char errbuf[512]; | 603 | char errbuf[512]; |
604 | perf_evlist__strerror_open(evlist, errno, errbuf, sizeof(errbuf)); | 604 | perf_evlist__strerror_open(evlist, errno, errbuf, sizeof(errbuf)); |
605 | pr_debug("perf_evlist__open() failed!\n%s\n", errbuf); | 605 | pr_debug("perf_evlist__open() failed!\n%s\n", errbuf); |
diff --git a/tools/perf/tests/fdarray.c b/tools/perf/tests/fdarray.c index a2b5ff9bf83d..bc5982f42dc3 100644 --- a/tools/perf/tests/fdarray.c +++ b/tools/perf/tests/fdarray.c | |||
@@ -19,7 +19,7 @@ static int fdarray__fprintf_prefix(struct fdarray *fda, const char *prefix, FILE | |||
19 | { | 19 | { |
20 | int printed = 0; | 20 | int printed = 0; |
21 | 21 | ||
22 | if (!verbose) | 22 | if (verbose <= 0) |
23 | return 0; | 23 | return 0; |
24 | 24 | ||
25 | printed += fprintf(fp, "\n%s: ", prefix); | 25 | printed += fprintf(fp, "\n%s: ", prefix); |
diff --git a/tools/perf/tests/llvm.c b/tools/perf/tests/llvm.c index d357dab72e68..482b5365e68d 100644 --- a/tools/perf/tests/llvm.c +++ b/tools/perf/tests/llvm.c | |||
@@ -76,7 +76,7 @@ test_llvm__fetch_bpf_obj(void **p_obj_buf, | |||
76 | * Skip this test if user's .perfconfig doesn't set [llvm] section | 76 | * Skip this test if user's .perfconfig doesn't set [llvm] section |
77 | * and clang is not found in $PATH, and this is not perf test -v | 77 | * and clang is not found in $PATH, and this is not perf test -v |
78 | */ | 78 | */ |
79 | if (!force && (verbose == 0 && | 79 | if (!force && (verbose <= 0 && |
80 | !llvm_param.user_set_param && | 80 | !llvm_param.user_set_param && |
81 | llvm__search_clang())) { | 81 | llvm__search_clang())) { |
82 | pr_debug("No clang and no verbosive, skip this test\n"); | 82 | pr_debug("No clang and no verbosive, skip this test\n"); |
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index aa9276bfe3e9..1dc838014422 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c | |||
@@ -1808,7 +1808,7 @@ static void debug_warn(const char *warn, va_list params) | |||
1808 | { | 1808 | { |
1809 | char msg[1024]; | 1809 | char msg[1024]; |
1810 | 1810 | ||
1811 | if (!verbose) | 1811 | if (verbose <= 0) |
1812 | return; | 1812 | return; |
1813 | 1813 | ||
1814 | vsnprintf(msg, sizeof(msg), warn, params); | 1814 | vsnprintf(msg, sizeof(msg), warn, params); |
diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c index 541da7a68f91..87893f3ba5f1 100644 --- a/tools/perf/tests/perf-record.c +++ b/tools/perf/tests/perf-record.c | |||
@@ -172,13 +172,13 @@ int test__PERF_RECORD(int subtest __maybe_unused) | |||
172 | 172 | ||
173 | err = perf_evlist__parse_sample(evlist, event, &sample); | 173 | err = perf_evlist__parse_sample(evlist, event, &sample); |
174 | if (err < 0) { | 174 | if (err < 0) { |
175 | if (verbose) | 175 | if (verbose > 0) |
176 | perf_event__fprintf(event, stderr); | 176 | perf_event__fprintf(event, stderr); |
177 | pr_debug("Couldn't parse sample\n"); | 177 | pr_debug("Couldn't parse sample\n"); |
178 | goto out_delete_evlist; | 178 | goto out_delete_evlist; |
179 | } | 179 | } |
180 | 180 | ||
181 | if (verbose) { | 181 | if (verbose > 0) { |
182 | pr_info("%" PRIu64" %d ", sample.time, sample.cpu); | 182 | pr_info("%" PRIu64" %d ", sample.time, sample.cpu); |
183 | perf_event__fprintf(event, stderr); | 183 | perf_event__fprintf(event, stderr); |
184 | } | 184 | } |
diff --git a/tools/perf/tests/python-use.c b/tools/perf/tests/python-use.c index 7a52834ee0d0..fa79509da535 100644 --- a/tools/perf/tests/python-use.c +++ b/tools/perf/tests/python-use.c | |||
@@ -15,7 +15,7 @@ int test__python_use(int subtest __maybe_unused) | |||
15 | int ret; | 15 | int ret; |
16 | 16 | ||
17 | if (asprintf(&cmd, "echo \"import sys ; sys.path.append('%s'); import perf\" | %s %s", | 17 | if (asprintf(&cmd, "echo \"import sys ; sys.path.append('%s'); import perf\" | %s %s", |
18 | PYTHONPATH, PYTHON, verbose ? "" : "2> /dev/null") < 0) | 18 | PYTHONPATH, PYTHON, verbose > 0 ? "" : "2> /dev/null") < 0) |
19 | return -1; | 19 | return -1; |
20 | 20 | ||
21 | ret = system(cmd) ? -1 : 0; | 21 | ret = system(cmd) ? -1 : 0; |
diff --git a/tools/perf/tests/thread-map.c b/tools/perf/tests/thread-map.c index a4a4b4625ac3..f2d2e542d0ee 100644 --- a/tools/perf/tests/thread-map.c +++ b/tools/perf/tests/thread-map.c | |||
@@ -109,7 +109,7 @@ int test__thread_map_remove(int subtest __maybe_unused) | |||
109 | TEST_ASSERT_VAL("failed to allocate thread_map", | 109 | TEST_ASSERT_VAL("failed to allocate thread_map", |
110 | threads); | 110 | threads); |
111 | 111 | ||
112 | if (verbose) | 112 | if (verbose > 0) |
113 | thread_map__fprintf(threads, stderr); | 113 | thread_map__fprintf(threads, stderr); |
114 | 114 | ||
115 | TEST_ASSERT_VAL("failed to remove thread", | 115 | TEST_ASSERT_VAL("failed to remove thread", |
@@ -117,7 +117,7 @@ int test__thread_map_remove(int subtest __maybe_unused) | |||
117 | 117 | ||
118 | TEST_ASSERT_VAL("thread_map count != 1", threads->nr == 1); | 118 | TEST_ASSERT_VAL("thread_map count != 1", threads->nr == 1); |
119 | 119 | ||
120 | if (verbose) | 120 | if (verbose > 0) |
121 | thread_map__fprintf(threads, stderr); | 121 | thread_map__fprintf(threads, stderr); |
122 | 122 | ||
123 | TEST_ASSERT_VAL("failed to remove thread", | 123 | TEST_ASSERT_VAL("failed to remove thread", |
@@ -125,7 +125,7 @@ int test__thread_map_remove(int subtest __maybe_unused) | |||
125 | 125 | ||
126 | TEST_ASSERT_VAL("thread_map count != 0", threads->nr == 0); | 126 | TEST_ASSERT_VAL("thread_map count != 0", threads->nr == 0); |
127 | 127 | ||
128 | if (verbose) | 128 | if (verbose > 0) |
129 | thread_map__fprintf(threads, stderr); | 129 | thread_map__fprintf(threads, stderr); |
130 | 130 | ||
131 | TEST_ASSERT_VAL("failed to not remove thread", | 131 | TEST_ASSERT_VAL("failed to not remove thread", |
diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c index 98fe69ac553c..803f893550d6 100644 --- a/tools/perf/tests/topology.c +++ b/tools/perf/tests/topology.c | |||
@@ -65,7 +65,9 @@ static int check_cpu_topology(char *path, struct cpu_map *map) | |||
65 | session = perf_session__new(&file, false, NULL); | 65 | session = perf_session__new(&file, false, NULL); |
66 | TEST_ASSERT_VAL("can't get session", session); | 66 | TEST_ASSERT_VAL("can't get session", session); |
67 | 67 | ||
68 | for (i = 0; i < session->header.env.nr_cpus_online; i++) { | 68 | for (i = 0; i < session->header.env.nr_cpus_avail; i++) { |
69 | if (!cpu_map__has(map, i)) | ||
70 | continue; | ||
69 | pr_debug("CPU %d, core %d, socket %d\n", i, | 71 | pr_debug("CPU %d, core %d, socket %d\n", i, |
70 | session->header.env.cpu[i].core_id, | 72 | session->header.env.cpu[i].core_id, |
71 | session->header.env.cpu[i].socket_id); | 73 | session->header.env.cpu[i].socket_id); |
diff --git a/tools/perf/tests/vmlinux-kallsyms.c b/tools/perf/tests/vmlinux-kallsyms.c index a5082331f246..862b043e5924 100644 --- a/tools/perf/tests/vmlinux-kallsyms.c +++ b/tools/perf/tests/vmlinux-kallsyms.c | |||
@@ -168,7 +168,7 @@ next_pair: | |||
168 | err = -1; | 168 | err = -1; |
169 | } | 169 | } |
170 | 170 | ||
171 | if (!verbose) | 171 | if (verbose <= 0) |
172 | goto out; | 172 | goto out; |
173 | 173 | ||
174 | header_printed = false; | 174 | header_printed = false; |
diff --git a/tools/perf/ui/browsers/map.c b/tools/perf/ui/browsers/map.c index 98a34664bb7e..9ce142de536d 100644 --- a/tools/perf/ui/browsers/map.c +++ b/tools/perf/ui/browsers/map.c | |||
@@ -73,7 +73,7 @@ static int map_browser__run(struct map_browser *browser) | |||
73 | 73 | ||
74 | if (ui_browser__show(&browser->b, browser->map->dso->long_name, | 74 | if (ui_browser__show(&browser->b, browser->map->dso->long_name, |
75 | "Press ESC to exit, %s / to search", | 75 | "Press ESC to exit, %s / to search", |
76 | verbose ? "" : "restart with -v to use") < 0) | 76 | verbose > 0 ? "" : "restart with -v to use") < 0) |
77 | return -1; | 77 | return -1; |
78 | 78 | ||
79 | while (1) { | 79 | while (1) { |
@@ -81,7 +81,7 @@ static int map_browser__run(struct map_browser *browser) | |||
81 | 81 | ||
82 | switch (key) { | 82 | switch (key) { |
83 | case '/': | 83 | case '/': |
84 | if (verbose) | 84 | if (verbose > 0) |
85 | map_browser__search(browser); | 85 | map_browser__search(browser); |
86 | default: | 86 | default: |
87 | break; | 87 | break; |
@@ -117,7 +117,7 @@ int map__browse(struct map *map) | |||
117 | 117 | ||
118 | if (maxaddr < pos->end) | 118 | if (maxaddr < pos->end) |
119 | maxaddr = pos->end; | 119 | maxaddr = pos->end; |
120 | if (verbose) { | 120 | if (verbose > 0) { |
121 | u32 *idx = symbol__browser_index(pos); | 121 | u32 *idx = symbol__browser_index(pos); |
122 | *idx = mb.b.nr_entries; | 122 | *idx = mb.b.nr_entries; |
123 | } | 123 | } |
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index 18cfcdc90356..5d632dca672a 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c | |||
@@ -648,7 +648,7 @@ unsigned int hists__sort_list_width(struct hists *hists) | |||
648 | ret += fmt->width(fmt, &dummy_hpp, hists); | 648 | ret += fmt->width(fmt, &dummy_hpp, hists); |
649 | } | 649 | } |
650 | 650 | ||
651 | if (verbose && hists__has(hists, sym)) /* Addr + origin */ | 651 | if (verbose > 0 && hists__has(hists, sym)) /* Addr + origin */ |
652 | ret += 3 + BITS_PER_LONG / 4; | 652 | ret += 3 + BITS_PER_LONG / 4; |
653 | 653 | ||
654 | return ret; | 654 | return ret; |
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 06cc04e5806a..273f21fa32b5 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -1768,7 +1768,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, | |||
1768 | printf("%-*.*s----\n", | 1768 | printf("%-*.*s----\n", |
1769 | graph_dotted_len, graph_dotted_len, graph_dotted_line); | 1769 | graph_dotted_len, graph_dotted_len, graph_dotted_line); |
1770 | 1770 | ||
1771 | if (verbose) | 1771 | if (verbose > 0) |
1772 | symbol__annotate_hits(sym, evsel); | 1772 | symbol__annotate_hits(sym, evsel); |
1773 | 1773 | ||
1774 | list_for_each_entry(pos, ¬es->src->source, node) { | 1774 | list_for_each_entry(pos, ¬es->src->source, node) { |
diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c index 2c0b52264a46..8c7504939113 100644 --- a/tools/perf/util/cpumap.c +++ b/tools/perf/util/cpumap.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include "asm/bug.h" | 9 | #include "asm/bug.h" |
10 | 10 | ||
11 | static int max_cpu_num; | 11 | static int max_cpu_num; |
12 | static int max_present_cpu_num; | ||
12 | static int max_node_num; | 13 | static int max_node_num; |
13 | static int *cpunode_map; | 14 | static int *cpunode_map; |
14 | 15 | ||
@@ -442,6 +443,7 @@ static void set_max_cpu_num(void) | |||
442 | 443 | ||
443 | /* set up default */ | 444 | /* set up default */ |
444 | max_cpu_num = 4096; | 445 | max_cpu_num = 4096; |
446 | max_present_cpu_num = 4096; | ||
445 | 447 | ||
446 | mnt = sysfs__mountpoint(); | 448 | mnt = sysfs__mountpoint(); |
447 | if (!mnt) | 449 | if (!mnt) |
@@ -455,6 +457,17 @@ static void set_max_cpu_num(void) | |||
455 | } | 457 | } |
456 | 458 | ||
457 | ret = get_max_num(path, &max_cpu_num); | 459 | ret = get_max_num(path, &max_cpu_num); |
460 | if (ret) | ||
461 | goto out; | ||
462 | |||
463 | /* get the highest present cpu number for a sparse allocation */ | ||
464 | ret = snprintf(path, PATH_MAX, "%s/devices/system/cpu/present", mnt); | ||
465 | if (ret == PATH_MAX) { | ||
466 | pr_err("sysfs path crossed PATH_MAX(%d) size\n", PATH_MAX); | ||
467 | goto out; | ||
468 | } | ||
469 | |||
470 | ret = get_max_num(path, &max_present_cpu_num); | ||
458 | 471 | ||
459 | out: | 472 | out: |
460 | if (ret) | 473 | if (ret) |
@@ -505,6 +518,15 @@ int cpu__max_cpu(void) | |||
505 | return max_cpu_num; | 518 | return max_cpu_num; |
506 | } | 519 | } |
507 | 520 | ||
521 | int cpu__max_present_cpu(void) | ||
522 | { | ||
523 | if (unlikely(!max_present_cpu_num)) | ||
524 | set_max_cpu_num(); | ||
525 | |||
526 | return max_present_cpu_num; | ||
527 | } | ||
528 | |||
529 | |||
508 | int cpu__get_node(int cpu) | 530 | int cpu__get_node(int cpu) |
509 | { | 531 | { |
510 | if (unlikely(cpunode_map == NULL)) { | 532 | if (unlikely(cpunode_map == NULL)) { |
diff --git a/tools/perf/util/cpumap.h b/tools/perf/util/cpumap.h index 06bd689f5989..1a0549af8f5c 100644 --- a/tools/perf/util/cpumap.h +++ b/tools/perf/util/cpumap.h | |||
@@ -62,6 +62,7 @@ int cpu__setup_cpunode_map(void); | |||
62 | 62 | ||
63 | int cpu__max_node(void); | 63 | int cpu__max_node(void); |
64 | int cpu__max_cpu(void); | 64 | int cpu__max_cpu(void); |
65 | int cpu__max_present_cpu(void); | ||
65 | int cpu__get_node(int cpu); | 66 | int cpu__get_node(int cpu); |
66 | 67 | ||
67 | int cpu_map__build_map(struct cpu_map *cpus, struct cpu_map **res, | 68 | int cpu_map__build_map(struct cpu_map *cpus, struct cpu_map **res, |
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c index c1838b643108..03eb81f30d0d 100644 --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c | |||
@@ -203,11 +203,28 @@ int perf_debug_option(const char *str) | |||
203 | v = (v < 0) || (v > 10) ? 0 : v; | 203 | v = (v < 0) || (v > 10) ? 0 : v; |
204 | } | 204 | } |
205 | 205 | ||
206 | if (quiet) | ||
207 | v = -1; | ||
208 | |||
206 | *var->ptr = v; | 209 | *var->ptr = v; |
207 | free(s); | 210 | free(s); |
208 | return 0; | 211 | return 0; |
209 | } | 212 | } |
210 | 213 | ||
214 | int perf_quiet_option(void) | ||
215 | { | ||
216 | struct debug_variable *var = &debug_variables[0]; | ||
217 | |||
218 | /* disable all debug messages */ | ||
219 | while (var->name) { | ||
220 | *var->ptr = -1; | ||
221 | var++; | ||
222 | } | ||
223 | |||
224 | quiet = true; | ||
225 | return 0; | ||
226 | } | ||
227 | |||
211 | #define DEBUG_WRAPPER(__n, __l) \ | 228 | #define DEBUG_WRAPPER(__n, __l) \ |
212 | static int pr_ ## __n ## _wrapper(const char *fmt, ...) \ | 229 | static int pr_ ## __n ## _wrapper(const char *fmt, ...) \ |
213 | { \ | 230 | { \ |
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h index d242adc3d5a2..98832f5531d3 100644 --- a/tools/perf/util/debug.h +++ b/tools/perf/util/debug.h | |||
@@ -54,5 +54,6 @@ int veprintf(int level, int var, const char *fmt, va_list args); | |||
54 | 54 | ||
55 | int perf_debug_option(const char *str); | 55 | int perf_debug_option(const char *str); |
56 | void perf_debug_setup(void); | 56 | void perf_debug_setup(void); |
57 | int perf_quiet_option(void); | ||
57 | 58 | ||
58 | #endif /* __PERF_DEBUG_H */ | 59 | #endif /* __PERF_DEBUG_H */ |
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index 3abe3373ce90..d38b62a700ca 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c | |||
@@ -1058,7 +1058,7 @@ int dso__name_len(const struct dso *dso) | |||
1058 | { | 1058 | { |
1059 | if (!dso) | 1059 | if (!dso) |
1060 | return strlen("[unknown]"); | 1060 | return strlen("[unknown]"); |
1061 | if (verbose) | 1061 | if (verbose > 0) |
1062 | return dso->long_name_len; | 1062 | return dso->long_name_len; |
1063 | 1063 | ||
1064 | return dso->short_name_len; | 1064 | return dso->short_name_len; |
diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c index bb964e86b09d..075fc77286bf 100644 --- a/tools/perf/util/env.c +++ b/tools/perf/util/env.c | |||
@@ -66,7 +66,7 @@ int perf_env__read_cpu_topology_map(struct perf_env *env) | |||
66 | return 0; | 66 | return 0; |
67 | 67 | ||
68 | if (env->nr_cpus_avail == 0) | 68 | if (env->nr_cpus_avail == 0) |
69 | env->nr_cpus_avail = sysconf(_SC_NPROCESSORS_CONF); | 69 | env->nr_cpus_avail = cpu__max_present_cpu(); |
70 | 70 | ||
71 | nr_cpus = env->nr_cpus_avail; | 71 | nr_cpus = env->nr_cpus_avail; |
72 | if (nr_cpus == -1) | 72 | if (nr_cpus == -1) |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 3d12c16e5103..05714d548584 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -295,11 +295,7 @@ static int write_nrcpus(int fd, struct perf_header *h __maybe_unused, | |||
295 | u32 nrc, nra; | 295 | u32 nrc, nra; |
296 | int ret; | 296 | int ret; |
297 | 297 | ||
298 | nr = sysconf(_SC_NPROCESSORS_CONF); | 298 | nrc = cpu__max_present_cpu(); |
299 | if (nr < 0) | ||
300 | return -1; | ||
301 | |||
302 | nrc = (u32)(nr & UINT_MAX); | ||
303 | 299 | ||
304 | nr = sysconf(_SC_NPROCESSORS_ONLN); | 300 | nr = sysconf(_SC_NPROCESSORS_ONLN); |
305 | if (nr < 0) | 301 | if (nr < 0) |
@@ -505,24 +501,29 @@ static void free_cpu_topo(struct cpu_topo *tp) | |||
505 | 501 | ||
506 | static struct cpu_topo *build_cpu_topology(void) | 502 | static struct cpu_topo *build_cpu_topology(void) |
507 | { | 503 | { |
508 | struct cpu_topo *tp; | 504 | struct cpu_topo *tp = NULL; |
509 | void *addr; | 505 | void *addr; |
510 | u32 nr, i; | 506 | u32 nr, i; |
511 | size_t sz; | 507 | size_t sz; |
512 | long ncpus; | 508 | long ncpus; |
513 | int ret = -1; | 509 | int ret = -1; |
510 | struct cpu_map *map; | ||
514 | 511 | ||
515 | ncpus = sysconf(_SC_NPROCESSORS_CONF); | 512 | ncpus = cpu__max_present_cpu(); |
516 | if (ncpus < 0) | 513 | |
514 | /* build online CPU map */ | ||
515 | map = cpu_map__new(NULL); | ||
516 | if (map == NULL) { | ||
517 | pr_debug("failed to get system cpumap\n"); | ||
517 | return NULL; | 518 | return NULL; |
519 | } | ||
518 | 520 | ||
519 | nr = (u32)(ncpus & UINT_MAX); | 521 | nr = (u32)(ncpus & UINT_MAX); |
520 | 522 | ||
521 | sz = nr * sizeof(char *); | 523 | sz = nr * sizeof(char *); |
522 | |||
523 | addr = calloc(1, sizeof(*tp) + 2 * sz); | 524 | addr = calloc(1, sizeof(*tp) + 2 * sz); |
524 | if (!addr) | 525 | if (!addr) |
525 | return NULL; | 526 | goto out_free; |
526 | 527 | ||
527 | tp = addr; | 528 | tp = addr; |
528 | tp->cpu_nr = nr; | 529 | tp->cpu_nr = nr; |
@@ -532,10 +533,16 @@ static struct cpu_topo *build_cpu_topology(void) | |||
532 | tp->thread_siblings = addr; | 533 | tp->thread_siblings = addr; |
533 | 534 | ||
534 | for (i = 0; i < nr; i++) { | 535 | for (i = 0; i < nr; i++) { |
536 | if (!cpu_map__has(map, i)) | ||
537 | continue; | ||
538 | |||
535 | ret = build_cpu_topo(tp, i); | 539 | ret = build_cpu_topo(tp, i); |
536 | if (ret < 0) | 540 | if (ret < 0) |
537 | break; | 541 | break; |
538 | } | 542 | } |
543 | |||
544 | out_free: | ||
545 | cpu_map__put(map); | ||
539 | if (ret) { | 546 | if (ret) { |
540 | free_cpu_topo(tp); | 547 | free_cpu_topo(tp); |
541 | tp = NULL; | 548 | tp = NULL; |
@@ -1126,7 +1133,7 @@ static void print_cpu_topology(struct perf_header *ph, int fd __maybe_unused, | |||
1126 | { | 1133 | { |
1127 | int nr, i; | 1134 | int nr, i; |
1128 | char *str; | 1135 | char *str; |
1129 | int cpu_nr = ph->env.nr_cpus_online; | 1136 | int cpu_nr = ph->env.nr_cpus_avail; |
1130 | 1137 | ||
1131 | nr = ph->env.nr_sibling_cores; | 1138 | nr = ph->env.nr_sibling_cores; |
1132 | str = ph->env.sibling_cores; | 1139 | str = ph->env.sibling_cores; |
@@ -1781,7 +1788,7 @@ static int process_cpu_topology(struct perf_file_section *section, | |||
1781 | u32 nr, i; | 1788 | u32 nr, i; |
1782 | char *str; | 1789 | char *str; |
1783 | struct strbuf sb; | 1790 | struct strbuf sb; |
1784 | int cpu_nr = ph->env.nr_cpus_online; | 1791 | int cpu_nr = ph->env.nr_cpus_avail; |
1785 | u64 size = 0; | 1792 | u64 size = 0; |
1786 | 1793 | ||
1787 | ph->env.cpu = calloc(cpu_nr, sizeof(*ph->env.cpu)); | 1794 | ph->env.cpu = calloc(cpu_nr, sizeof(*ph->env.cpu)); |
@@ -1862,7 +1869,7 @@ static int process_cpu_topology(struct perf_file_section *section, | |||
1862 | if (ph->needs_swap) | 1869 | if (ph->needs_swap) |
1863 | nr = bswap_32(nr); | 1870 | nr = bswap_32(nr); |
1864 | 1871 | ||
1865 | if (nr > (u32)cpu_nr) { | 1872 | if (nr != (u32)-1 && nr > (u32)cpu_nr) { |
1866 | pr_debug("socket_id number is too big." | 1873 | pr_debug("socket_id number is too big." |
1867 | "You may need to upgrade the perf tool.\n"); | 1874 | "You may need to upgrade the perf tool.\n"); |
1868 | goto free_cpu; | 1875 | goto free_cpu; |
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 32c6a939e4cc..eaf72a938fb4 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -69,7 +69,7 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h) | |||
69 | */ | 69 | */ |
70 | if (h->ms.sym) { | 70 | if (h->ms.sym) { |
71 | symlen = h->ms.sym->namelen + 4; | 71 | symlen = h->ms.sym->namelen + 4; |
72 | if (verbose) | 72 | if (verbose > 0) |
73 | symlen += BITS_PER_LONG / 4 + 2 + 3; | 73 | symlen += BITS_PER_LONG / 4 + 2 + 3; |
74 | hists__new_col_len(hists, HISTC_SYMBOL, symlen); | 74 | hists__new_col_len(hists, HISTC_SYMBOL, symlen); |
75 | } else { | 75 | } else { |
@@ -93,7 +93,7 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h) | |||
93 | if (h->branch_info) { | 93 | if (h->branch_info) { |
94 | if (h->branch_info->from.sym) { | 94 | if (h->branch_info->from.sym) { |
95 | symlen = (int)h->branch_info->from.sym->namelen + 4; | 95 | symlen = (int)h->branch_info->from.sym->namelen + 4; |
96 | if (verbose) | 96 | if (verbose > 0) |
97 | symlen += BITS_PER_LONG / 4 + 2 + 3; | 97 | symlen += BITS_PER_LONG / 4 + 2 + 3; |
98 | hists__new_col_len(hists, HISTC_SYMBOL_FROM, symlen); | 98 | hists__new_col_len(hists, HISTC_SYMBOL_FROM, symlen); |
99 | 99 | ||
@@ -107,7 +107,7 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h) | |||
107 | 107 | ||
108 | if (h->branch_info->to.sym) { | 108 | if (h->branch_info->to.sym) { |
109 | symlen = (int)h->branch_info->to.sym->namelen + 4; | 109 | symlen = (int)h->branch_info->to.sym->namelen + 4; |
110 | if (verbose) | 110 | if (verbose > 0) |
111 | symlen += BITS_PER_LONG / 4 + 2 + 3; | 111 | symlen += BITS_PER_LONG / 4 + 2 + 3; |
112 | hists__new_col_len(hists, HISTC_SYMBOL_TO, symlen); | 112 | hists__new_col_len(hists, HISTC_SYMBOL_TO, symlen); |
113 | 113 | ||
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 281e44af31e2..67a8aebc67ab 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -2318,24 +2318,20 @@ int parse_events__is_hardcoded_term(struct parse_events_term *term) | |||
2318 | return term->type_term != PARSE_EVENTS__TERM_TYPE_USER; | 2318 | return term->type_term != PARSE_EVENTS__TERM_TYPE_USER; |
2319 | } | 2319 | } |
2320 | 2320 | ||
2321 | static int new_term(struct parse_events_term **_term, int type_val, | 2321 | static int new_term(struct parse_events_term **_term, |
2322 | int type_term, char *config, | 2322 | struct parse_events_term *temp, |
2323 | char *str, u64 num, int err_term, int err_val) | 2323 | char *str, u64 num) |
2324 | { | 2324 | { |
2325 | struct parse_events_term *term; | 2325 | struct parse_events_term *term; |
2326 | 2326 | ||
2327 | term = zalloc(sizeof(*term)); | 2327 | term = malloc(sizeof(*term)); |
2328 | if (!term) | 2328 | if (!term) |
2329 | return -ENOMEM; | 2329 | return -ENOMEM; |
2330 | 2330 | ||
2331 | *term = *temp; | ||
2331 | INIT_LIST_HEAD(&term->list); | 2332 | INIT_LIST_HEAD(&term->list); |
2332 | term->type_val = type_val; | ||
2333 | term->type_term = type_term; | ||
2334 | term->config = config; | ||
2335 | term->err_term = err_term; | ||
2336 | term->err_val = err_val; | ||
2337 | 2333 | ||
2338 | switch (type_val) { | 2334 | switch (term->type_val) { |
2339 | case PARSE_EVENTS__TERM_TYPE_NUM: | 2335 | case PARSE_EVENTS__TERM_TYPE_NUM: |
2340 | term->val.num = num; | 2336 | term->val.num = num; |
2341 | break; | 2337 | break; |
@@ -2353,15 +2349,22 @@ static int new_term(struct parse_events_term **_term, int type_val, | |||
2353 | 2349 | ||
2354 | int parse_events_term__num(struct parse_events_term **term, | 2350 | int parse_events_term__num(struct parse_events_term **term, |
2355 | int type_term, char *config, u64 num, | 2351 | int type_term, char *config, u64 num, |
2352 | bool no_value, | ||
2356 | void *loc_term_, void *loc_val_) | 2353 | void *loc_term_, void *loc_val_) |
2357 | { | 2354 | { |
2358 | YYLTYPE *loc_term = loc_term_; | 2355 | YYLTYPE *loc_term = loc_term_; |
2359 | YYLTYPE *loc_val = loc_val_; | 2356 | YYLTYPE *loc_val = loc_val_; |
2360 | 2357 | ||
2361 | return new_term(term, PARSE_EVENTS__TERM_TYPE_NUM, type_term, | 2358 | struct parse_events_term temp = { |
2362 | config, NULL, num, | 2359 | .type_val = PARSE_EVENTS__TERM_TYPE_NUM, |
2363 | loc_term ? loc_term->first_column : 0, | 2360 | .type_term = type_term, |
2364 | loc_val ? loc_val->first_column : 0); | 2361 | .config = config, |
2362 | .no_value = no_value, | ||
2363 | .err_term = loc_term ? loc_term->first_column : 0, | ||
2364 | .err_val = loc_val ? loc_val->first_column : 0, | ||
2365 | }; | ||
2366 | |||
2367 | return new_term(term, &temp, NULL, num); | ||
2365 | } | 2368 | } |
2366 | 2369 | ||
2367 | int parse_events_term__str(struct parse_events_term **term, | 2370 | int parse_events_term__str(struct parse_events_term **term, |
@@ -2371,37 +2374,45 @@ int parse_events_term__str(struct parse_events_term **term, | |||
2371 | YYLTYPE *loc_term = loc_term_; | 2374 | YYLTYPE *loc_term = loc_term_; |
2372 | YYLTYPE *loc_val = loc_val_; | 2375 | YYLTYPE *loc_val = loc_val_; |
2373 | 2376 | ||
2374 | return new_term(term, PARSE_EVENTS__TERM_TYPE_STR, type_term, | 2377 | struct parse_events_term temp = { |
2375 | config, str, 0, | 2378 | .type_val = PARSE_EVENTS__TERM_TYPE_STR, |
2376 | loc_term ? loc_term->first_column : 0, | 2379 | .type_term = type_term, |
2377 | loc_val ? loc_val->first_column : 0); | 2380 | .config = config, |
2381 | .err_term = loc_term ? loc_term->first_column : 0, | ||
2382 | .err_val = loc_val ? loc_val->first_column : 0, | ||
2383 | }; | ||
2384 | |||
2385 | return new_term(term, &temp, str, 0); | ||
2378 | } | 2386 | } |
2379 | 2387 | ||
2380 | int parse_events_term__sym_hw(struct parse_events_term **term, | 2388 | int parse_events_term__sym_hw(struct parse_events_term **term, |
2381 | char *config, unsigned idx) | 2389 | char *config, unsigned idx) |
2382 | { | 2390 | { |
2383 | struct event_symbol *sym; | 2391 | struct event_symbol *sym; |
2392 | struct parse_events_term temp = { | ||
2393 | .type_val = PARSE_EVENTS__TERM_TYPE_STR, | ||
2394 | .type_term = PARSE_EVENTS__TERM_TYPE_USER, | ||
2395 | .config = config ?: (char *) "event", | ||
2396 | }; | ||
2384 | 2397 | ||
2385 | BUG_ON(idx >= PERF_COUNT_HW_MAX); | 2398 | BUG_ON(idx >= PERF_COUNT_HW_MAX); |
2386 | sym = &event_symbols_hw[idx]; | 2399 | sym = &event_symbols_hw[idx]; |
2387 | 2400 | ||
2388 | if (config) | 2401 | return new_term(term, &temp, (char *) sym->symbol, 0); |
2389 | return new_term(term, PARSE_EVENTS__TERM_TYPE_STR, | ||
2390 | PARSE_EVENTS__TERM_TYPE_USER, config, | ||
2391 | (char *) sym->symbol, 0, 0, 0); | ||
2392 | else | ||
2393 | return new_term(term, PARSE_EVENTS__TERM_TYPE_STR, | ||
2394 | PARSE_EVENTS__TERM_TYPE_USER, | ||
2395 | (char *) "event", (char *) sym->symbol, | ||
2396 | 0, 0, 0); | ||
2397 | } | 2402 | } |
2398 | 2403 | ||
2399 | int parse_events_term__clone(struct parse_events_term **new, | 2404 | int parse_events_term__clone(struct parse_events_term **new, |
2400 | struct parse_events_term *term) | 2405 | struct parse_events_term *term) |
2401 | { | 2406 | { |
2402 | return new_term(new, term->type_val, term->type_term, term->config, | 2407 | struct parse_events_term temp = { |
2403 | term->val.str, term->val.num, | 2408 | .type_val = term->type_val, |
2404 | term->err_term, term->err_val); | 2409 | .type_term = term->type_term, |
2410 | .config = term->config, | ||
2411 | .err_term = term->err_term, | ||
2412 | .err_val = term->err_val, | ||
2413 | }; | ||
2414 | |||
2415 | return new_term(new, &temp, term->val.str, term->val.num); | ||
2405 | } | 2416 | } |
2406 | 2417 | ||
2407 | void parse_events_terms__purge(struct list_head *terms) | 2418 | void parse_events_terms__purge(struct list_head *terms) |
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index da246a3ddb69..1af6a267c21b 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h | |||
@@ -94,6 +94,7 @@ struct parse_events_term { | |||
94 | int type_term; | 94 | int type_term; |
95 | struct list_head list; | 95 | struct list_head list; |
96 | bool used; | 96 | bool used; |
97 | bool no_value; | ||
97 | 98 | ||
98 | /* error string indexes for within parsed string */ | 99 | /* error string indexes for within parsed string */ |
99 | int err_term; | 100 | int err_term; |
@@ -122,6 +123,7 @@ void parse_events__shrink_config_terms(void); | |||
122 | int parse_events__is_hardcoded_term(struct parse_events_term *term); | 123 | int parse_events__is_hardcoded_term(struct parse_events_term *term); |
123 | int parse_events_term__num(struct parse_events_term **term, | 124 | int parse_events_term__num(struct parse_events_term **term, |
124 | int type_term, char *config, u64 num, | 125 | int type_term, char *config, u64 num, |
126 | bool novalue, | ||
125 | void *loc_term, void *loc_val); | 127 | void *loc_term, void *loc_val); |
126 | int parse_events_term__str(struct parse_events_term **term, | 128 | int parse_events_term__str(struct parse_events_term **term, |
127 | int type_term, char *config, char *str, | 129 | int type_term, char *config, char *str, |
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index a14b47ab3879..30f018ea1370 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y | |||
@@ -252,7 +252,7 @@ PE_KERNEL_PMU_EVENT sep_dc | |||
252 | if (!strcasecmp(alias->name, $1)) { | 252 | if (!strcasecmp(alias->name, $1)) { |
253 | ALLOC_LIST(head); | 253 | ALLOC_LIST(head); |
254 | ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, | 254 | ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, |
255 | $1, 1, &@1, NULL)); | 255 | $1, 1, false, &@1, NULL)); |
256 | list_add_tail(&term->list, head); | 256 | list_add_tail(&term->list, head); |
257 | 257 | ||
258 | if (!parse_events_add_pmu(data, list, | 258 | if (!parse_events_add_pmu(data, list, |
@@ -282,7 +282,7 @@ PE_PMU_EVENT_PRE '-' PE_PMU_EVENT_SUF sep_dc | |||
282 | 282 | ||
283 | ALLOC_LIST(head); | 283 | ALLOC_LIST(head); |
284 | ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, | 284 | ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, |
285 | &pmu_name, 1, &@1, NULL)); | 285 | &pmu_name, 1, false, &@1, NULL)); |
286 | list_add_tail(&term->list, head); | 286 | list_add_tail(&term->list, head); |
287 | 287 | ||
288 | ALLOC_LIST(list); | 288 | ALLOC_LIST(list); |
@@ -548,7 +548,7 @@ PE_NAME '=' PE_VALUE | |||
548 | struct parse_events_term *term; | 548 | struct parse_events_term *term; |
549 | 549 | ||
550 | ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, | 550 | ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, |
551 | $1, $3, &@1, &@3)); | 551 | $1, $3, false, &@1, &@3)); |
552 | $$ = term; | 552 | $$ = term; |
553 | } | 553 | } |
554 | | | 554 | | |
@@ -566,7 +566,7 @@ PE_NAME | |||
566 | struct parse_events_term *term; | 566 | struct parse_events_term *term; |
567 | 567 | ||
568 | ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, | 568 | ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, |
569 | $1, 1, &@1, NULL)); | 569 | $1, 1, true, &@1, NULL)); |
570 | $$ = term; | 570 | $$ = term; |
571 | } | 571 | } |
572 | | | 572 | | |
@@ -591,7 +591,7 @@ PE_TERM '=' PE_VALUE | |||
591 | { | 591 | { |
592 | struct parse_events_term *term; | 592 | struct parse_events_term *term; |
593 | 593 | ||
594 | ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, $3, &@1, &@3)); | 594 | ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, $3, false, &@1, &@3)); |
595 | $$ = term; | 595 | $$ = term; |
596 | } | 596 | } |
597 | | | 597 | | |
@@ -599,7 +599,7 @@ PE_TERM | |||
599 | { | 599 | { |
600 | struct parse_events_term *term; | 600 | struct parse_events_term *term; |
601 | 601 | ||
602 | ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, 1, &@1, NULL)); | 602 | ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, 1, true, &@1, NULL)); |
603 | $$ = term; | 603 | $$ = term; |
604 | } | 604 | } |
605 | | | 605 | | |
@@ -620,7 +620,7 @@ PE_NAME array '=' PE_VALUE | |||
620 | struct parse_events_term *term; | 620 | struct parse_events_term *term; |
621 | 621 | ||
622 | ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, | 622 | ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, |
623 | $1, $4, &@1, &@4)); | 623 | $1, $4, false, &@1, &@4)); |
624 | term->array = $2; | 624 | term->array = $2; |
625 | $$ = term; | 625 | $$ = term; |
626 | } | 626 | } |
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 49bfee0e3d9e..12f84dd2ac5d 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c | |||
@@ -745,7 +745,7 @@ static int pmu_resolve_param_term(struct parse_events_term *term, | |||
745 | } | 745 | } |
746 | } | 746 | } |
747 | 747 | ||
748 | if (verbose) | 748 | if (verbose > 0) |
749 | printf("Required parameter '%s' not specified\n", term->config); | 749 | printf("Required parameter '%s' not specified\n", term->config); |
750 | 750 | ||
751 | return -1; | 751 | return -1; |
@@ -803,7 +803,7 @@ static int pmu_config_term(struct list_head *formats, | |||
803 | 803 | ||
804 | format = pmu_find_format(formats, term->config); | 804 | format = pmu_find_format(formats, term->config); |
805 | if (!format) { | 805 | if (!format) { |
806 | if (verbose) | 806 | if (verbose > 0) |
807 | printf("Invalid event/parameter '%s'\n", term->config); | 807 | printf("Invalid event/parameter '%s'\n", term->config); |
808 | if (err) { | 808 | if (err) { |
809 | char *pmu_term = pmu_formats_string(formats); | 809 | char *pmu_term = pmu_formats_string(formats); |
@@ -834,11 +834,20 @@ static int pmu_config_term(struct list_head *formats, | |||
834 | * Either directly use a numeric term, or try to translate string terms | 834 | * Either directly use a numeric term, or try to translate string terms |
835 | * using event parameters. | 835 | * using event parameters. |
836 | */ | 836 | */ |
837 | if (term->type_val == PARSE_EVENTS__TERM_TYPE_NUM) | 837 | if (term->type_val == PARSE_EVENTS__TERM_TYPE_NUM) { |
838 | if (term->no_value && | ||
839 | bitmap_weight(format->bits, PERF_PMU_FORMAT_BITS) > 1) { | ||
840 | if (err) { | ||
841 | err->idx = term->err_val; | ||
842 | err->str = strdup("no value assigned for term"); | ||
843 | } | ||
844 | return -EINVAL; | ||
845 | } | ||
846 | |||
838 | val = term->val.num; | 847 | val = term->val.num; |
839 | else if (term->type_val == PARSE_EVENTS__TERM_TYPE_STR) { | 848 | } else if (term->type_val == PARSE_EVENTS__TERM_TYPE_STR) { |
840 | if (strcmp(term->val.str, "?")) { | 849 | if (strcmp(term->val.str, "?")) { |
841 | if (verbose) { | 850 | if (verbose > 0) { |
842 | pr_info("Invalid sysfs entry %s=%s\n", | 851 | pr_info("Invalid sysfs entry %s=%s\n", |
843 | term->config, term->val.str); | 852 | term->config, term->val.str); |
844 | } | 853 | } |
@@ -1223,7 +1232,7 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag, | |||
1223 | printf("%*s", 8, "["); | 1232 | printf("%*s", 8, "["); |
1224 | wordwrap(aliases[j].desc, 8, columns, 0); | 1233 | wordwrap(aliases[j].desc, 8, columns, 0); |
1225 | printf("]\n"); | 1234 | printf("]\n"); |
1226 | if (verbose) | 1235 | if (verbose > 0) |
1227 | printf("%*s%s/%s/\n", 8, "", aliases[j].pmu, aliases[j].str); | 1236 | printf("%*s%s/%s/\n", 8, "", aliases[j].pmu, aliases[j].str); |
1228 | } else | 1237 | } else |
1229 | printf(" %-50s [Kernel PMU event]\n", aliases[j].name); | 1238 | printf(" %-50s [Kernel PMU event]\n", aliases[j].name); |
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 35f5b7b7715c..28fb62c32678 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -594,7 +594,7 @@ static int find_perf_probe_point_from_dwarf(struct probe_trace_point *tp, | |||
594 | pr_debug("try to find information at %" PRIx64 " in %s\n", addr, | 594 | pr_debug("try to find information at %" PRIx64 " in %s\n", addr, |
595 | tp->module ? : "kernel"); | 595 | tp->module ? : "kernel"); |
596 | 596 | ||
597 | dinfo = debuginfo_cache__open(tp->module, verbose == 0); | 597 | dinfo = debuginfo_cache__open(tp->module, verbose <= 0); |
598 | if (dinfo) | 598 | if (dinfo) |
599 | ret = debuginfo__find_probe_point(dinfo, | 599 | ret = debuginfo__find_probe_point(dinfo, |
600 | (unsigned long)addr, pp); | 600 | (unsigned long)addr, pp); |
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index 581e0efd6356..783326cfbaa6 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c | |||
@@ -369,10 +369,10 @@ static PyObject *python_process_callchain(struct perf_sample *sample, | |||
369 | if (node->map) { | 369 | if (node->map) { |
370 | struct map *map = node->map; | 370 | struct map *map = node->map; |
371 | const char *dsoname = "[unknown]"; | 371 | const char *dsoname = "[unknown]"; |
372 | if (map && map->dso && (map->dso->name || map->dso->long_name)) { | 372 | if (map && map->dso) { |
373 | if (symbol_conf.show_kernel_path && map->dso->long_name) | 373 | if (symbol_conf.show_kernel_path && map->dso->long_name) |
374 | dsoname = map->dso->long_name; | 374 | dsoname = map->dso->long_name; |
375 | else if (map->dso->name) | 375 | else |
376 | dsoname = map->dso->name; | 376 | dsoname = map->dso->name; |
377 | } | 377 | } |
378 | pydict_set_item_string_decref(pyelem, "dso", | 378 | pydict_set_item_string_decref(pyelem, "dso", |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 4cdbc8f5f14d..1dd617d116b5 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -932,7 +932,7 @@ static void branch_stack__printf(struct perf_sample *sample) | |||
932 | 932 | ||
933 | printf("..... %2"PRIu64": %016" PRIx64 " -> %016" PRIx64 " %hu cycles %s%s%s%s %x\n", | 933 | printf("..... %2"PRIu64": %016" PRIx64 " -> %016" PRIx64 " %hu cycles %s%s%s%s %x\n", |
934 | i, e->from, e->to, | 934 | i, e->from, e->to, |
935 | e->flags.cycles, | 935 | (unsigned short)e->flags.cycles, |
936 | e->flags.mispred ? "M" : " ", | 936 | e->flags.mispred ? "M" : " ", |
937 | e->flags.predicted ? "P" : " ", | 937 | e->flags.predicted ? "P" : " ", |
938 | e->flags.abort ? "A" : " ", | 938 | e->flags.abort ? "A" : " ", |
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py index c8680984d2d6..af415febbc46 100644 --- a/tools/perf/util/setup.py +++ b/tools/perf/util/setup.py | |||
@@ -1,8 +1,15 @@ | |||
1 | #!/usr/bin/python2 | 1 | #!/usr/bin/python2 |
2 | 2 | ||
3 | from distutils.core import setup, Extension | ||
4 | from os import getenv | 3 | from os import getenv |
5 | 4 | ||
5 | cc = getenv("CC") | ||
6 | if cc == "clang": | ||
7 | from _sysconfigdata import build_time_vars | ||
8 | from re import sub | ||
9 | build_time_vars["CFLAGS"] = sub("-specs=[^ ]+", "", build_time_vars["CFLAGS"]) | ||
10 | |||
11 | from distutils.core import setup, Extension | ||
12 | |||
6 | from distutils.command.build_ext import build_ext as _build_ext | 13 | from distutils.command.build_ext import build_ext as _build_ext |
7 | from distutils.command.install_lib import install_lib as _install_lib | 14 | from distutils.command.install_lib import install_lib as _install_lib |
8 | 15 | ||
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index df622f4e301e..0ff622288d24 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c | |||
@@ -151,7 +151,7 @@ static int64_t _sort__dso_cmp(struct map *map_l, struct map *map_r) | |||
151 | if (!dso_l || !dso_r) | 151 | if (!dso_l || !dso_r) |
152 | return cmp_null(dso_r, dso_l); | 152 | return cmp_null(dso_r, dso_l); |
153 | 153 | ||
154 | if (verbose) { | 154 | if (verbose > 0) { |
155 | dso_name_l = dso_l->long_name; | 155 | dso_name_l = dso_l->long_name; |
156 | dso_name_r = dso_r->long_name; | 156 | dso_name_r = dso_r->long_name; |
157 | } else { | 157 | } else { |
@@ -172,8 +172,8 @@ static int _hist_entry__dso_snprintf(struct map *map, char *bf, | |||
172 | size_t size, unsigned int width) | 172 | size_t size, unsigned int width) |
173 | { | 173 | { |
174 | if (map && map->dso) { | 174 | if (map && map->dso) { |
175 | const char *dso_name = !verbose ? map->dso->short_name : | 175 | const char *dso_name = verbose > 0 ? map->dso->long_name : |
176 | map->dso->long_name; | 176 | map->dso->short_name; |
177 | return repsep_snprintf(bf, size, "%-*.*s", width, width, dso_name); | 177 | return repsep_snprintf(bf, size, "%-*.*s", width, width, dso_name); |
178 | } | 178 | } |
179 | 179 | ||
@@ -261,7 +261,7 @@ static int _hist_entry__sym_snprintf(struct map *map, struct symbol *sym, | |||
261 | { | 261 | { |
262 | size_t ret = 0; | 262 | size_t ret = 0; |
263 | 263 | ||
264 | if (verbose) { | 264 | if (verbose > 0) { |
265 | char o = map ? dso__symtab_origin(map->dso) : '!'; | 265 | char o = map ? dso__symtab_origin(map->dso) : '!'; |
266 | ret += repsep_snprintf(bf, size, "%-#*llx %c ", | 266 | ret += repsep_snprintf(bf, size, "%-#*llx %c ", |
267 | BITS_PER_LONG / 4 + 2, ip, o); | 267 | BITS_PER_LONG / 4 + 2, ip, o); |
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index 39345c2ddfc2..0d51334a9b46 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c | |||
@@ -344,7 +344,7 @@ int perf_stat_process_counter(struct perf_stat_config *config, | |||
344 | for (i = 0; i < 3; i++) | 344 | for (i = 0; i < 3; i++) |
345 | update_stats(&ps->res_stats[i], count[i]); | 345 | update_stats(&ps->res_stats[i], count[i]); |
346 | 346 | ||
347 | if (verbose) { | 347 | if (verbose > 0) { |
348 | fprintf(config->output, "%s: %" PRIu64 " %" PRIu64 " %" PRIu64 "\n", | 348 | fprintf(config->output, "%s: %" PRIu64 " %" PRIu64 " %" PRIu64 "\n", |
349 | perf_evsel__name(counter), count[0], count[1], count[2]); | 349 | perf_evsel__name(counter), count[0], count[1], count[2]); |
350 | } | 350 | } |
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index adbc6c02c3aa..4e59ddeb4eda 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c | |||
@@ -213,7 +213,7 @@ static bool want_demangle(bool is_kernel_sym) | |||
213 | 213 | ||
214 | static char *demangle_sym(struct dso *dso, int kmodule, const char *elf_name) | 214 | static char *demangle_sym(struct dso *dso, int kmodule, const char *elf_name) |
215 | { | 215 | { |
216 | int demangle_flags = verbose ? (DMGL_PARAMS | DMGL_ANSI) : DMGL_NO_OPTS; | 216 | int demangle_flags = verbose > 0 ? (DMGL_PARAMS | DMGL_ANSI) : DMGL_NO_OPTS; |
217 | char *demangled = NULL; | 217 | char *demangled = NULL; |
218 | 218 | ||
219 | /* | 219 | /* |