linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf maps: Output debugging info for 'perf test'
@ 2024-05-12 11:05 Leo Yan
  2024-09-03 15:24 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 2+ messages in thread
From: Leo Yan @ 2024-05-12 11:05 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers, Adrian Hunter,
	Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, James Clark, linux-perf-users
  Cc: Leo Yan

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] perf maps: Output debugging info for 'perf test'
  2024-05-12 11:05 [PATCH] perf maps: Output debugging info for 'perf test' Leo Yan
@ 2024-09-03 15:24 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-09-03 15:24 UTC (permalink / raw)
  To: Leo Yan
  Cc: Namhyung Kim, Ian Rogers, Adrian Hunter, Peter Zijlstra,
	Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	James Clark, linux-perf-users

On Sun, May 12, 2024 at 12:05:55PM +0100, Leo Yan wrote:
> When run the test case 'maps__merge_in', it reports:

Leo, this fell thru the cracks, now I tried to merge it but it isn't
applying anymore, can you check, please?

- Arnaldo
 
>   # 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-09-03 15:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-12 11:05 [PATCH] perf maps: Output debugging info for 'perf test' Leo Yan
2024-09-03 15:24 ` Arnaldo Carvalho de Melo

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 NNTP newsgroup(s).