From: Ian Rogers <irogers@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
James Clark <james.clark@linaro.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Dapeng Mi <dapeng1.mi@linux.intel.com>,
Zide Chen <zide.chen@intel.com>,
Thomas Falcon <thomas.falcon@intel.com>,
Chun-Tse Shao <ctshao@google.com>,
Lalit Maganti <lalitmaganti@gmail.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
Ian Rogers <irogers@google.com>,
Sandipan Das <sandipan.das@amd.com>
Subject: [PATCH 03/36] perf pmu-events: Remove 0 * slots simplification exception in metric.py
Date: Wed, 2 Dec 2026 00:20:54 -0800 [thread overview]
Message-ID: <4068b6a38457660cb45eb9d168a9167a6ff9bdbb.1796199085.git.irogers@google.com> (raw)
In-Reply-To: <cover.1796199085.git.irogers@google.com>
Commit 8dcd27b1b866 ("perf parse-events: Fix missing slots for Intel
topdown metric events") updated parse-events.c to automatically inject
a slots event when Intel topdown metric events are parsed without one,
so metrics no longer need a "0 * slots" workaround.
Remove the special case in Operator.Simplify() that kept "0 * slots"
unfolded and its corresponding test in metric_test.py.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/pmu-events/metric.py | 5 +----
tools/perf/pmu-events/metric_test.py | 5 -----
2 files changed, 1 insertion(+), 9 deletions(-)
diff --git a/tools/perf/pmu-events/metric.py b/tools/perf/pmu-events/metric.py
index 04bb29ce7722..5a8418347fcb 100644
--- a/tools/perf/pmu-events/metric.py
+++ b/tools/perf/pmu-events/metric.py
@@ -302,10 +302,7 @@ class Operator(Expression):
if self.operator in ('+', '|') and lhs.value == '0':
return rhs
- # Simplify multiplication by 0 except for the slot event which
- # is deliberately introduced using this pattern.
- if self.operator == '*' and lhs.value == '0' and (
- not isinstance(rhs, Event) or 'slots' not in rhs.name.lower()):
+ if self.operator == '*' and lhs.value == '0':
return Constant(0)
if self.operator == '*' and lhs.value == '1':
diff --git a/tools/perf/pmu-events/metric_test.py b/tools/perf/pmu-events/metric_test.py
index 0221ac746ec2..da9de9758680 100755
--- a/tools/perf/pmu-events/metric_test.py
+++ b/tools/perf/pmu-events/metric_test.py
@@ -166,11 +166,6 @@ class TestMetricExpressions(unittest.TestCase):
after = 'a'
self.assertEqual(ParsePerfJson(before).Simplify().ToPerfJson(), after)
- # Pattern used to add a slots event to metrics that require it.
- before = '0 * SLOTS'
- after = '0 * SLOTS'
- self.assertEqual(ParsePerfJson(before).Simplify().ToPerfJson(), after)
-
# Constant folding for non-add/sub operators and simplified lhs.
self.assertEqual((Constant(2) * Constant(3)).Simplify().ToPerfJson(), '6')
self.assertEqual((Constant(6) / Constant(4)).Simplify().ToPerfJson(), '1.5')
--
2.56.1.915.g69d5ec7298-goog
next prev parent reply other threads:[~2026-12-02 8:21 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 8:20 [PATCH 00/36] perf pmu-events: Intel event/metric fixes and TMA 5.32 updates Ian Rogers
2026-12-02 8:20 ` [PATCH 01/36] perf jevents: Map cpu_lowpower unit and handle uppercase 0X hex values Ian Rogers
2026-12-02 9:36 ` Mi, Dapeng
2026-12-02 8:20 ` [PATCH 02/36] perf pmu-events: Fix Simplify() and Equals() bugs in metric.py Ian Rogers
2026-12-02 8:20 ` Ian Rogers [this message]
2026-12-02 8:20 ` [PATCH 04/36] perf vendor events intel: Update alderlake events and TMA metrics to 5.32 Ian Rogers
2026-12-02 8:20 ` [PATCH 05/36] perf vendor events intel: Update alderlaken events and metrics Ian Rogers
2026-12-02 8:20 ` [PATCH 06/36] perf vendor events intel: Update arrowlake events and TMA metrics to 5.32 Ian Rogers
2026-12-02 8:20 ` [PATCH 07/36] perf vendor events intel: Update broadwell " Ian Rogers
2026-12-02 8:20 ` [PATCH 08/36] perf vendor events intel: Update broadwellde metrics to TMA 5.32 Ian Rogers
2026-12-02 8:21 ` [PATCH 09/36] perf vendor events intel: Update broadwellx events and TMA metrics to 5.32 Ian Rogers
2026-12-02 8:21 ` [PATCH 10/36] perf vendor events intel: Update cascadelakex " Ian Rogers
2026-12-02 8:21 ` [PATCH 11/36] perf vendor events intel: Update clearwaterforest events and metrics Ian Rogers
2026-12-02 8:21 ` [PATCH 12/36] perf vendor events intel: Add diamondrapids TMA 5.32 metrics and update events Ian Rogers
2026-12-02 8:21 ` [PATCH 13/36] perf vendor events intel: Update elkhartlake events Ian Rogers
2026-12-02 8:21 ` [PATCH 14/36] perf vendor events intel: Update emeraldrapids events to 1.26 and TMA metrics to 5.32 Ian Rogers
2026-12-02 8:21 ` [PATCH 15/36] perf vendor events intel: Update grandridge events and metrics Ian Rogers
2026-12-02 8:21 ` [PATCH 16/36] perf vendor events intel: Update graniterapids events and TMA metrics to 5.32 Ian Rogers
2026-12-02 8:21 ` [PATCH 17/36] perf vendor events intel: Update haswell " Ian Rogers
2026-12-02 8:21 ` [PATCH 18/36] perf vendor events intel: Update haswellx " Ian Rogers
2026-12-02 8:21 ` [PATCH 19/36] perf vendor events intel: Update icelake " Ian Rogers
2026-12-02 8:21 ` [PATCH 20/36] perf vendor events intel: Update icelakex " Ian Rogers
2026-12-02 8:21 ` [PATCH 21/36] perf vendor events intel: Update ivybridge metrics to TMA 5.32 Ian Rogers
2026-12-02 8:21 ` [PATCH 22/36] perf vendor events intel: Update ivytown events and TMA metrics to 5.32 Ian Rogers
2026-12-02 8:21 ` [PATCH 23/36] perf vendor events intel: Update jaketown " Ian Rogers
2026-12-02 8:21 ` [PATCH 24/36] perf vendor events intel: Update knightslanding events Ian Rogers
2026-12-02 8:21 ` [PATCH 25/36] perf vendor events intel: Update lunarlake events and TMA metrics to 5.32 Ian Rogers
2026-12-02 8:21 ` [PATCH 26/36] perf vendor events intel: Update meteorlake " Ian Rogers
2026-12-02 8:21 ` [PATCH 27/36] perf vendor events intel: Update novalake events Ian Rogers
2026-12-02 8:21 ` [PATCH 28/36] perf vendor events intel: Update pantherlake events Ian Rogers
2026-12-02 8:21 ` [PATCH 29/36] perf vendor events intel: Update rocketlake events and TMA metrics to 5.32 Ian Rogers
2026-12-02 8:21 ` [PATCH 30/36] perf vendor events intel: Update sandybridge metrics to TMA 5.32 Ian Rogers
2026-12-02 8:21 ` [PATCH 31/36] perf vendor events intel: Update sapphirerapids events to 1.41 and TMA metrics to 5.32 Ian Rogers
2026-12-02 8:21 ` [PATCH 32/36] perf vendor events intel: Update sierraforest events and metrics Ian Rogers
2026-12-02 8:21 ` [PATCH 33/36] perf vendor events intel: Update skylake events and TMA metrics to 5.32 Ian Rogers
2026-12-02 8:21 ` [PATCH 34/36] perf vendor events intel: Update skylakex " Ian Rogers
2026-12-02 8:21 ` [PATCH 35/36] perf vendor events intel: Update snowridgex events Ian Rogers
2026-12-02 8:21 ` [PATCH 36/36] perf vendor events intel: Update tigerlake events and TMA metrics to 5.32 Ian Rogers
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=4068b6a38457660cb45eb9d168a9167a6ff9bdbb.1796199085.git.irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=ctshao@google.com \
--cc=dapeng1.mi@linux.intel.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=lalitmaganti@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=peterz@infradead.org \
--cc=sandipan.das@amd.com \
--cc=thomas.falcon@intel.com \
--cc=zide.chen@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
all inboxes | Powered by JetHome®