Skip to contentSkip to conversation

perf annotate: Fix data type profiling on stdio

PATCH Applied Namhyung Kim 3 participants 4 messages Apr 23, 2024 – Apr 25, 2024 perf events

lore
Share & tools
lore

Namhyung Kim

author maintainer
#0 lore raw

PATCH 1/1 perf annotate: Fix data type profiling on stdio

The loop in hists__find_annotations() never set the 'nd' pointer to NULL and it makes stdio output repeating the last element forever. I think it doesn't set to NULL for TUI to prevent it from exiting unexpectedly. But it should just set on stdio mode.

Fixes d001c7a7f473 ("perf annotate-data: Add hist_entry__annotate_data_tui()")
---
 tools/perf/builtin-annotate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-annotate.c +1 -1
index 6f7104f06c42..83812b9d5363 100644
@@ -491,7 +491,7 @@ static void hists__find_annotations(struct hists *hists,
 				return;
 			}
 
-			if (next != NULL)
+			if (use_browser == 0 || next != NULL)
 				nd = next;
 
 			continue;
Signature · 1 line
2.44.0.769.g3c40516874-goog
reviewer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Namhyung Kim

The loop in hists__find_annotations() never set the 'nd' pointer to NULL and it makes stdio output repeating the last element forever. I think it doesn't set to NULL for TUI to prevent it from exiting unexpectedly. But it should just set on stdio mode.

Fixes d001c7a7f473 ("perf annotate-data: Add hist_entry__annotate_data_tui()")

Should we have a test to cover things like this?

Thanks,
Ian

Quoted 20 lines
---
 tools/perf/builtin-annotate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-annotate.c +1 -2
index 6f7104f06c42..83812b9d5363 100644
@@ -491,7 +491,7 @@ static void hists__find_annotations(struct hists *hists,
                                return;
                        }
 
-                       if (next != NULL)
+                       if (use_browser == 0 || next != NULL)
                                nd = next;
 
                        continue;
--

2.44.0.769.g3c40516874-goog

author maintainer
#2 lore raw
Quoted 8 lines · Ian Rogers
Quoted 6 lines · Namhyung Kim

The loop in hists__find_annotations() never set the 'nd' pointer to NULL and it makes stdio output repeating the last element forever. I think it doesn't set to NULL for TUI to prevent it from exiting unexpectedly. But it should just set on stdio mode.

Quoted 4 lines
Quoted 2 lines
Fixes d001c7a7f473 ("perf annotate-data: Add hist_entry__annotate_data_tui()")

Thanks for your review!

Quoted 2 lines

Should we have a test to cover things like this?

Ok, I'll try to add one for perf annotate.

Thanks,
Namhyung

maintainer Applied
#3 lore raw
Quoted 9 lines · Namhyung Kim
Quoted 8 lines · Ian Rogers
Quoted 6 lines · Namhyung Kim

The loop in hists__find_annotations() never set the 'nd' pointer to NULL and it makes stdio output repeating the last element forever. I think it doesn't set to NULL for TUI to prevent it from exiting unexpectedly. But it should just set on stdio mode.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Fixes d001c7a7f473 ("perf annotate-data: Add hist_entry__annotate_data_tui()")

Thanks for your review!

Thanks, applied to perf-tools-next,

- Arnaldo

Quoted 7 lines
Quoted 2 lines

Should we have a test to cover things like this?

Ok, I'll try to add one for perf annotate.

Thanks,
Namhyung