Skip to content

Commit eadc004

Browse files
captain5050namhyung
authored andcommitted
perf jevents: Support for has_event function
Support for the new has_event function in metrics. Signed-off-by: Ian Rogers <[email protected]> Tested-by: Namhyung Kim <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Eduard Zingerman <[email protected]> Cc: Sohom Datta <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Caleb Biggers <[email protected]> Cc: Edward Baker <[email protected]> Cc: Perry Taylor <[email protected]> Cc: Samantha Alt <[email protected]> Cc: Weilin Wang <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Andrii Nakryiko <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Jing Zhang <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Kan Liang <[email protected]> Cc: Zhengjun Xing <[email protected]> Cc: John Garry <[email protected]> Cc: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
1 parent 4a4a9bf commit eadc004

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tools/perf/pmu-events/metric.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,12 @@ def source_count(event: Event) -> Function:
408408
return Function('source_count', event)
409409

410410

411+
def has_event(event: Event) -> Function:
412+
# pylint: disable=redefined-builtin
413+
# pylint: disable=invalid-name
414+
return Function('has_event', event)
415+
416+
411417
class Metric:
412418
"""An individual metric that will specifiable on the perf command line."""
413419
groups: Set[str]
@@ -539,7 +545,7 @@ def ParsePerfJson(orig: str) -> Expression:
539545
r'Event(r"\1")', py)
540546
py = re.sub(r'#Event\(r"([^"]*)"\)', r'Literal("#\1")', py)
541547
py = re.sub(r'([0-9]+)Event\(r"(e[0-9]+)"\)', r'\1\2', py)
542-
keywords = ['if', 'else', 'min', 'max', 'd_ratio', 'source_count']
548+
keywords = ['if', 'else', 'min', 'max', 'd_ratio', 'source_count', 'has_event']
543549
for kw in keywords:
544550
py = re.sub(rf'Event\(r"{kw}"\)', kw, py)
545551

0 commit comments

Comments
 (0)