public inbox for linux-perf-users@vger.kernel.org
 help / color / mirror / Atom feed
From: "Falcon, Thomas" <thomas.falcon@intel.com>
To: "sashiko@lists.linux.dev" <sashiko@lists.linux.dev>
Cc: "linux-perf-users@vger.kernel.org" <linux-perf-users@vger.kernel.org>
Subject: Re: [PATCH 2/2] perf/annotate: Fix missing branch counter column in TUI mode
Date: Fri, 10 Apr 2026 20:05:06 +0000	[thread overview]
Message-ID: <d4839a58d24d3682a089bbcdee5b1c139d639da3.camel@intel.com> (raw)
In-Reply-To: <20260410200131.1E3BEC19421@smtp.kernel.org>

On Fri, 2026-04-10 at 20:01 +0000, sashiko-bot@kernel.org wrote:
> Sashiko AI review found 1 potential issue(s):
> - [Medium] The branch counter column is now enabled in standard stdio
> mode where it cannot be populated, resulting in a useless empty
> column in the output.
> --
> 
> commit afd424a34255fcd5587246caa606560bc9b916c8
> Author: Thomas Falcon <thomas.falcon@intel.com>
> 
> perf/annotate: Fix missing branch counter column in TUI mode
> 
> This commit moves the check for enabling the branch counter column
> into
> __cmd_annotate() so it occurs after events have been processed and
> the
> counter is updated.
> 
> > diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-
> > annotate.c
> > index 5e57b78548f42..7fe23b05306f8 100644
> > --- a/tools/perf/builtin-annotate.c
> > +++ b/tools/perf/builtin-annotate.c
> > @@ -563,6 +563,9 @@ static int __cmd_annotate(struct perf_annotate
> > *ann)
> >  	if (ret)
> >  		goto out;
> >  
> > +	if (session->evlist->nr_br_cntr > 0)
> > +		annotate_opts.show_br_cntr = true;
> > +
> 
> Will this cause an empty branch counter column to be displayed in
> standard
> stdio mode?

Oops, this was an older version, I'll resend with an updated one.

Thanks,
Tom

> 
> The original code restricted this check to TUI and stdio2 modes where
> use_browser == 1 or annotate.use_stdio2 is true. By moving the
> assignment
> here, it becomes unconditional.
> 
> In standard stdio mode, process_branch_callback() is skipped when
> adding
> samples, so branch stack data is not aggregated into the annotation
> notes.
> This leaves the counter data at 0 for all instructions. Could this
> result
> in the output rendering the column title but printing only empty
> spaces for
> all the rows?
> 
> [ ... ]
> 
> > @@ -928,8 +931,6 @@ int cmd_annotate(int argc, const char **argv)
> >  	 */
> >  	if ((use_browser == 1 || annotate.use_stdio2) &&
> > annotate.has_br_stack) {
> >  		sort__mode = SORT_MODE__BRANCH;
> > -		if (annotate.session->evlist->nr_br_cntr > 0)
> > -			annotate_opts.show_br_cntr = true;
> >  	}
> >  
> >  	if (setup_sorting(/*evlist=*/NULL,
> > perf_session__env(annotate.session)) < 0)
> 


  reply	other threads:[~2026-04-10 20:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10 19:39 [PATCH 1/2] perf script: Add missed "+" if br_cntr reaches upper limit Thomas Falcon
2026-04-10 19:40 ` [PATCH 2/2] perf/annotate: Fix missing branch counter column in TUI mode Thomas Falcon
2026-04-10 20:01   ` sashiko-bot
2026-04-10 20:05     ` Falcon, Thomas [this message]
2026-04-10 20:19   ` [PATCH v2 " Thomas Falcon

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=d4839a58d24d3682a089bbcdee5b1c139d639da3.camel@intel.com \
    --to=thomas.falcon@intel.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko@lists.linux.dev \
    /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