Message ID | 20240301185559.2661241-6-irogers@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-88963-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp87582dyc; Fri, 1 Mar 2024 10:57:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUJ2RqwbI1Y/VbKiD8znxkBBv2ZpYasxzQeznjzPg9Hb92YOxMxxuwo8Yu78+LPG0mj+Tl4+p4sgZ1p2MxGlwn+wK6ung== X-Google-Smtp-Source: AGHT+IGD8oICQ/ifIWcu/iFC1xHpezf3EZ3hrpC/UZn5LkrEHzlN+akRPt5Enw7ASsVSYnCKeg0f X-Received: by 2002:a17:90b:188a:b0:29a:ca83:19a1 with SMTP id mn10-20020a17090b188a00b0029aca8319a1mr2341098pjb.33.1709319473899; Fri, 01 Mar 2024 10:57:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709319473; cv=pass; d=google.com; s=arc-20160816; b=LC5r1PyaZM+gj9wXKwUbnP7bOvOVnaVXTjisunwpggXsMrabO0PI/s7m3lJm8JR0rQ Cqp33SGdDRgAFdNbgXEWh2Q4WHb9jHVbjbmEDT5B2Lxx5hhI7NXpOTIm4SO6xPZPPd8l W6u6Fz8i9fOEWUy86k2zn0RzoCMrt/EwRBEqh4edhWf9kuE3XHaCXqU7Dio9Y3VzNAYs ypmb6qQyjtEYch2JkCcW0LxhwbsErYo9wVT9cl/K9G+5UnHgvsIDBNrPOY3txCqPCHTl dW85n84lLb5oYiFoTH9nDOrMJ3F/+ce15a6OCLTlAYXIy/yIIEGwoDlbn9schdybV4Q2 2cFA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:from:subject:references:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:in-reply-to:date :dkim-signature; bh=h/hkLOGxFb+NGL6rpwIzI3DU/bCodQ7sPVZDGihfs7c=; fh=QY7YBLN79Pvkxb+5lABjTfA4pQ5LhYm1DI7sswU9dPY=; b=nIqW/TpkxZeMlXnT3h7MMIjm3/Fruew7Rkagj5IHkKbEQKX4hFtBDyRUXsJ8VOnJaE VNmEEyFv0LbmQGCCLeXyuNWa8o9uhhzqdggbClE0bEhpACu6ZsqoriUW/hZUaPjCWA85 +2X+0NuZsxq1Pcs6TnTrZu239f99SMGxLFXcwBjvSsMUmIHG61Gvje+CA9or2fs7m9nu mAPTKl8rp6maz3zn0Fl24MKpogwK5lJDTeUn1qMtO3oqlvZl6Y29xjcSx0DrRklGsG95 huqZEEB69f5jtsliy7nWCMvaiw3ADFM+zNoR15J6nsT5WZQTZQyZBcfq8Ry/6AT59gmP B0dg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=JtFccn+7; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-88963-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88963-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id ng11-20020a17090b1a8b00b0029b301cb7d4si471127pjb.28.2024.03.01.10.57.53 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 10:57:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88963-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=JtFccn+7; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-88963-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88963-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AF8172833CC for <ouuuleilei@gmail.com>; Fri, 1 Mar 2024 18:57:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8B60C3C468; Fri, 1 Mar 2024 18:56:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="JtFccn+7" Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34E2E3BB41 for <linux-kernel@vger.kernel.org>; Fri, 1 Mar 2024 18:56:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709319387; cv=none; b=Zm4oYMSqp85Wcm4NiMEPmdBa7pl9P5r02kmDWndgIA4jUXBKp4pFObF6ZlQitJG2O7fasasNGwi7qHMR3M/qiGgLLHTBWzgEi9WX51HhTXGzt21lVcuM+Btz1Kvw3Oaa6EhKqa1QAYtr66xlijGq/Myn9gAhhAS49Y894JzId4k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709319387; c=relaxed/simple; bh=SYzzekKsm56SYljV7D2+Kgk899aiMFZ1uqVugeWMohc=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=tBF5MxUWieyzbtlHGeKKBLrzydKwAxHSwVGeQVN25HscvXGvDp8EjaCFOsAl4s1QL6mosH2HAc/o9dIqk8knUfxdjkAgWCllVOMpRVXXDj8JlrMbhp7TFb6lGcHRXEtUHjstWqGQOLmoB37GWoG+Ll+dyFqOD782EH899ZuqWlI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=JtFccn+7; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-60971264c48so31095957b3.0 for <linux-kernel@vger.kernel.org>; Fri, 01 Mar 2024 10:56:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709319385; x=1709924185; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=h/hkLOGxFb+NGL6rpwIzI3DU/bCodQ7sPVZDGihfs7c=; b=JtFccn+7YxCk4qNDXYazHzLXmlV3Z3oh7BOuZZKHn7etAW3CVaXJg1tCGt0cHcJ7cA etYUUdHBtQcUNC8AusKqdipp/GU4vDiGBdIgRpkSSWRZLjng/jpg1MTWDx2lXStUxSyE PbPD9UD1+N0c3Eb2h5/EED5HQUoBTsfGpgW7HoWB5P4E19rBG/kdFWhVTrh38oK3tYWU 7yqfFpJTqNnmW8bubi0IF1O8dg7rIH9UiqB6Vs0gqUdVuADFMZFrwfQXtpg57rj4clYv f2kxrH8SEC4a6dGOPqzERuOpgy744CkHOUJE92EQsE8lO45GcjH7fUue0uFzlpJiiB4T tzow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709319385; x=1709924185; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=h/hkLOGxFb+NGL6rpwIzI3DU/bCodQ7sPVZDGihfs7c=; b=AVwZ7SINsuF1JX/lprL7ZNsQBdzw9upCX7NhKiXmteYB2TigGJnya1GdzMNttOn5SO P0JLoyPEDzNJK9guPigBS6EweVae+lNG0RUKujoaEziVPIK8rYUWPmY3uqq10/YjQ4v+ sDg5z4RoIdAsYEEeBsNWPTP+2OLZ4tEQGDfKR62hP/DAMX241UzrlQ37shOIYcrBEGg6 z6o64k2fYzvda8NiTWAlbBIZqjYxI0lZKlSsaoDHP34+9Hszxls83gArSwOBhWK2s7Sf Kx9JxJo03kuw8NFQb/59sg7xow3jaVxDnbk/2m8gPPh16SaO5O1YQstaRtDdoTlxAN7o stGQ== X-Forwarded-Encrypted: i=1; AJvYcCWEa9crTbHtCJQw/Za7Y/dUzpPJxXfslon6PI5qZLg1Ihs+qP0Ib5ZPx1HdmkBNWgwWkJtZaxL9m/JhdqT1wcKFBUNd/yQx2WYzdpFw X-Gm-Message-State: AOJu0Ywh9fcZHYgZJffOdts4yfKBjV6cMglZB2GJx3zGC87Tk/PkniMo rWYG6w7e4EtdrmkeOT9H3pJUHlTAJ21dzOa3XBDi0WmcN8I2UGOaBbqzWyW3Jc0cbIPLh9NevfE Lry4ofw== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:af4b:7fc1:b7be:fcb7]) (user=irogers job=sendgmr) by 2002:a05:6902:1821:b0:dc7:9218:df3b with SMTP id cf33-20020a056902182100b00dc79218df3bmr100391ybb.10.1709319385391; Fri, 01 Mar 2024 10:56:25 -0800 (PST) Date: Fri, 1 Mar 2024 10:55:44 -0800 In-Reply-To: <20240301185559.2661241-1-irogers@google.com> Message-Id: <20240301185559.2661241-6-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> Mime-Version: 1.0 References: <20240301185559.2661241-1-irogers@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Subject: [PATCH v2 05/20] perf jevents: Add CheckPmu to see if a PMU is in loaded json events From: Ian Rogers <irogers@google.com> To: 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>, Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com>, James Clark <james.clark@arm.com>, John Garry <john.g.garry@oracle.com>, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Stephane Eranian <eranian@google.com> Content-Type: text/plain; charset="UTF-8" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792351376746102708 X-GMAIL-MSGID: 1792351376746102708 |
Series |
Python generated Intel metrics
|
|
Commit Message
Ian Rogers
March 1, 2024, 6:55 p.m. UTC
CheckPmu can be used to determine if hybrid events are present,
allowing for hybrid conditional metrics/events/pmus to be premised on
the json files rather than hard coded tables.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/pmu-events/metric.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/perf/pmu-events/metric.py b/tools/perf/pmu-events/metric.py index 7d445e47ae09..0b84506cf2f7 100644 --- a/tools/perf/pmu-events/metric.py +++ b/tools/perf/pmu-events/metric.py @@ -8,10 +8,12 @@ import re from enum import Enum from typing import Dict, List, Optional, Set, Tuple, Union +all_pmus = set() all_events = set() def LoadEvents(directory: str) -> None: """Populate a global set of all known events for the purpose of validating Event names""" + global all_pmus global all_events all_events = { "context\-switches", @@ -24,12 +26,17 @@ def LoadEvents(directory: str) -> None: filename = os.fsdecode(file) if filename.endswith(".json"): for x in json.load(open(f"{directory}/{filename}")): + if "Unit" in x: + all_pmus.add(x["Unit"]) if "EventName" in x: all_events.add(x["EventName"]) elif "ArchStdEvent" in x: all_events.add(x["ArchStdEvent"]) +def CheckPmu(name: str) -> bool: + return name in all_pmus + def CheckEvent(name: str) -> bool: """Check the event name exists in the set of all loaded events""" global all_events