Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp639199lqg; Fri, 1 Mar 2024 17:03:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXdVVey9BJS+j/3iyeKivZZYhK9iBfiiP2eHkpdsTVcN/kbodS0v+i8wPUNpkwH3unHzlXdAaD8EvGzLRNLsHFyq9UyGHzxwWdLLnl8GQ== X-Google-Smtp-Source: AGHT+IE4O/t21vFkkeDbfL/1igU885zxDG3wU4LcU79N4e8fXXuyTynquHl3Osk//KciOUKenhcA X-Received: by 2002:a05:6a20:3d93:b0:1a0:ceb1:8f65 with SMTP id s19-20020a056a203d9300b001a0ceb18f65mr3353242pzi.4.1709341404897; Fri, 01 Mar 2024 17:03:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709341404; cv=pass; d=google.com; s=arc-20160816; b=Gh689h6dopvBBuAzawmVUlw4Ztlha2goEXO+EpAwMJHehC6jMewt6j0bl7F01w+Krk a13dBWu2Ar/AWmwgSUj5AomMqfE4UXLyrJvnhY9V2xky9K9g2IKy9MPXqHyzMIZmd54d C4ND4ce9T1jwQc3jB01y7nG+nQCsNZbygENKx0XMOVyoxwHClBxV/XGH4quZZmSUgcdC Ng3VATVcGMV/2VjU3d7DQ7djUkbrqDDGRzSCAf01f9MQfnpm8jpHyHFLCCpsfsM9Zdw+ vlhB0QWK4dP6uY2UtG0em/UJQ9NHfWeyojR7HicDej4LEP5Gpczfl1f1ta8k4WuBjEHm Qh+Q== 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=KxFo9HXrMBHPfRGQr1WhtYDEqITe1Fw0obEsjgP5vwk=; fh=RKhnVfKIBOQliE8+phZT4a0jWwfr3Q2yN9YRmZliIGE=; b=WqoeBWdcnMiIFJ6YvDh8+PPsAPkjAvzjtPgJs80dKw96ZhIatXxXfI5hQ7w4a34H/K KQ6htgQ9FDbgiA6hxxAE0wdo572SJKwyv6u4R6T/32hhp8W0fTi/8gwl8Ra9owsY0Nst 8weQdeUcFKUojTqyHdn82RJPY5KDbNJQoBkYtl5N57EbFvRwC4jHXDAQCjSv2rQOHICb pq+wUyOgqxS4ethw/bsKU05cerCqApbnk2KwBGJ+Vyltmu98VQfJA74o9uuYJzwD4anD luoaF/ikT4PBQyUZxsRnt7nm7aBOeJxuO2n9JaTGH6v9qiYeK+xmDvQZb7LE0cYmccTT IP9Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=AFk8W1dH; 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-89276-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89276-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d72-20020a63364b000000b005dc893fcd90si4540922pga.362.2024.03.01.17.03.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 17:03:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89276-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=AFk8W1dH; 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-89276-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89276-linux.lists.archive=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 4C00EB23E50 for ; Sat, 2 Mar 2024 01:00:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 016C679F9; Sat, 2 Mar 2024 01:00:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="AFk8W1dH" Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (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 926B25CA1 for ; Sat, 2 Mar 2024 01:00:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709341205; cv=none; b=MjSeVe2uHrCmOok3zwfMP8tkOue8Q1x4y2DLCOwANhpZARmrdC2cYyeioqV6uaodKE7nOkowPoMWsEESV1IIupBIhDQLYDKhXSyt62AI2wTwPDlZXV6v3rnGPtE6ITRR+ptej4wOePU4ffTQ9rMe+JhH/dy6GpAdFd4j9Z9tDUE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709341205; c=relaxed/simple; bh=hLfRLYYEBDGHVllbq1W2MRKFt2uEVseZ3ckqP7HQcJs=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=CIgsCuCFekDqrEB4qp4fXEDQ15wc+pBDqFD6nSrqQE6U7LRjKJIoIVQnkapd03y7rRwbYNUEclBoQFlkFdSSXTt4PjKc/YBui2W0RYKDbEvba1ZQwZyXUvSOTEZB+bAt8bWWM1hcAbbDf2mKx9wvVzsKd5xRWboiGBEGRaQI/wA= 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=AFk8W1dH; arc=none smtp.client-ip=209.85.219.202 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-yb1-f202.google.com with SMTP id 3f1490d57ef6-dc6dbdcfd39so5227213276.2 for ; Fri, 01 Mar 2024 17:00:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709341203; x=1709946003; 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=KxFo9HXrMBHPfRGQr1WhtYDEqITe1Fw0obEsjgP5vwk=; b=AFk8W1dHLucI1lzV9klBxz+8G+cQ/sXQjH2CxBpRsZQwpR38Ri68XuEv5uSefbaDDv 9PusemxFaGn+WxpkCXDjwhcrLlrA7+lXHeOJLdsLFWohYIJo2Ao1mbK6YztCF8NeuR1P 9wibUWh2mP6xD94pZ8fVzbhpG+bBkgCEudKC3epFPaAXvOtYAYUBt+Jr6Dn5/Uz3WNPg ESSkDfNL4qPCNvJPZPwPFBFW/A2HAznQvxis7ROGx2CAcREa2h8pPMZEMcKaN6qK6S8N DegiEgPqYqmzNZOMuldmg3Ci2iNzN6QcsRleOYlKEuGM3/Yy97nKFR7NWXP5YIqppC2u EzuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709341203; x=1709946003; 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=KxFo9HXrMBHPfRGQr1WhtYDEqITe1Fw0obEsjgP5vwk=; b=gld+wDFPDGfVEQ3fPcp4SxKSKujrMtIAnf1+S3utd4NufjUEdS00kYXzMB5nS12ezp xzjDqzo/4osYJlj1jKpBszHJ4wAPF+V79eukRZpDiYCoE8NmvovDeuukrk4oe0kE4xRP j4OSARCwSDsN6BqSy/gojVZJHgIuMqf2Fdb+tx9QnsrOVGe3uJEnNe1Uvs9ly/inoSBi UHSn3B0uSdSqwzRXPTVKXCC0TppyBtwc7QaCgs2gwvdZiiekOAlJ1p35zIAp8cx0EBFu HpW+uahT57UAdQbkeACyXOztAyxYqUQyjVbQsulWAGtB3uGGjEka4d6bG/lYA6MY6PdW +pgw== X-Forwarded-Encrypted: i=1; AJvYcCX8jNnTt7zz8LFTblqn7BeDEbRsseN20e6g9BFTqOXCUSV01fUYgzBWfAZ3DNRSBQ0P3nCz9GPDGqCJuznGp8dkSZODiUw8VqGyBhUm X-Gm-Message-State: AOJu0YyR+56u/dJpQflA47iJicFW9Uy8md9ddrsC/5SgiAAj5/W/lHhX lajYZJpSwEqrEBIEB4aVPvkwAMY05PxI/JOEgbFymtySMbVY+5p+CngWaltSPfY6ZZDEerWheyx TnZZLTA== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:aba7:66c5:3365:7114]) (user=irogers job=sendgmr) by 2002:a05:6902:100a:b0:dc7:5aad:8965 with SMTP id w10-20020a056902100a00b00dc75aad8965mr766000ybt.0.1709341202870; Fri, 01 Mar 2024 17:00:02 -0800 (PST) Date: Fri, 1 Mar 2024 16:59:40 -0800 In-Reply-To: <20240302005950.2847058-1-irogers@google.com> Message-Id: <20240302005950.2847058-3-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240302005950.2847058-1-irogers@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Subject: [PATCH v2 02/12] perf jevents: Update metric constraint support From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , John Garry , Kan Liang , Jing Zhang , Thomas Richter , James Clark , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Andi Kleen , Kajol Jain , Sandipan Das , Ravi Bangoria , Perry Taylor , Samantha Alt , Caleb Biggers , Weilin Wang , Edward Baker , Stephane Eranian Content-Type: text/plain; charset="UTF-8" Previous metric constraints were binary, either none or don't group when the NMI watchdog is present. Update to match the definitions in 'enum metric_event_groups' in pmu-events.h. Signed-off-by: Ian Rogers --- tools/perf/pmu-events/metric.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/perf/pmu-events/metric.py b/tools/perf/pmu-events/metric.py index 92acd89ed97a..8a718dd4b1fe 100644 --- a/tools/perf/pmu-events/metric.py +++ b/tools/perf/pmu-events/metric.py @@ -4,8 +4,14 @@ import ast import decimal import json import re +from enum import Enum from typing import Dict, List, Optional, Set, Tuple, Union +class MetricConstraint(Enum): + GROUPED_EVENTS = 0 + NO_GROUP_EVENTS = 1 + NO_GROUP_EVENTS_NMI = 2 + NO_GROUP_EVENTS_SMT = 3 class Expression: """Abstract base class of elements in a metric expression.""" @@ -423,14 +429,14 @@ class Metric: groups: Set[str] expr: Expression scale_unit: str - constraint: bool + constraint: MetricConstraint def __init__(self, name: str, description: str, expr: Expression, scale_unit: str, - constraint: bool = False): + constraint: MetricConstraint = MetricConstraint.GROUPED_EVENTS): self.name = name self.description = description self.expr = expr.Simplify() @@ -464,8 +470,8 @@ class Metric: 'MetricExpr': self.expr.ToPerfJson(), 'ScaleUnit': self.scale_unit } - if self.constraint: - result['MetricConstraint'] = 'NO_NMI_WATCHDOG' + if self.constraint != MetricConstraint.GROUPED_EVENTS: + result['MetricConstraint'] = self.constraint.name return result -- 2.44.0.278.ge034bb2e1d-goog