Linux-perf-users Archive mirror
 help / color / mirror / Atom feed
From: Leo Yan <leo.yan@arm.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, James Clark <james.clark@arm.com>,
	linux-perf-users@vger.kernel.org
Cc: Leo Yan <leo.yan@arm.com>
Subject: [PATCH] perf maps: Output debugging info for 'perf test'
Date: Sun, 12 May 2024 12:05:55 +0100	[thread overview]
Message-ID: <20240512110555.999-1-leo.yan@arm.com> (raw)

When run the test case 'maps__merge_in', it reports:

  # perf test -vvv maps__merge_in
     58: maps__merge_in:
  --- start ---
  test child forked, pid 35232
  overlapping maps in bpf_prog_1 (disable tui for more info)
  overlapping maps in bpf_prog_2 (disable tui for more info)
  overlapping maps in bpf_prog_3 (disable tui for more info)
  overlapping maps in bpf_prog_2 (disable tui for more info)
  overlapping maps in bpf_prog_3 (disable tui for more info)
  overlapping maps in kcore1 (disable tui for more info)
  ---- end(0) ----

The log suggests to disable TUI mode for printing verbose log. On the
other hand, 'perf test' always runs without enabling TUI mode.

The flag 'user_browser' is not a bool value. When it's equal or greater
than 1 the tool works in TUI or GUI mode, otherwise, 0 or '-1' means the
tool works as stdio mode. Correct the condition checking for the flag
'user_browser' to print the debugging logs properly.

After:

  # ./perf test -vvv maps__merge_in

   58: maps__merge_in:

  --- start ---
  test child forked, pid 36529
  overlapping maps:
   c8-12c 0 bpf_prog_1
   64-3e8 0 kcore1
   64-c8 0 kcore1
   12c-3e8 c8 kcore1
  overlapping maps:
   1f4-258 0 bpf_prog_2
   12c-3e8 c8 kcore1
   12c-1f4 c8 kcore1
   258-3e8 1f4 kcore1
  ...
  ---- end(0) ----
   58: maps__merge_in                                                  : Ok

Signed-off-by: Leo Yan <leo.yan@arm.com>
---
 tools/perf/util/maps.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/maps.c b/tools/perf/util/maps.c
index ce13145a9f8e..073be9c309f9 100644
--- a/tools/perf/util/maps.c
+++ b/tools/perf/util/maps.c
@@ -764,7 +764,7 @@ static int __maps__fixup_overlap_and_insert(struct maps *maps, struct map *new)
 		if (map__start(pos) >= map__end(new))
 			break;
 
-		if (use_browser) {
+		if (use_browser >= 1) {
 			pr_debug("overlapping maps in %s (disable tui for more info)\n",
 				map__dso(new)->name);
 		} else if (verbose >= 2) {
@@ -787,7 +787,7 @@ static int __maps__fixup_overlap_and_insert(struct maps *maps, struct map *new)
 			}
 			map__set_end(before, map__start(new));
 
-			if (verbose >= 2 && !use_browser)
+			if (verbose >= 2 && use_browser <= 0)
 				map__fprintf(before, fp);
 		}
 		if (map__end(new) < map__end(pos)) {
@@ -805,7 +805,7 @@ static int __maps__fixup_overlap_and_insert(struct maps *maps, struct map *new)
 			assert(map__map_ip(pos, map__end(new)) ==
 			       map__map_ip(after, map__end(new)));
 
-			if (verbose >= 2 && !use_browser)
+			if (verbose >= 2 && use_browser <= 0)
 				map__fprintf(after, fp);
 		}
 		/*
-- 
2.39.2


                 reply	other threads:[~2024-05-12 11:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240512110555.999-1-leo.yan@arm.com \
    --to=leo.yan@arm.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=james.clark@arm.com \
    --cc=jolsa@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).