Re: [PATCH 07/12] perf annotate-data: Show the sample count in the data-type browser

From: Namhyung Kim

Date: Wed Sep 16 2026 - 17:55:29 EST


On Wed, Sep 16, 2026 at 08:47:34AM -0300, Arnaldo Carvalho de Melo wrote:
> From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
>
> The data-type browser has a samples view, selected with -n (or with
> annotate.show_nr_samples), in which browser__write_overhead() prints a
> local nr_samples variable that is initialized to zero and never
> updated, so every member is listed as having no samples while the
> period and percent columns for the same entry are filled in.
>
> Print the histogram entry's own count instead.
>
> This predates the load/store counter split, so fix it ahead of that
> patch: the split then only has to adapt a line that is already correct,
> and this fix can be picked on its own.
>
> Fixes: d001c7a7f4736743 ("perf annotate-data: Add hist_entry__annotate_data_tui()")
> Assisted-by: LLM
> Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>

This can be applied independently.

Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>

Thanks,
Namhyung

> ---
> tools/perf/ui/browsers/annotate-data.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/ui/browsers/annotate-data.c b/tools/perf/ui/browsers/annotate-data.c
> index c6e07a9b64089ab5..a15608f6ee53335f 100644
> --- a/tools/perf/ui/browsers/annotate-data.c
> +++ b/tools/perf/ui/browsers/annotate-data.c
> @@ -374,7 +374,7 @@ static void browser__write_overhead(struct ui_browser *uib,
> u64 period = hist->period;
> double percent = total->period ? (100.0 * period / total->period) : 0;
> bool current = ui_browser__is_current_entry(uib, row);
> - int nr_samples = 0;
> + int nr_samples = hist->nr_samples;
>
> ui_browser__set_percent_color(uib, percent, current);
>
> --
> 2.55.0
>