public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Andi Kleen <ak@linux.intel.com>,
	Kan Liang <kan.liang@linux.intel.com>,
	Thomas Richter <tmricht@linux.ibm.com>,
	James Clark <james.clark@arm.com>,
	Miaoqian Lin <linmq006@gmail.com>,
	John Garry <john.garry@huawei.com>,
	Zhengjun Xing <zhengjun.xing@linux.intel.com>,
	Florian Fischer <florian.fischer@muhq.space>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	perry.taylor@intel.com, caleb.biggers@intel.com,
	kshipra.bopardikar@intel.com
Cc: Stephane Eranian <eranian@google.com>, Ian Rogers <irogers@google.com>
Subject: [PATCH v1 8/8] perf test: Add basic core_wide expression test
Date: Tue, 30 Aug 2022 09:48:46 -0700	[thread overview]
Message-ID: <20220830164846.401143-9-irogers@google.com> (raw)
In-Reply-To: <20220830164846.401143-1-irogers@google.com>

Add basic test for coverage, similar to #smt_on.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/tests/expr.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tools/perf/tests/expr.c b/tools/perf/tests/expr.c
index db736ed49556..8bd719766814 100644
--- a/tools/perf/tests/expr.c
+++ b/tools/perf/tests/expr.c
@@ -158,6 +158,9 @@ static int test__expr(struct test_suite *t __maybe_unused, int subtest __maybe_u
 	{
 		struct cpu_topology *topology = cpu_topology__new();
 		bool smton = smt_on(topology);
+		bool corewide = core_wide(/*system_wide=*/false,
+					  /*user_requested_cpus=*/false,
+					  topology);
 
 		cpu_topology__delete(topology);
 		expr__ctx_clear(ctx);
@@ -168,6 +171,16 @@ static int test__expr(struct test_suite *t __maybe_unused, int subtest __maybe_u
 		TEST_ASSERT_VAL("find ids", hashmap__find(ctx->ids,
 							  smton ? "EVENT1" : "EVENT2",
 							  (void **)&val_ptr));
+
+		expr__ctx_clear(ctx);
+		TEST_ASSERT_VAL("find ids",
+				expr__find_ids("EVENT1 if #core_wide else EVENT2",
+					NULL, ctx) == 0);
+		TEST_ASSERT_VAL("find ids", hashmap__size(ctx->ids) == 1);
+		TEST_ASSERT_VAL("find ids", hashmap__find(ctx->ids,
+							  corewide ? "EVENT1" : "EVENT2",
+							  (void **)&val_ptr));
+
 	}
 	/* The expression is a constant 1.0 without needing to evaluate EVENT1. */
 	expr__ctx_clear(ctx);
-- 
2.37.2.672.g94769d06f0-goog


      parent reply	other threads:[~2022-08-30 16:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-30 16:48 [PATCH v1 0/8] Add core wide metric literal Ian Rogers
2022-08-30 16:48 ` [PATCH v1 1/8] perf smt: Tidy header guard add SPDX Ian Rogers
2022-08-31 14:46   ` Arnaldo Carvalho de Melo
2022-08-30 16:48 ` [PATCH v1 2/8] perf metric: Return early if no CPU PMU table exists Ian Rogers
2022-08-31 12:21   ` Arnaldo Carvalho de Melo
2022-08-31 12:30   ` Arnaldo Carvalho de Melo
2022-08-30 16:48 ` [PATCH v1 3/8] perf expr: Move the scanner_ctx into the parse_ctx Ian Rogers
2022-08-30 16:48 ` [PATCH v1 4/8] perf smt: Compute SMT from topology Ian Rogers
2022-08-30 16:48 ` [PATCH v1 5/8] perf topology: Add core_wide Ian Rogers
2022-08-31 14:40   ` Arnaldo Carvalho de Melo
2022-08-31 15:58     ` Ian Rogers
2022-08-31 16:20       ` Arnaldo Carvalho de Melo
2022-08-31 16:42         ` Ian Rogers
2022-08-30 16:48 ` [PATCH v1 6/8] perf stat: Delay metric parsing Ian Rogers
2022-08-31 14:42   ` Arnaldo Carvalho de Melo
2022-08-31 16:13     ` Ian Rogers
2022-08-30 16:48 ` [PATCH v1 7/8] perf metrics: Wire up core_wide Ian Rogers
2022-08-31 14:44   ` Arnaldo Carvalho de Melo
2022-08-31 16:38     ` Ian Rogers
2022-08-30 16:48 ` Ian Rogers [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=20220830164846.401143-9-irogers@google.com \
    --to=irogers@google.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=caleb.biggers@intel.com \
    --cc=eranian@google.com \
    --cc=florian.fischer@muhq.space \
    --cc=james.clark@arm.com \
    --cc=john.garry@huawei.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=kshipra.bopardikar@intel.com \
    --cc=linmq006@gmail.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=tmricht@linux.ibm.com \
    --cc=zhengjun.xing@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox