perf jevents: Support for has_event function
Support for the new has_event function in metrics. Signed-off-by: Ian Rogers <irogers@google.com> Tested-by: Namhyung Kim <namhyung@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Eduard Zingerman <eddyz87@gmail.com> Cc: Sohom Datta <sohomdatta1@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Caleb Biggers <caleb.biggers@intel.com> Cc: Edward Baker <edward.baker@intel.com> Cc: Perry Taylor <perry.taylor@intel.com> Cc: Samantha Alt <samantha.alt@intel.com> Cc: Weilin Wang <weilin.wang@intel.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Andrii Nakryiko <andrii@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Jing Zhang <renyu.zj@linux.alibaba.com> Cc: Kajol Jain <kjain@linux.ibm.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Zhengjun Xing <zhengjun.xing@linux.intel.com> Cc: John Garry <john.g.garry@oracle.com> Cc: Ingo Molnar <mingo@redhat.com> Link: https://lore.kernel.org/r/20230623151016.4193660-3-irogers@google.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
4a4a9bf907
commit
eadc0040a9
@ -408,6 +408,12 @@ def source_count(event: Event) -> Function:
|
||||
return Function('source_count', event)
|
||||
|
||||
|
||||
def has_event(event: Event) -> Function:
|
||||
# pylint: disable=redefined-builtin
|
||||
# pylint: disable=invalid-name
|
||||
return Function('has_event', event)
|
||||
|
||||
|
||||
class Metric:
|
||||
"""An individual metric that will specifiable on the perf command line."""
|
||||
groups: Set[str]
|
||||
@ -539,7 +545,7 @@ def ParsePerfJson(orig: str) -> Expression:
|
||||
r'Event(r"\1")', py)
|
||||
py = re.sub(r'#Event\(r"([^"]*)"\)', r'Literal("#\1")', py)
|
||||
py = re.sub(r'([0-9]+)Event\(r"(e[0-9]+)"\)', r'\1\2', py)
|
||||
keywords = ['if', 'else', 'min', 'max', 'd_ratio', 'source_count']
|
||||
keywords = ['if', 'else', 'min', 'max', 'd_ratio', 'source_count', 'has_event']
|
||||
for kw in keywords:
|
||||
py = re.sub(rf'Event\(r"{kw}"\)', kw, py)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user