Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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
...

+260 -137
+4 -8
kernel/events/core.c
··· 455 455 void __user *buffer, size_t *lenp, 456 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 460 if (ret || !write) 461 461 return ret; ··· 3522 3522 if (enabled) { 3523 3523 clone_ctx = unclone_ctx(ctx); 3524 3524 ctx_resched(cpuctx, ctx, event_type); 3525 + } else { 3526 + ctx_sched_in(ctx, cpuctx, EVENT_TIME, current); 3525 3527 } 3526 3528 perf_ctx_unlock(cpuctx, ctx); 3527 3529 ··· 9957 9955 * of swizzling perf_event::ctx. 9958 9956 */ 9959 9957 perf_remove_from_context(group_leader, 0); 9958 + put_ctx(gctx); 9960 9959 9961 9960 list_for_each_entry(sibling, &group_leader->sibling_list, 9962 9961 group_entry) { ··· 9996 9993 perf_event__state_init(group_leader); 9997 9994 perf_install_in_context(ctx, group_leader, group_leader->cpu); 9998 9995 get_ctx(ctx); 9999 - 10000 - /* 10001 - * Now that all events are installed in @ctx, nothing 10002 - * references @gctx anymore, so drop the last reference we have 10003 - * on it. 10004 - */ 10005 - put_ctx(gctx); 10006 9996 } 10007 9997 10008 9998 /*
+2 -2
tools/build/Makefile
··· 35 35 36 36 clean: 37 37 $(call QUIET_CLEAN, fixdep) 38 - $(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete 39 - $(Q)rm -f fixdep 38 + $(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete 39 + $(Q)rm -f $(OUTPUT)fixdep 40 40 41 41 $(OUTPUT)fixdep-in.o: FORCE 42 42 $(Q)$(MAKE) $(build)=fixdep
+3
tools/build/Makefile.include
··· 3 3 fixdep: 4 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 9 .PHONY: fixdep
+2 -2
tools/lib/traceevent/event-parse.c
··· 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 5229 * @pevent: a handle to the pevent 5230 5230 * @rec: the record to parse 5231 5231 * 5232 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 5236 return parse_common_pc(pevent, rec->data); 5237 5237 }
+1 -1
tools/lib/traceevent/event-parse.h
··· 710 710 int pevent_data_type(struct pevent *pevent, struct pevent_record *rec); 711 711 struct event_format *pevent_data_event_from_type(struct pevent *pevent, int type); 712 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 714 int pevent_data_flags(struct pevent *pevent, struct pevent_record *rec); 715 715 const char *pevent_data_comm_from_pid(struct pevent *pevent, int pid); 716 716 struct cmdline;
+4
tools/perf/Documentation/perf-annotate.txt
··· 39 39 --verbose:: 40 40 Be more verbose. (Show symbol address, etc) 41 41 42 + -q:: 43 + --quiet:: 44 + Do not show any message. (Suppress -v) 45 + 42 46 -D:: 43 47 --dump-raw-trace:: 44 48 Dump raw trace in ASCII.
+4
tools/perf/Documentation/perf-diff.txt
··· 73 73 Be verbose, for instance, show the raw counts in addition to the 74 74 diff. 75 75 76 + -q:: 77 + --quiet:: 78 + Do not show any message. (Suppress -v) 79 + 76 80 -f:: 77 81 --force:: 78 82 Don't do ownership validation.
+1 -1
tools/perf/Documentation/perf-record.txt
··· 157 157 158 158 -a:: 159 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 162 -p:: 163 163 --pid=::
+4
tools/perf/Documentation/perf-report.txt
··· 25 25 --verbose:: 26 26 Be more verbose. (show symbol address, etc) 27 27 28 + -q:: 29 + --quiet:: 30 + Do not show any message. (Suppress -v) 31 + 28 32 -n:: 29 33 --show-nr-samples:: 30 34 Show the number of samples for each symbol
+1 -1
tools/perf/Documentation/perf-stat.txt
··· 63 63 64 64 -a:: 65 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 68 -c:: 69 69 --scale::
+7
tools/perf/Makefile.config
··· 175 175 PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) 176 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 182 FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS) 179 183 FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS) 180 184 FEATURE_CHECK_CFLAGS-libpython-version := $(PYTHON_EMBED_CCOPTS) ··· 605 601 PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) 606 602 PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil 607 603 PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) 604 + ifeq ($(CC), clang) 605 + PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS)) 606 + endif 608 607 FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) 609 608 610 609 ifneq ($(feature-libpython), 1)
+2 -2
tools/perf/Makefile.perf
··· 726 726 $(call QUIET_CLEAN, config) 727 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 730 $(call QUIET_CLEAN, core-objs) $(RM) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(LANG_BINDINGS) 731 731 $(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete 732 732 $(Q)$(RM) $(OUTPUT).config-detected 733 733 $(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32 $(OUTPUT)pmu-events/jevents $(OUTPUT)$(LIBJVMTI).so 734 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 736 $(OUTPUT)tests/llvm-src-{base,kbuild,prologue,relocation}.c \ 737 737 $(OUTPUT)pmu-events/pmu-events.c 738 738 $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
+4
tools/perf/builtin-annotate.c
··· 410 410 OPT_BOOLEAN('f', "force", &file.force, "don't complain, do it"), 411 411 OPT_INCR('v', "verbose", &verbose, 412 412 "be more verbose (show symbol address, etc)"), 413 + OPT_BOOLEAN('q', "quiet", &quiet, "do now show any message"), 413 414 OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, 414 415 "dump raw trace in ASCII"), 415 416 OPT_BOOLEAN(0, "gtk", &annotate.use_gtk, "Use the GTK interface"), ··· 463 462 464 463 annotate.sym_hist_filter = argv[0]; 465 464 } 465 + 466 + if (quiet) 467 + perf_quiet_option(); 466 468 467 469 file.path = input_name; 468 470
+10 -4
tools/perf/builtin-diff.c
··· 691 691 hists__precompute(hists); 692 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 695 symbol_conf.use_callchain); 696 696 } 697 697 ··· 739 739 hists__link(hists_base, hists); 740 740 } 741 741 742 - fprintf(stdout, "%s# Event '%s'\n#\n", first ? "" : "\n", 743 - perf_evsel__name(evsel_base)); 742 + if (!quiet) { 743 + fprintf(stdout, "%s# Event '%s'\n#\n", first ? "" : "\n", 744 + perf_evsel__name(evsel_base)); 745 + } 744 746 745 747 first = false; 746 748 747 - if (verbose || data__files_cnt > 2) 749 + if (verbose > 0 || ((data__files_cnt > 2) && !quiet)) 748 750 data__fprintf(); 749 751 750 752 /* Don't sort callchain for perf diff */ ··· 809 807 static const struct option options[] = { 810 808 OPT_INCR('v', "verbose", &verbose, 811 809 "be more verbose (show symbol address, etc)"), 810 + OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any message"), 812 811 OPT_BOOLEAN('b', "baseline-only", &show_baseline_only, 813 812 "Show only items with match in baseline"), 814 813 OPT_CALLBACK('c', "compute", &compute, ··· 1330 1327 perf_config(diff__config, NULL); 1331 1328 1332 1329 argc = parse_options(argc, argv, options, diff_usage, 0); 1330 + 1331 + if (quiet) 1332 + perf_quiet_option(); 1333 1333 1334 1334 if (symbol__init(NULL) < 0) 1335 1335 return -1;
+2 -2
tools/perf/builtin-mem.c
··· 42 42 43 43 fprintf(stderr, "%-13s%-*s%s\n", 44 44 e->tag, 45 - verbose ? 25 : 0, 46 - verbose ? perf_mem_events__name(j) : "", 45 + verbose > 0 ? 25 : 0, 46 + verbose > 0 ? perf_mem_events__name(j) : "", 47 47 e->supported ? ": available" : ""); 48 48 } 49 49 exit(0);
+6 -2
tools/perf/builtin-record.c
··· 432 432 try_again: 433 433 if (perf_evsel__open(pos, pos->cpus, pos->threads) < 0) { 434 434 if (perf_evsel__fallback(pos, errno, msg, sizeof(msg))) { 435 - if (verbose) 435 + if (verbose > 0) 436 436 ui__warning("%s\n", msg); 437 437 goto try_again; 438 438 } ··· 1677 1677 1678 1678 argc = parse_options(argc, argv, record_options, record_usage, 1679 1679 PARSE_OPT_STOP_AT_NON_OPTION); 1680 + if (quiet) 1681 + perf_quiet_option(); 1682 + 1683 + /* Make system wide (-a) the default target. */ 1680 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 1687 if (nr_cgroups && !rec->opts.target.system_wide) { 1684 1688 usage_with_options_msg(record_usage, record_options,
+16 -5
tools/perf/builtin-report.c
··· 320 320 size_t size = sizeof(buf); 321 321 int socked_id = hists->socket_filter; 322 322 323 + if (quiet) 324 + return 0; 325 + 323 326 if (symbol_conf.filter_relative) { 324 327 nr_samples = hists->stats.nr_non_filtered_samples; 325 328 nr_events = hists->stats.total_non_filtered_period; ··· 375 372 { 376 373 struct perf_evsel *pos; 377 374 378 - fprintf(stdout, "#\n# Total Lost Samples: %" PRIu64 "\n#\n", evlist->stats.total_lost_samples); 375 + if (!quiet) { 376 + fprintf(stdout, "#\n# Total Lost Samples: %" PRIu64 "\n#\n", 377 + evlist->stats.total_lost_samples); 378 + } 379 + 379 380 evlist__for_each_entry(evlist, pos) { 380 381 struct hists *hists = evsel__hists(pos); 381 382 const char *evname = perf_evsel__name(pos); ··· 389 382 continue; 390 383 391 384 hists__fprintf_nr_sample_events(hists, rep, evname, stdout); 392 - hists__fprintf(hists, true, 0, 0, rep->min_percent, stdout, 385 + hists__fprintf(hists, !quiet, 0, 0, rep->min_percent, stdout, 393 386 symbol_conf.use_callchain); 394 387 fprintf(stdout, "\n\n"); 395 388 } ··· 723 716 "input file name"), 724 717 OPT_INCR('v', "verbose", &verbose, 725 718 "be more verbose (show symbol address, etc)"), 719 + OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any message"), 726 720 OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, 727 721 "dump raw trace in ASCII"), 728 722 OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name, ··· 871 863 report.symbol_filter_str = argv[0]; 872 864 } 873 865 866 + if (quiet) 867 + perf_quiet_option(); 868 + 874 869 if (symbol_conf.vmlinux_name && 875 870 access(symbol_conf.vmlinux_name, R_OK)) { 876 871 pr_err("Invalid file: %s\n", symbol_conf.vmlinux_name); ··· 994 983 goto error; 995 984 } 996 985 997 - if (report.header || report.header_only) { 986 + if ((report.header || report.header_only) && !quiet) { 998 987 perf_session__fprintf_info(session, stdout, 999 988 report.show_full_info); 1000 989 if (report.header_only) { 1001 990 ret = 0; 1002 991 goto error; 1003 992 } 1004 - } else if (use_browser == 0) { 993 + } else if (use_browser == 0 && !quiet) { 1005 994 fputs("# To display the perf.data header info, please use --header/--header-only options.\n#\n", 1006 995 stdout); 1007 996 } ··· 1020 1009 * providing it only in verbose mode not to bloat too 1021 1010 * much struct symbol. 1022 1011 */ 1023 - if (verbose) { 1012 + if (verbose > 0) { 1024 1013 /* 1025 1014 * XXX: Need to provide a less kludgy way to ask for 1026 1015 * more space per symbol, the u32 is for the index on
+6 -6
tools/perf/builtin-sched.c
··· 460 460 BUG_ON(!sched->tasks); 461 461 sched->tasks[task->nr] = task; 462 462 463 - if (verbose) 463 + if (verbose > 0) 464 464 printf("registered task #%ld, PID %ld (%s)\n", sched->nr_tasks, pid, comm); 465 465 466 466 return task; ··· 794 794 const u32 pid = perf_evsel__intval(evsel, sample, "pid"); 795 795 struct task_desc *waker, *wakee; 796 796 797 - if (verbose) { 797 + if (verbose > 0) { 798 798 printf("sched_wakeup event %p\n", evsel); 799 799 800 800 printf(" ... pid %d woke up %s/%d\n", sample->tid, comm, pid); ··· 822 822 int cpu = sample->cpu; 823 823 s64 delta; 824 824 825 - if (verbose) 825 + if (verbose > 0) 826 826 printf("sched_switch event %p\n", evsel); 827 827 828 828 if (cpu >= MAX_CPUS || cpu < 0) ··· 870 870 goto out_put; 871 871 } 872 872 873 - if (verbose) { 873 + if (verbose > 0) { 874 874 printf("fork event\n"); 875 875 printf("... parent: %s/%d\n", thread__comm_str(parent), parent->tid); 876 876 printf("... child: %s/%d\n", thread__comm_str(child), child->tid); ··· 1573 1573 1574 1574 timestamp__scnprintf_usec(timestamp, stimestamp, sizeof(stimestamp)); 1575 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 1577 const char *pid_color = color; 1578 1578 1579 1579 if (thread__has_color(sched_in)) ··· 2050 2050 2051 2051 if (thread__resolve_callchain(thread, cursor, evsel, sample, 2052 2052 NULL, NULL, sched->max_stack + 2) != 0) { 2053 - if (verbose) 2053 + if (verbose > 0) 2054 2054 error("Failed to resolve callchain. Skipping\n"); 2055 2055 2056 2056 return;
+6 -5
tools/perf/builtin-stat.c
··· 573 573 if (errno == EINVAL || errno == ENOSYS || 574 574 errno == ENOENT || errno == EOPNOTSUPP || 575 575 errno == ENXIO) { 576 - if (verbose) 576 + if (verbose > 0) 577 577 ui__warning("%s event is not supported by the kernel.\n", 578 578 perf_evsel__name(counter)); 579 579 counter->supported = false; ··· 582 582 !(counter->leader->nr_members > 1)) 583 583 continue; 584 584 } else if (perf_evsel__fallback(counter, errno, msg, sizeof(msg))) { 585 - if (verbose) 585 + if (verbose > 0) 586 586 ui__warning("%s\n", msg); 587 587 goto try_again; 588 588 } ··· 1765 1765 1766 1766 cpu = map->map[idx]; 1767 1767 1768 - if (cpu >= env->nr_cpus_online) 1768 + if (cpu >= env->nr_cpus_avail) 1769 1769 return -1; 1770 1770 1771 1771 return cpu; ··· 2445 2445 } else if (big_num_opt == 0) /* User passed --no-big-num */ 2446 2446 big_num = false; 2447 2447 2448 + /* Make system wide (-a) the default target. */ 2448 2449 if (!argc && target__none(&target)) 2449 - usage_with_options(stat_usage, stat_options); 2450 + target.system_wide = true; 2450 2451 2451 2452 if (run_count < 0) { 2452 2453 pr_err("Run count must be a positive number\n"); ··· 2539 2538 2540 2539 status = 0; 2541 2540 for (run_idx = 0; forever || run_idx < run_count; run_idx++) { 2542 - if (run_count != 1 && verbose) 2541 + if (run_count != 1 && verbose > 0) 2543 2542 fprintf(output, "[ perf stat: executing run #%d ... ]\n", 2544 2543 run_idx + 1); 2545 2544
+1 -1
tools/perf/builtin-top.c
··· 871 871 if (perf_evsel__open(counter, top->evlist->cpus, 872 872 top->evlist->threads) < 0) { 873 873 if (perf_evsel__fallback(counter, errno, msg, sizeof(msg))) { 874 - if (verbose) 874 + if (verbose > 0) 875 875 ui__warning("%s\n", msg); 876 876 goto try_again; 877 877 }
+3 -3
tools/perf/builtin-trace.c
··· 1399 1399 return &trace->syscalls.table[id]; 1400 1400 1401 1401 out_cant_read: 1402 - if (verbose) { 1402 + if (verbose > 0) { 1403 1403 fprintf(trace->output, "Problems reading syscall %d", id); 1404 1404 if (id <= trace->syscalls.max && trace->syscalls.table[id].name != NULL) 1405 1405 fprintf(trace->output, "(%s)", trace->syscalls.table[id].name); ··· 1801 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 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 1808 fprintf(f, "%s+0x%" PRIx64, al->sym->name, 1809 1809 al->addr - al->sym->start); 1810 1810 else if (al->map)
+1 -1
tools/perf/pmu-events/json.c
··· 49 49 int err; 50 50 int fd = open(fn, O_RDONLY); 51 51 52 - if (fd < 0 && verbose && fn) { 52 + if (fd < 0 && verbose > 0 && fn) { 53 53 pr_err("Error opening events file '%s': %s\n", fn, 54 54 strerror(errno)); 55 55 }
+1 -1
tools/perf/tests/attr.c
··· 144 144 int vcnt = min(verbose, (int) sizeof(v) - 1); 145 145 char cmd[3*PATH_MAX]; 146 146 147 - if (verbose) 147 + if (verbose > 0) 148 148 vcnt++; 149 149 150 150 snprintf(cmd, 3*PATH_MAX, PYTHON " %s/attr.py -d %s/attr/ -p %s %.*s",
+1 -1
tools/perf/tests/builtin-test.c
··· 299 299 if (!dont_fork) { 300 300 pr_debug("test child forked, pid %d\n", getpid()); 301 301 302 - if (!verbose) { 302 + if (verbose <= 0) { 303 303 int nullfd = open("/dev/null", O_WRONLY); 304 304 305 305 if (nullfd >= 0) {
+1 -1
tools/perf/tests/code-reading.c
··· 599 599 continue; 600 600 } 601 601 602 - if (verbose) { 602 + if (verbose > 0) { 603 603 char errbuf[512]; 604 604 perf_evlist__strerror_open(evlist, errno, errbuf, sizeof(errbuf)); 605 605 pr_debug("perf_evlist__open() failed!\n%s\n", errbuf);
+1 -1
tools/perf/tests/fdarray.c
··· 19 19 { 20 20 int printed = 0; 21 21 22 - if (!verbose) 22 + if (verbose <= 0) 23 23 return 0; 24 24 25 25 printed += fprintf(fp, "\n%s: ", prefix);
+1 -1
tools/perf/tests/llvm.c
··· 76 76 * Skip this test if user's .perfconfig doesn't set [llvm] section 77 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 80 !llvm_param.user_set_param && 81 81 llvm__search_clang())) { 82 82 pr_debug("No clang and no verbosive, skip this test\n");
+1 -1
tools/perf/tests/parse-events.c
··· 1808 1808 { 1809 1809 char msg[1024]; 1810 1810 1811 - if (!verbose) 1811 + if (verbose <= 0) 1812 1812 return; 1813 1813 1814 1814 vsnprintf(msg, sizeof(msg), warn, params);
+2 -2
tools/perf/tests/perf-record.c
··· 172 172 173 173 err = perf_evlist__parse_sample(evlist, event, &sample); 174 174 if (err < 0) { 175 - if (verbose) 175 + if (verbose > 0) 176 176 perf_event__fprintf(event, stderr); 177 177 pr_debug("Couldn't parse sample\n"); 178 178 goto out_delete_evlist; 179 179 } 180 180 181 - if (verbose) { 181 + if (verbose > 0) { 182 182 pr_info("%" PRIu64" %d ", sample.time, sample.cpu); 183 183 perf_event__fprintf(event, stderr); 184 184 }
+1 -1
tools/perf/tests/python-use.c
··· 15 15 int ret; 16 16 17 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 19 return -1; 20 20 21 21 ret = system(cmd) ? -1 : 0;
+3 -3
tools/perf/tests/thread-map.c
··· 109 109 TEST_ASSERT_VAL("failed to allocate thread_map", 110 110 threads); 111 111 112 - if (verbose) 112 + if (verbose > 0) 113 113 thread_map__fprintf(threads, stderr); 114 114 115 115 TEST_ASSERT_VAL("failed to remove thread", ··· 117 117 118 118 TEST_ASSERT_VAL("thread_map count != 1", threads->nr == 1); 119 119 120 - if (verbose) 120 + if (verbose > 0) 121 121 thread_map__fprintf(threads, stderr); 122 122 123 123 TEST_ASSERT_VAL("failed to remove thread", ··· 125 125 126 126 TEST_ASSERT_VAL("thread_map count != 0", threads->nr == 0); 127 127 128 - if (verbose) 128 + if (verbose > 0) 129 129 thread_map__fprintf(threads, stderr); 130 130 131 131 TEST_ASSERT_VAL("failed to not remove thread",
+3 -1
tools/perf/tests/topology.c
··· 65 65 session = perf_session__new(&file, false, NULL); 66 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 71 pr_debug("CPU %d, core %d, socket %d\n", i, 70 72 session->header.env.cpu[i].core_id, 71 73 session->header.env.cpu[i].socket_id);
+1 -1
tools/perf/tests/vmlinux-kallsyms.c
··· 168 168 err = -1; 169 169 } 170 170 171 - if (!verbose) 171 + if (verbose <= 0) 172 172 goto out; 173 173 174 174 header_printed = false;
+3 -3
tools/perf/ui/browsers/map.c
··· 73 73 74 74 if (ui_browser__show(&browser->b, browser->map->dso->long_name, 75 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 77 return -1; 78 78 79 79 while (1) { ··· 81 81 82 82 switch (key) { 83 83 case '/': 84 - if (verbose) 84 + if (verbose > 0) 85 85 map_browser__search(browser); 86 86 default: 87 87 break; ··· 117 117 118 118 if (maxaddr < pos->end) 119 119 maxaddr = pos->end; 120 - if (verbose) { 120 + if (verbose > 0) { 121 121 u32 *idx = symbol__browser_index(pos); 122 122 *idx = mb.b.nr_entries; 123 123 }
+1 -1
tools/perf/ui/hist.c
··· 648 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 652 ret += 3 + BITS_PER_LONG / 4; 653 653 654 654 return ret;
+1 -1
tools/perf/util/annotate.c
··· 1768 1768 printf("%-*.*s----\n", 1769 1769 graph_dotted_len, graph_dotted_len, graph_dotted_line); 1770 1770 1771 - if (verbose) 1771 + if (verbose > 0) 1772 1772 symbol__annotate_hits(sym, evsel); 1773 1773 1774 1774 list_for_each_entry(pos, &notes->src->source, node) {
+22
tools/perf/util/cpumap.c
··· 9 9 #include "asm/bug.h" 10 10 11 11 static int max_cpu_num; 12 + static int max_present_cpu_num; 12 13 static int max_node_num; 13 14 static int *cpunode_map; 14 15 ··· 443 442 444 443 /* set up default */ 445 444 max_cpu_num = 4096; 445 + max_present_cpu_num = 4096; 446 446 447 447 mnt = sysfs__mountpoint(); 448 448 if (!mnt) ··· 457 455 } 458 456 459 457 ret = get_max_num(path, &max_cpu_num); 458 + if (ret) 459 + goto out; 460 + 461 + /* get the highest present cpu number for a sparse allocation */ 462 + ret = snprintf(path, PATH_MAX, "%s/devices/system/cpu/present", mnt); 463 + if (ret == PATH_MAX) { 464 + pr_err("sysfs path crossed PATH_MAX(%d) size\n", PATH_MAX); 465 + goto out; 466 + } 467 + 468 + ret = get_max_num(path, &max_present_cpu_num); 460 469 461 470 out: 462 471 if (ret) ··· 517 504 518 505 return max_cpu_num; 519 506 } 507 + 508 + int cpu__max_present_cpu(void) 509 + { 510 + if (unlikely(!max_present_cpu_num)) 511 + set_max_cpu_num(); 512 + 513 + return max_present_cpu_num; 514 + } 515 + 520 516 521 517 int cpu__get_node(int cpu) 522 518 {
+1
tools/perf/util/cpumap.h
··· 62 62 63 63 int cpu__max_node(void); 64 64 int cpu__max_cpu(void); 65 + int cpu__max_present_cpu(void); 65 66 int cpu__get_node(int cpu); 66 67 67 68 int cpu_map__build_map(struct cpu_map *cpus, struct cpu_map **res,
+17
tools/perf/util/debug.c
··· 203 203 v = (v < 0) || (v > 10) ? 0 : v; 204 204 } 205 205 206 + if (quiet) 207 + v = -1; 208 + 206 209 *var->ptr = v; 207 210 free(s); 211 + return 0; 212 + } 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; 208 225 return 0; 209 226 } 210 227
+1
tools/perf/util/debug.h
··· 54 54 55 55 int perf_debug_option(const char *str); 56 56 void perf_debug_setup(void); 57 + int perf_quiet_option(void); 57 58 58 59 #endif /* __PERF_DEBUG_H */
+1 -1
tools/perf/util/dso.c
··· 1058 1058 { 1059 1059 if (!dso) 1060 1060 return strlen("[unknown]"); 1061 - if (verbose) 1061 + if (verbose > 0) 1062 1062 return dso->long_name_len; 1063 1063 1064 1064 return dso->short_name_len;
+1 -1
tools/perf/util/env.c
··· 66 66 return 0; 67 67 68 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 71 nr_cpus = env->nr_cpus_avail; 72 72 if (nr_cpus == -1)
+20 -13
tools/perf/util/header.c
··· 295 295 u32 nrc, nra; 296 296 int ret; 297 297 298 - nr = sysconf(_SC_NPROCESSORS_CONF); 299 - if (nr < 0) 300 - return -1; 301 - 302 - nrc = (u32)(nr & UINT_MAX); 298 + nrc = cpu__max_present_cpu(); 303 299 304 300 nr = sysconf(_SC_NPROCESSORS_ONLN); 305 301 if (nr < 0) ··· 501 505 502 506 static struct cpu_topo *build_cpu_topology(void) 503 507 { 504 - struct cpu_topo *tp; 508 + struct cpu_topo *tp = NULL; 505 509 void *addr; 506 510 u32 nr, i; 507 511 size_t sz; 508 512 long ncpus; 509 513 int ret = -1; 514 + struct cpu_map *map; 510 515 511 - ncpus = sysconf(_SC_NPROCESSORS_CONF); 512 - if (ncpus < 0) 516 + ncpus = cpu__max_present_cpu(); 517 + 518 + /* build online CPU map */ 519 + map = cpu_map__new(NULL); 520 + if (map == NULL) { 521 + pr_debug("failed to get system cpumap\n"); 513 522 return NULL; 523 + } 514 524 515 525 nr = (u32)(ncpus & UINT_MAX); 516 526 517 527 sz = nr * sizeof(char *); 518 - 519 528 addr = calloc(1, sizeof(*tp) + 2 * sz); 520 529 if (!addr) 521 - return NULL; 530 + goto out_free; 522 531 523 532 tp = addr; 524 533 tp->cpu_nr = nr; ··· 533 532 tp->thread_siblings = addr; 534 533 535 534 for (i = 0; i < nr; i++) { 535 + if (!cpu_map__has(map, i)) 536 + continue; 537 + 536 538 ret = build_cpu_topo(tp, i); 537 539 if (ret < 0) 538 540 break; 539 541 } 542 + 543 + out_free: 544 + cpu_map__put(map); 540 545 if (ret) { 541 546 free_cpu_topo(tp); 542 547 tp = NULL; ··· 1133 1126 { 1134 1127 int nr, i; 1135 1128 char *str; 1136 - int cpu_nr = ph->env.nr_cpus_online; 1129 + int cpu_nr = ph->env.nr_cpus_avail; 1137 1130 1138 1131 nr = ph->env.nr_sibling_cores; 1139 1132 str = ph->env.sibling_cores; ··· 1788 1781 u32 nr, i; 1789 1782 char *str; 1790 1783 struct strbuf sb; 1791 - int cpu_nr = ph->env.nr_cpus_online; 1784 + int cpu_nr = ph->env.nr_cpus_avail; 1792 1785 u64 size = 0; 1793 1786 1794 1787 ph->env.cpu = calloc(cpu_nr, sizeof(*ph->env.cpu)); ··· 1869 1862 if (ph->needs_swap) 1870 1863 nr = bswap_32(nr); 1871 1864 1872 - if (nr > (u32)cpu_nr) { 1865 + if (nr != (u32)-1 && nr > (u32)cpu_nr) { 1873 1866 pr_debug("socket_id number is too big." 1874 1867 "You may need to upgrade the perf tool.\n"); 1875 1868 goto free_cpu;
+3 -3
tools/perf/util/hist.c
··· 69 69 */ 70 70 if (h->ms.sym) { 71 71 symlen = h->ms.sym->namelen + 4; 72 - if (verbose) 72 + if (verbose > 0) 73 73 symlen += BITS_PER_LONG / 4 + 2 + 3; 74 74 hists__new_col_len(hists, HISTC_SYMBOL, symlen); 75 75 } else { ··· 93 93 if (h->branch_info) { 94 94 if (h->branch_info->from.sym) { 95 95 symlen = (int)h->branch_info->from.sym->namelen + 4; 96 - if (verbose) 96 + if (verbose > 0) 97 97 symlen += BITS_PER_LONG / 4 + 2 + 3; 98 98 hists__new_col_len(hists, HISTC_SYMBOL_FROM, symlen); 99 99 ··· 107 107 108 108 if (h->branch_info->to.sym) { 109 109 symlen = (int)h->branch_info->to.sym->namelen + 4; 110 - if (verbose) 110 + if (verbose > 0) 111 111 symlen += BITS_PER_LONG / 4 + 2 + 3; 112 112 hists__new_col_len(hists, HISTC_SYMBOL_TO, symlen); 113 113
+41 -30
tools/perf/util/parse-events.c
··· 2318 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, 2322 - int type_term, char *config, 2323 - char *str, u64 num, int err_term, int err_val) 2321 + static int new_term(struct parse_events_term **_term, 2322 + struct parse_events_term *temp, 2323 + char *str, u64 num) 2324 2324 { 2325 2325 struct parse_events_term *term; 2326 2326 2327 - term = zalloc(sizeof(*term)); 2327 + term = malloc(sizeof(*term)); 2328 2328 if (!term) 2329 2329 return -ENOMEM; 2330 2330 2331 + *term = *temp; 2331 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 2335 case PARSE_EVENTS__TERM_TYPE_NUM: 2340 2336 term->val.num = num; 2341 2337 break; ··· 2349 2353 2350 2354 int parse_events_term__num(struct parse_events_term **term, 2351 2355 int type_term, char *config, u64 num, 2356 + bool no_value, 2352 2357 void *loc_term_, void *loc_val_) 2353 2358 { 2354 2359 YYLTYPE *loc_term = loc_term_; 2355 2360 YYLTYPE *loc_val = loc_val_; 2356 2361 2357 - return new_term(term, PARSE_EVENTS__TERM_TYPE_NUM, type_term, 2358 - config, NULL, num, 2359 - loc_term ? loc_term->first_column : 0, 2360 - loc_val ? loc_val->first_column : 0); 2362 + struct parse_events_term temp = { 2363 + .type_val = PARSE_EVENTS__TERM_TYPE_NUM, 2364 + .type_term = type_term, 2365 + .config = config, 2366 + .no_value = no_value, 2367 + .err_term = loc_term ? loc_term->first_column : 0, 2368 + .err_val = loc_val ? loc_val->first_column : 0, 2369 + }; 2370 + 2371 + return new_term(term, &temp, NULL, num); 2361 2372 } 2362 2373 2363 2374 int parse_events_term__str(struct parse_events_term **term, ··· 2374 2371 YYLTYPE *loc_term = loc_term_; 2375 2372 YYLTYPE *loc_val = loc_val_; 2376 2373 2377 - return new_term(term, PARSE_EVENTS__TERM_TYPE_STR, type_term, 2378 - config, str, 0, 2379 - loc_term ? loc_term->first_column : 0, 2380 - loc_val ? loc_val->first_column : 0); 2374 + struct parse_events_term temp = { 2375 + .type_val = PARSE_EVENTS__TERM_TYPE_STR, 2376 + .type_term = type_term, 2377 + .config = config, 2378 + .err_term = loc_term ? loc_term->first_column : 0, 2379 + .err_val = loc_val ? loc_val->first_column : 0, 2380 + }; 2381 + 2382 + return new_term(term, &temp, str, 0); 2381 2383 } 2382 2384 2383 2385 int parse_events_term__sym_hw(struct parse_events_term **term, 2384 2386 char *config, unsigned idx) 2385 2387 { 2386 2388 struct event_symbol *sym; 2389 + struct parse_events_term temp = { 2390 + .type_val = PARSE_EVENTS__TERM_TYPE_STR, 2391 + .type_term = PARSE_EVENTS__TERM_TYPE_USER, 2392 + .config = config ?: (char *) "event", 2393 + }; 2387 2394 2388 2395 BUG_ON(idx >= PERF_COUNT_HW_MAX); 2389 2396 sym = &event_symbols_hw[idx]; 2390 2397 2391 - if (config) 2392 - return new_term(term, PARSE_EVENTS__TERM_TYPE_STR, 2393 - PARSE_EVENTS__TERM_TYPE_USER, config, 2394 - (char *) sym->symbol, 0, 0, 0); 2395 - else 2396 - return new_term(term, PARSE_EVENTS__TERM_TYPE_STR, 2397 - PARSE_EVENTS__TERM_TYPE_USER, 2398 - (char *) "event", (char *) sym->symbol, 2399 - 0, 0, 0); 2398 + return new_term(term, &temp, (char *) sym->symbol, 0); 2400 2399 } 2401 2400 2402 2401 int parse_events_term__clone(struct parse_events_term **new, 2403 2402 struct parse_events_term *term) 2404 2403 { 2405 - return new_term(new, term->type_val, term->type_term, term->config, 2406 - term->val.str, term->val.num, 2407 - term->err_term, term->err_val); 2404 + struct parse_events_term temp = { 2405 + .type_val = term->type_val, 2406 + .type_term = term->type_term, 2407 + .config = term->config, 2408 + .err_term = term->err_term, 2409 + .err_val = term->err_val, 2410 + }; 2411 + 2412 + return new_term(new, &temp, term->val.str, term->val.num); 2408 2413 } 2409 2414 2410 2415 void parse_events_terms__purge(struct list_head *terms)
+2
tools/perf/util/parse-events.h
··· 94 94 int type_term; 95 95 struct list_head list; 96 96 bool used; 97 + bool no_value; 97 98 98 99 /* error string indexes for within parsed string */ 99 100 int err_term; ··· 123 122 int parse_events__is_hardcoded_term(struct parse_events_term *term); 124 123 int parse_events_term__num(struct parse_events_term **term, 125 124 int type_term, char *config, u64 num, 125 + bool novalue, 126 126 void *loc_term, void *loc_val); 127 127 int parse_events_term__str(struct parse_events_term **term, 128 128 int type_term, char *config, char *str,
+7 -7
tools/perf/util/parse-events.y
··· 252 252 if (!strcasecmp(alias->name, $1)) { 253 253 ALLOC_LIST(head); 254 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 256 list_add_tail(&term->list, head); 257 257 258 258 if (!parse_events_add_pmu(data, list, ··· 282 282 283 283 ALLOC_LIST(head); 284 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 286 list_add_tail(&term->list, head); 287 287 288 288 ALLOC_LIST(list); ··· 548 548 struct parse_events_term *term; 549 549 550 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 552 $$ = term; 553 553 } 554 554 | ··· 566 566 struct parse_events_term *term; 567 567 568 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 570 $$ = term; 571 571 } 572 572 | ··· 591 591 { 592 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 595 $$ = term; 596 596 } 597 597 | ··· 599 599 { 600 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 603 $$ = term; 604 604 } 605 605 | ··· 620 620 struct parse_events_term *term; 621 621 622 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 624 term->array = $2; 625 625 $$ = term; 626 626 }
+15 -6
tools/perf/util/pmu.c
··· 745 745 } 746 746 } 747 747 748 - if (verbose) 748 + if (verbose > 0) 749 749 printf("Required parameter '%s' not specified\n", term->config); 750 750 751 751 return -1; ··· 803 803 804 804 format = pmu_find_format(formats, term->config); 805 805 if (!format) { 806 - if (verbose) 806 + if (verbose > 0) 807 807 printf("Invalid event/parameter '%s'\n", term->config); 808 808 if (err) { 809 809 char *pmu_term = pmu_formats_string(formats); ··· 834 834 * Either directly use a numeric term, or try to translate string terms 835 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 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 849 if (strcmp(term->val.str, "?")) { 841 - if (verbose) { 850 + if (verbose > 0) { 842 851 pr_info("Invalid sysfs entry %s=%s\n", 843 852 term->config, term->val.str); 844 853 } ··· 1232 1223 printf("%*s", 8, "["); 1233 1224 wordwrap(aliases[j].desc, 8, columns, 0); 1234 1225 printf("]\n"); 1235 - if (verbose) 1226 + if (verbose > 0) 1236 1227 printf("%*s%s/%s/\n", 8, "", aliases[j].pmu, aliases[j].str); 1237 1228 } else 1238 1229 printf(" %-50s [Kernel PMU event]\n", aliases[j].name);
+1 -1
tools/perf/util/probe-event.c
··· 594 594 pr_debug("try to find information at %" PRIx64 " in %s\n", addr, 595 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 598 if (dinfo) 599 599 ret = debuginfo__find_probe_point(dinfo, 600 600 (unsigned long)addr, pp);
+2 -2
tools/perf/util/scripting-engines/trace-event-python.c
··· 369 369 if (node->map) { 370 370 struct map *map = node->map; 371 371 const char *dsoname = "[unknown]"; 372 - if (map && map->dso && (map->dso->name || map->dso->long_name)) { 372 + if (map && map->dso) { 373 373 if (symbol_conf.show_kernel_path && map->dso->long_name) 374 374 dsoname = map->dso->long_name; 375 - else if (map->dso->name) 375 + else 376 376 dsoname = map->dso->name; 377 377 } 378 378 pydict_set_item_string_decref(pyelem, "dso",
+1 -1
tools/perf/util/session.c
··· 932 932 933 933 printf("..... %2"PRIu64": %016" PRIx64 " -> %016" PRIx64 " %hu cycles %s%s%s%s %x\n", 934 934 i, e->from, e->to, 935 - e->flags.cycles, 935 + (unsigned short)e->flags.cycles, 936 936 e->flags.mispred ? "M" : " ", 937 937 e->flags.predicted ? "P" : " ", 938 938 e->flags.abort ? "A" : " ",
+8 -1
tools/perf/util/setup.py
··· 1 1 #!/usr/bin/python2 2 2 3 - from distutils.core import setup, Extension 4 3 from os import getenv 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 5 12 6 13 from distutils.command.build_ext import build_ext as _build_ext 7 14 from distutils.command.install_lib import install_lib as _install_lib
+4 -4
tools/perf/util/sort.c
··· 151 151 if (!dso_l || !dso_r) 152 152 return cmp_null(dso_r, dso_l); 153 153 154 - if (verbose) { 154 + if (verbose > 0) { 155 155 dso_name_l = dso_l->long_name; 156 156 dso_name_r = dso_r->long_name; 157 157 } else { ··· 172 172 size_t size, unsigned int width) 173 173 { 174 174 if (map && map->dso) { 175 - const char *dso_name = !verbose ? map->dso->short_name : 176 - map->dso->long_name; 175 + const char *dso_name = verbose > 0 ? map->dso->long_name : 176 + map->dso->short_name; 177 177 return repsep_snprintf(bf, size, "%-*.*s", width, width, dso_name); 178 178 } 179 179 ··· 261 261 { 262 262 size_t ret = 0; 263 263 264 - if (verbose) { 264 + if (verbose > 0) { 265 265 char o = map ? dso__symtab_origin(map->dso) : '!'; 266 266 ret += repsep_snprintf(bf, size, "%-#*llx %c ", 267 267 BITS_PER_LONG / 4 + 2, ip, o);
+1 -1
tools/perf/util/stat.c
··· 344 344 for (i = 0; i < 3; i++) 345 345 update_stats(&ps->res_stats[i], count[i]); 346 346 347 - if (verbose) { 347 + if (verbose > 0) { 348 348 fprintf(config->output, "%s: %" PRIu64 " %" PRIu64 " %" PRIu64 "\n", 349 349 perf_evsel__name(counter), count[0], count[1], count[2]); 350 350 }
+1 -1
tools/perf/util/symbol-elf.c
··· 213 213 214 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 217 char *demangled = NULL; 218 218 219 219 /*