Skip to contentSkip to conversation

perf jevents metric: Fix type of strcmp_cpuid_str

PATCH Applied Ian Rogers 2 participants 2 messages Sep 14, 2023 – Sep 17, 2023 perf events

lore
Share & tools
lore

Ian Rogers

author reviewer
#0 lore raw

PATCH 1/1 perf jevents metric: Fix type of strcmp_cpuid_str

The parser wraps all strings as Events, so the input is an Event. Using a string would be bad as functions like Simplify are called on the arguments, which wouldn't be present on a string.

Fixes 9d5da30e4ae9 ("perf jevents: Add a new expression builtin

strcmp_cpuid_str()")

---
 tools/perf/pmu-events/metric.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/pmu-events/metric.py +2 -2
index 0e9ec65d92ae..3e673f25d5fd 100644
@@ -413,10 +413,10 @@ def has_event(event: Event) -> Function:
   # pylint: disable=invalid-name
   return Function('has_event', event)
 
-def strcmp_cpuid_str(event: str) -> Function:
+def strcmp_cpuid_str(cpuid: Event) -> Function:
   # pylint: disable=redefined-builtin
   # pylint: disable=invalid-name
-  return Function('strcmp_cpuid_str', event)
+  return Function('strcmp_cpuid_str', cpuid)
 
 class Metric:
   """An individual metric that will specifiable on the perf command line."""
Signature · 1 line
2.42.0.459.ge4e396fd5e-goog
maintainer Applied
#1 lore raw
Quoted 9 lines · Ian Rogers

The parser wraps all strings as Events, so the input is an Event. Using a string would be bad as functions like Simplify are called on the arguments, which wouldn't be present on a string.

Fixes 9d5da30e4ae9 ("perf jevents: Add a new expression builtin

strcmp_cpuid_str()")

Applied to perf-tools, thanks!

Namhyung