diff options
author | Namhyung Kim <namhyung@kernel.org> | 2017-02-17 03:17:38 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-02-20 09:35:54 -0500 |
commit | bb963e16507ca7670f0bb47ccaada8874b2ba6a1 (patch) | |
tree | f031d2d30e418588ebf323d85f749a14894d6e39 /tools | |
parent | 80df1988201ac6648609eba13d48aef9f7974c10 (diff) |
perf utils: Check verbose flag properly
It now can have negative value to suppress the message entirely. So it
needs to check it being positive.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: kernel-team@lge.com
Link: http://lkml.kernel.org/r/20170217081742.17417-3-namhyung@kernel.org
[ Adjust fuzz on tools/perf/util/pmu.c, add > 0 checks in many other places ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
29 files changed, 52 insertions, 52 deletions
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 70a289347591..7ad0d78ea743 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c | |||
@@ -744,7 +744,7 @@ static void data_process(void) | |||
744 | 744 | ||
745 | first = false; | 745 | first = false; |
746 | 746 | ||
747 | if (verbose || data__files_cnt > 2) | 747 | if (verbose > 0 || data__files_cnt > 2) |
748 | data__fprintf(); | 748 | data__fprintf(); |
749 | 749 | ||
750 | /* Don't sort callchain for perf diff */ | 750 | /* Don't sort callchain for perf diff */ |
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 b87bbef73394..451b11e35c26 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 | } |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index dbd7fa028861..a94488114bbf 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -1009,7 +1009,7 @@ repeat: | |||
1009 | * providing it only in verbose mode not to bloat too | 1009 | * providing it only in verbose mode not to bloat too |
1010 | * much struct symbol. | 1010 | * much struct symbol. |
1011 | */ | 1011 | */ |
1012 | if (verbose) { | 1012 | if (verbose > 0) { |
1013 | /* | 1013 | /* |
1014 | * XXX: Need to provide a less kludgy way to ask for | 1014 | * XXX: Need to provide a less kludgy way to ask for |
1015 | * more space per symbol, the u32 is for the index on | 1015 | * 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 9989b03c21f2..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 | } |
@@ -2539,7 +2539,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused) | |||
2539 | 2539 | ||
2540 | status = 0; | 2540 | status = 0; |
2541 | for (run_idx = 0; forever || run_idx < run_count; run_idx++) { | 2541 | for (run_idx = 0; forever || run_idx < run_count; run_idx++) { |
2542 | if (run_count != 1 && verbose) | 2542 | if (run_count != 1 && verbose > 0) |
2543 | fprintf(output, "[ perf stat: executing run #%d ... ]\n", | 2543 | fprintf(output, "[ perf stat: executing run #%d ... ]\n", |
2544 | run_idx + 1); | 2544 | run_idx + 1); |
2545 | 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/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/dso.c b/tools/perf/util/dso.c index 28d41e709128..1a03e9e310a4 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/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/pmu.c b/tools/perf/util/pmu.c index 63cb46cb9b0f..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); |
@@ -847,7 +847,7 @@ static int pmu_config_term(struct list_head *formats, | |||
847 | val = term->val.num; | 847 | val = term->val.num; |
848 | } else if (term->type_val == PARSE_EVENTS__TERM_TYPE_STR) { | 848 | } else if (term->type_val == PARSE_EVENTS__TERM_TYPE_STR) { |
849 | if (strcmp(term->val.str, "?")) { | 849 | if (strcmp(term->val.str, "?")) { |
850 | if (verbose) { | 850 | if (verbose > 0) { |
851 | pr_info("Invalid sysfs entry %s=%s\n", | 851 | pr_info("Invalid sysfs entry %s=%s\n", |
852 | term->config, term->val.str); | 852 | term->config, term->val.str); |
853 | } | 853 | } |
@@ -1232,7 +1232,7 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag, | |||
1232 | printf("%*s", 8, "["); | 1232 | printf("%*s", 8, "["); |
1233 | wordwrap(aliases[j].desc, 8, columns, 0); | 1233 | wordwrap(aliases[j].desc, 8, columns, 0); |
1234 | printf("]\n"); | 1234 | printf("]\n"); |
1235 | if (verbose) | 1235 | if (verbose > 0) |
1236 | 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); |
1237 | } else | 1237 | } else |
1238 | 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/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 | /* |