All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: "Liang, Kan" <kan.liang@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Eduard Zingerman <eddyz87@gmail.com>,
	John Garry <john.g.garry@oracle.com>,
	Jing Zhang <renyu.zj@linux.alibaba.com>,
	James Clark <james.clark@arm.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	Perry Taylor <perry.taylor@intel.com>
Subject: Re: [PATCH v1] perf metric: Add #num_cpus_online literal
Date: Wed, 30 Aug 2023 13:28:14 -0300	[thread overview]
Message-ID: <ZO9uHhTeckwOE8dg@kernel.org> (raw)
In-Reply-To: <a0b88cfe-3afe-688d-861c-a9a332f66676@linux.intel.com>

Em Wed, Aug 30, 2023 at 09:14:00AM -0400, Liang, Kan escreveu:
> 
> 
> On 2023-08-30 3:30 a.m., Ian Rogers wrote:
> > Returns the number of CPUs online, unlike #num_cpus that returns the
> > number present. Add a test of the property. This will be used in
> > future Intel metrics.
> > 
> > Signed-off-by: Ian Rogers <irogers@google.com>
> 
> Reviewed-by: Kan Liang <kan.liang@linux.intel.com>

Thanks, applied.

- Arnaldo

 
> Thanks,
> Kan
> > ---
> >  tools/perf/tests/expr.c | 5 ++++-
> >  tools/perf/util/expr.c  | 7 +++++++
> >  2 files changed, 11 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/tests/expr.c b/tools/perf/tests/expr.c
> > index c1c3fcbc2753..81229fa4f1e9 100644
> > --- a/tools/perf/tests/expr.c
> > +++ b/tools/perf/tests/expr.c
> > @@ -70,7 +70,7 @@ static int test__expr(struct test_suite *t __maybe_unused, int subtest __maybe_u
> >  {
> >  	struct expr_id_data *val_ptr;
> >  	const char *p;
> > -	double val, num_cpus, num_cores, num_dies, num_packages;
> > +	double val, num_cpus_online, num_cpus, num_cores, num_dies, num_packages;
> >  	int ret;
> >  	struct expr_parse_ctx *ctx;
> >  	bool is_intel = false;
> > @@ -227,7 +227,10 @@ static int test__expr(struct test_suite *t __maybe_unused, int subtest __maybe_u
> >  
> >  	/* Test toplogy constants appear well ordered. */
> >  	expr__ctx_clear(ctx);
> > +	TEST_ASSERT_VAL("#num_cpus_online",
> > +			expr__parse(&num_cpus_online, ctx, "#num_cpus_online") == 0);
> >  	TEST_ASSERT_VAL("#num_cpus", expr__parse(&num_cpus, ctx, "#num_cpus") == 0);
> > +	TEST_ASSERT_VAL("#num_cpus >= #num_cpus_online", num_cpus >= num_cpus_online);
> >  	TEST_ASSERT_VAL("#num_cores", expr__parse(&num_cores, ctx, "#num_cores") == 0);
> >  	TEST_ASSERT_VAL("#num_cpus >= #num_cores", num_cpus >= num_cores);
> >  	TEST_ASSERT_VAL("#num_dies", expr__parse(&num_dies, ctx, "#num_dies") == 0);
> > diff --git a/tools/perf/util/expr.c b/tools/perf/util/expr.c
> > index 0985a3cbc6f9..4488f306de78 100644
> > --- a/tools/perf/util/expr.c
> > +++ b/tools/perf/util/expr.c
> > @@ -427,6 +427,13 @@ double expr__get_literal(const char *literal, const struct expr_scanner_ctx *ctx
> >  		result = cpu__max_present_cpu().cpu;
> >  		goto out;
> >  	}
> > +	if (!strcmp("#num_cpus_online", literal)) {
> > +		struct perf_cpu_map *online = cpu_map__online();
> > +
> > +		if (online)
> > +			result = perf_cpu_map__nr(online);
> > +		goto out;
> > +	}
> >  
> >  	if (!strcasecmp("#system_tsc_freq", literal)) {
> >  		result = arch_get_tsc_freq();

-- 

- Arnaldo

      reply	other threads:[~2023-08-30 18:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-30  7:30 [PATCH v1] perf metric: Add #num_cpus_online literal Ian Rogers
2023-08-30 13:14 ` Liang, Kan
2023-08-30 16:28   ` Arnaldo Carvalho de Melo [this message]

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=ZO9uHhTeckwOE8dg@kernel.org \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=eddyz87@gmail.com \
    --cc=irogers@google.com \
    --cc=james.clark@arm.com \
    --cc=john.g.garry@oracle.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=namhyung@kernel.org \
    --cc=perry.taylor@intel.com \
    --cc=peterz@infradead.org \
    --cc=renyu.zj@linux.alibaba.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.