mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Chun-Tse Shao <ctshao@google.com>
Cc: Ian Rogers <irogers@google.com>,
	linux-kernel@vger.kernel.org, peterz@infradead.org,
	mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@kernel.org,
	adrian.hunter@intel.com, kan.liang@linux.intel.com,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v1] perf stat: Fix uncore aggregation number
Date: Fri, 20 Jun 2025 15:12:04 -0700	[thread overview]
Message-ID: <aFXctF683XlLmiRy@google.com> (raw)
In-Reply-To: <CAJpZYjWUUbnNyBYXNSu_mmUrYLhNHHmdro8r08Xe0tN7nAanxg@mail.gmail.com>

Hi CT,

On Thu, Jun 12, 2025 at 03:55:59PM -0700, Chun-Tse Shao wrote:
> Hi Ian, I actually renamed it to `aggr_nr` in v2 patch so it should be
> better aligned to json mode, which is using `aggregate-nunber`. But
> anyway I think any name other than `cpus` is better.
> v2 patch: lore.kernel.org/20250612225324.3315450-1-ctshao@google.com

I think "aggregation-count" is a better name, maybe abbreviated to
"ag_cnt".  Can we rename the JSON as well?  I'm not sure if it's
documented somewhere.

Thanks,
Namhyung

> 
> 
> On Wed, Jun 11, 2025 at 10:12 PM Ian Rogers <irogers@google.com> wrote:
> >
> > On Wed, Jun 11, 2025 at 8:18 PM Chun-Tse Shao <ctshao@google.com> wrote:
> > >
> > > Thanks for your test, Ian!
> > >
> > > I wonder if `nr_pmus` makes sense, since the column would be shared
> > > with multiple different pmus. WDYT?
> >
> > So each PMU in sysfs has a cpumask that specifies which CPUs perf
> > should pass to perf_event_open. For example, on a two socket machine
> > the cpumask will typically have the first CPU of each socket. If the
> > cpumask (or cpus) file isn't present then the cpumask is implicitly
> > all online CPUs. Given that the aggregation number is the number of
> > CPUs in the cpumask multiplied by the number of PMUs, I think the most
> > neutral name is probably "counters" possibly shortened down to "ctrs".
> > I suspect others have better suggestions :-)
> >
> > Thanks,
> > Ian
> >
> > > -CT
> > >
> > > On Wed, Jun 11, 2025 at 5:16 PM Ian Rogers <irogers@google.com> wrote:
> > > >
> > > > On Wed, Jun 11, 2025 at 4:36 PM Chun-Tse Shao <ctshao@google.com> wrote:
> > > > >
> > > > > Follow up:
> > > > > lore.kernel.org/CAP-5=fVDF4-qYL1Lm7efgiHk7X=_nw_nEFMBZFMcsnOOJgX4Kg@mail.gmail.com/
> > > > >
> > > > > The patch adds unit aggregation during evsel merge the aggregated uncore
> > > > > counters.
> > > > >
> > > > > Tested on a 2-socket machine with SNC3, uncore_imc_[0-11] and
> > > > > cpumask="0,120"
> > > > > Before:
> > > > >   perf stat -e clockticks -I 1000 --per-socket
> > > > >   #           time socket cpus             counts unit events
> > > > >        1.001085024 S0        1         9615386315      clockticks
> > > > >        1.001085024 S1        1         9614287448      clockticks
> > > > >   perf stat -e clockticks -I 1000 --per-node
> > > > >   #           time node   cpus             counts unit events
> > > > >        1.001029867 N0        1         3205726984      clockticks
> > > > >        1.001029867 N1        1         3205444421      clockticks
> > > > >        1.001029867 N2        1         3205234018      clockticks
> > > > >        1.001029867 N3        1         3205224660      clockticks
> > > > >        1.001029867 N4        1         3205207213      clockticks
> > > > >        1.001029867 N5        1         3205528246      clockticks
> > > > > After:
> > > > >   perf stat -e clockticks -I 1000 --per-socket
> > > > >   #           time socket cpus             counts unit events
> > > >
> > > > I wonder if there is a better column heading than "cpus" given that
> > > > these are imc PMUs.
> > > >
> > > > >        1.001022937 S0       12         9621463177      clockticks
> > > > >        1.001022937 S1       12         9619804949      clockticks
> > > > >   perf stat -e clockticks -I 1000 --per-node
> > > > >   #           time node   cpus             counts unit events
> > > > >        1.001029867 N0        4         3206782080      clockticks
> > > > >        1.001029867 N1        4         3207025354      clockticks
> > > > >        1.001029867 N2        4         3207067946      clockticks
> > > > >        1.001029867 N3        4         3206871733      clockticks
> > > > >        1.001029867 N4        4         3206199005      clockticks
> > > > >        1.001029867 N5        4         3205525058      clockticks
> > > > >
> > > > > Suggested-by: Ian Rogers <irogers@google.com>
> > > > > Signed-off-by: Chun-Tse Shao <ctshao@google.com>
> > >
> > > Added Namhyung's ack from the previous email.
> > > Acked-by: Namhyung Kim <namhyung@kernel.org>
> > >
> > > >
> > > > Tested-by: Ian Rogers <irogers@google.com>
> > > >
> > > > Thanks,
> > > > Ian
> > > >
> > > > > ---
> > > > >  tools/perf/util/stat.c | 1 +
> > > > >  1 file changed, 1 insertion(+)
> > > > >
> > > > > diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
> > > > > index 355a7d5c8ab8..52266d773353 100644
> > > > > --- a/tools/perf/util/stat.c
> > > > > +++ b/tools/perf/util/stat.c
> > > > > @@ -527,6 +527,7 @@ static int evsel__merge_aggr_counters(struct evsel *evsel, struct evsel *alias)
> > > > >                 struct perf_counts_values *aggr_counts_b = &ps_b->aggr[i].counts;
> > > > >
> > > > >                 /* NB: don't increase aggr.nr for aliases */
> > > > > +               ps_a->aggr[i].nr += ps_b->aggr[i].nr;
> > > > >
> > > > >                 aggr_counts_a->val += aggr_counts_b->val;
> > > > >                 aggr_counts_a->ena += aggr_counts_b->ena;
> > > > > --
> > > > > 2.50.0.rc1.591.g9c95f17f64-goog
> > > > >

  reply	other threads:[~2025-06-20 22:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-11 23:32 Chun-Tse Shao
2025-06-11 23:43 ` Namhyung Kim
2025-06-12  0:16 ` Ian Rogers
2025-06-12  3:18   ` Chun-Tse Shao
2025-06-12  5:12     ` Ian Rogers
2025-06-12 22:55       ` Chun-Tse Shao
2025-06-20 22:12         ` Namhyung Kim [this message]
2025-06-23 18:17           ` Ian Rogers
2025-06-23 23:31             ` Namhyung Kim
2025-06-24 22:24               ` Chun-Tse Shao

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=aFXctF683XlLmiRy@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=ctshao@google.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /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

all inboxes | Powered by JetHome®