mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: eter 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>,
	Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Kan Liang <kan.liang@linux.intel.com>,
	Zhengjun Xing <zhengjun.xing@linux.intel.com>,
	Kajol Jain <kjain@linux.ibm.com>,
	John Garry <john.g.garry@oracle.com>,
	Andrii Nakryiko <andrii@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Jing Zhang <renyu.zj@linux.alibaba.com>,
	Sohom Datta <sohomdatta1@gmail.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Perry Taylor <perry.taylor@intel.com>,
	Samantha Alt <samantha.alt@intel.com>,
	Caleb Biggers <caleb.biggers@intel.com>,
	Weilin Wang <weilin.wang@intel.com>,
	Edward Baker <edward.baker@intel.com>
Subject: [PATCH v1 02/12] perf jevents: Support for has_event function
Date: Thu, 22 Jun 2023 17:33:02 -0700	[thread overview]
Message-ID: <20230623003312.3981075-3-irogers@google.com> (raw)
In-Reply-To: <20230623003312.3981075-1-irogers@google.com>

Support for the new has_event function in metrics.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/pmu-events/metric.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/perf/pmu-events/metric.py b/tools/perf/pmu-events/metric.py
index af58b74d1644..85a3545f5b6a 100644
--- a/tools/perf/pmu-events/metric.py
+++ b/tools/perf/pmu-events/metric.py
@@ -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)
 
-- 
2.41.0.162.gfafddb0af9-goog


  parent reply	other threads:[~2023-06-23  0:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-23  0:33 [PATCH v1 00/12] Add metric has_event, update intel vendor events Ian Rogers
2023-06-23  0:33 ` [PATCH v1 01/12] perf expr: Add has_event function Ian Rogers
2023-06-23 14:40   ` John Garry
2023-06-23 15:00     ` Ian Rogers
2023-06-23  0:33 ` Ian Rogers [this message]
2023-06-23  0:33 ` [PATCH v1 03/12] perf vendor metrics intel: Make transaction metrics conditional Ian Rogers
2023-06-23  0:33 ` [PATCH v1 04/12] perf vendor events intel: Add rocketlake events/metrics Ian Rogers
2023-06-23  0:33 ` [PATCH v1 05/12] perf vendor events intel: Update meteorlake to 1.03 Ian Rogers
2023-06-23  0:33 ` [PATCH v1 06/12] perf vendor events intel: Update cascadelakex to 1.19 Ian Rogers
2023-06-23  0:33 ` [PATCH v1 07/12] perf vendor events intel: Update icelake " Ian Rogers
2023-06-23  0:33 ` [PATCH v1 08/12] perf vendor events intel: Update icelakex to 1.21 Ian Rogers
2023-06-23  0:33 ` [PATCH v1 09/12] perf vendor events intel: Update sapphirerapids to 1.14 Ian Rogers
2023-06-23  0:33 ` [PATCH v1 10/12] perf vendor events intel: Update skylake to 57 Ian Rogers
2023-06-23  0:33 ` [PATCH v1 11/12] perf vendor events intel: Update skylakex to 1.31 Ian Rogers
2023-06-23  0:33 ` [PATCH v1 12/12] perf vendor events intel: Update tigerlake to 1.13 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=20230623003312.3981075-3-irogers@google.com \
    --to=irogers@google.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=andrii@kernel.org \
    --cc=caleb.biggers@intel.com \
    --cc=eddyz87@gmail.com \
    --cc=edward.baker@intel.com \
    --cc=john.g.garry@oracle.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=kjain@linux.ibm.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=renyu.zj@linux.alibaba.com \
    --cc=samantha.alt@intel.com \
    --cc=sohomdatta1@gmail.com \
    --cc=weilin.wang@intel.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

all inboxes | Powered by JetHome®