Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bb963e16 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo
Browse files

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: default avatarNamhyung 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 80df1988
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -744,7 +744,7 @@ static void data_process(void)

		first = false;

		if (verbose || data__files_cnt > 2)
		if (verbose > 0 || data__files_cnt > 2)
			data__fprintf();

		/* Don't sort callchain for perf diff */
+2 −2
Original line number Diff line number Diff line
@@ -42,8 +42,8 @@ static int parse_record_events(const struct option *opt,

		fprintf(stderr, "%-13s%-*s%s\n",
			e->tag,
			verbose ? 25 : 0,
			verbose ? perf_mem_events__name(j) : "",
			verbose > 0 ? 25 : 0,
			verbose > 0 ? perf_mem_events__name(j) : "",
			e->supported ? ": available" : "");
	}
	exit(0);
+1 −1
Original line number Diff line number Diff line
@@ -432,7 +432,7 @@ static int record__open(struct record *rec)
try_again:
		if (perf_evsel__open(pos, pos->cpus, pos->threads) < 0) {
			if (perf_evsel__fallback(pos, errno, msg, sizeof(msg))) {
				if (verbose)
				if (verbose > 0)
					ui__warning("%s\n", msg);
				goto try_again;
			}
+1 −1
Original line number Diff line number Diff line
@@ -1009,7 +1009,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
 		 * providing it only in verbose mode not to bloat too
 		 * much struct symbol.
 		 */
		if (verbose) {
		if (verbose > 0) {
			/*
			 * XXX: Need to provide a less kludgy way to ask for
			 * more space per symbol, the u32 is for the index on
+6 −6
Original line number Diff line number Diff line
@@ -460,7 +460,7 @@ static struct task_desc *register_pid(struct perf_sched *sched,
	BUG_ON(!sched->tasks);
	sched->tasks[task->nr] = task;

	if (verbose)
	if (verbose > 0)
		printf("registered task #%ld, PID %ld (%s)\n", sched->nr_tasks, pid, comm);

	return task;
@@ -794,7 +794,7 @@ replay_wakeup_event(struct perf_sched *sched,
	const u32 pid	 = perf_evsel__intval(evsel, sample, "pid");
	struct task_desc *waker, *wakee;

	if (verbose) {
	if (verbose > 0) {
		printf("sched_wakeup event %p\n", evsel);

		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,
	int cpu = sample->cpu;
	s64 delta;

	if (verbose)
	if (verbose > 0)
		printf("sched_switch event %p\n", evsel);

	if (cpu >= MAX_CPUS || cpu < 0)
@@ -870,7 +870,7 @@ static int replay_fork_event(struct perf_sched *sched,
		goto out_put;
	}

	if (verbose) {
	if (verbose > 0) {
		printf("fork event\n");
		printf("... parent: %s/%d\n", thread__comm_str(parent), parent->tid);
		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,

	timestamp__scnprintf_usec(timestamp, stimestamp, sizeof(stimestamp));
	color_fprintf(stdout, color, "  %12s secs ", stimestamp);
	if (new_shortname || (verbose && sched_in->tid)) {
	if (new_shortname || (verbose > 0 && sched_in->tid)) {
		const char *pid_color = color;

		if (thread__has_color(sched_in))
@@ -2050,7 +2050,7 @@ static void save_task_callchain(struct perf_sched *sched,

	if (thread__resolve_callchain(thread, cursor, evsel, sample,
				      NULL, NULL, sched->max_stack + 2) != 0) {
		if (verbose)
		if (verbose > 0)
			error("Failed to resolve callchain. Skipping\n");

		return;
Loading