perf maps: Output debugging info for 'perf test'
PATCH 1/1 perf maps: Output debugging info for 'perf test'
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
--- tools/perf/util/maps.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/util/maps.c +3 -3
@@ -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); }/*
Signature · 1 line
2.39.2
Arnaldo Carvalho de Melo
maintainerQuoted 1 line · Leo Yan
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
Quoted 80 lines
# 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_in58: 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: OkSigned-off-by Leo Yan <[email protected]>--- tools/perf/util/maps.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)tools/perf/util/maps.c +3
-3@@ -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); }/* Signature · 1 line
2.39.2