Received: by 2002:ab2:3b09:0:b0:1ed:14ea:9113 with SMTP id b9csp250753lqc; Thu, 29 Feb 2024 16:54:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU0SqpTK9dQGFDo/EYDEuwS7VwNskcrZpquNMXOhpRaf+xxW1JDdW8VCLppi/qL6XdR/Am11M7kKJu5ZR/QaFzdg3Rc6svKJuh7+LBa6g== X-Google-Smtp-Source: AGHT+IF18HbR2zmhKH33XIZGoT0oWcqxUZcbxZz21bqtw0QZsKcwlgVdb8dzIfneXzUdEDA62GXQ X-Received: by 2002:a05:620a:6289:b0:787:f2b7:e423 with SMTP id ov9-20020a05620a628900b00787f2b7e423mr505260qkn.0.1709254468473; Thu, 29 Feb 2024 16:54:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709254468; cv=pass; d=google.com; s=arc-20160816; b=yxTuRiMCYMfRBFaZzY4KvdIHxqV9MNh4YKZi4QbomC73Z4gdS3LG70TRBsFXGUEmS+ LDrdFmIVOv6WpUyNk4VazD20VllOJKPWj8UyhdfV3A2meacqpJfSJ0BFfgVoK6ejWPy+ byGkU5Pua5yCnWyjw1xOhpz5K3ImqVicncTaLZvBvmKE1N7agykJ3lJuBf1kil+lu/8W wjaOSrjgc08YTVeJyDOhJSV3Nk9ABp71alIMU2ay6ZvrjWu54UUphX5FvQsNtXPJaO/m WNuRL5dTnrL+KpcDGUHDNA+/itX18BMqlQbD8tdtpctZr82do6S+C8kDo5mLf7BIx/it WkNg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=tftcmnntcbV6/bHuFB1XAMaQpSPTXIzs4LXNnedmduY=; fh=xj1esfSYkZ51oGfbA6BcFr0+cW6AJ3l2pLiMu33Ld6Q=; b=PrxMYQ5ibw8ASm23PT9egTDMRLctbSO4ZGRaizAEkxo9z2OcjpoW4iOtgzuuvP2Anz XOZwL2GYZG5exzR34zUJrPDwbt1xEAMAvTRjYeJdGmXwcfy3c6Ag6w2ENsXewgYsmKT8 8BlCzKwZk4K2S67KypGm8OcmtegA2NJvMzy8ZfEFV+4d26g4FnPsIVnuhmBAAj8+EreQ 2FjwRUKm97IyH8pAB1GJIr0IU/+ToJsQO8sWewIM2T/nC5SIGna9LwlCrCeisGjyIx04 KVpjmIFoWPH9qKgeWZ7YihOPOQ7UHNkLFvEOwkdyVbqIPzo4wkDMsBA2ergj5vJXncHs B1jw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=VgBYQMSY; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-87747-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87747-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id de43-20020a05620a372b00b0078769904e35si2846091qkb.219.2024.02.29.16.54.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 16:54:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87747-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=VgBYQMSY; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-87747-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87747-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 091241C2118C for ; Fri, 1 Mar 2024 00:54:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B11CD1119F; Fri, 1 Mar 2024 00:54:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="VgBYQMSY" Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 7A3502FB6 for ; Fri, 1 Mar 2024 00:54:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709254460; cv=none; b=kU8DV9+r2cchw9eLr0aMuzVKfJJ4uNQAeTAZvWEgTsuvsslCjwx6QGkTcjn3pzxNZlO7oUWIzRCKmyepKEKMkYOoDTXrqW2fKK5uQZDeSf4VtZyWmZ9bvxCI/miXKFGwjnPt6ZlqMwQS1TNGDk1sy10iNE2Man0VhECDpqQ3T4o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709254460; c=relaxed/simple; bh=+upbwOwPoo8Bow3xcmEk27AbSn6dIIFXUaLfgqKiY/4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=mJoatFvgMpVT7hyKql8d9KJd1iI7kH/gF87zZyMjIYNIr1ugIWLIacOOo0bLMxXy2UXRaJ+RQ/SVhU4D2g/A6kEKQyCDWzv8Ct38aALPzf3QgRo/IKNdXbu2GNyU5J5Yhg4+H5pDgL5AWH04uagh78OGT4/fw/qJ8a8Qokk0uDA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=VgBYQMSY; arc=none smtp.client-ip=209.85.214.182 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=google.com Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1dcd07252d9so30155ad.1 for ; Thu, 29 Feb 2024 16:54:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709254459; x=1709859259; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=tftcmnntcbV6/bHuFB1XAMaQpSPTXIzs4LXNnedmduY=; b=VgBYQMSY5Iy0x/UJxcFmOIayQwdMGQlkDwa3jW4S+USEWN4VPpWwfK9hja0HifFyza S9sguXdTMVubsynec15nZTUEMpW6IdLBx+nfeh90QN2O1KAQ9BPTLlKTKq5qjQi1ukDw MKd+hzSGM2jcMZTX69jCqui8Zrp3leUrM2u4K54ZgEyYiJPL7eShnRL1knrHklddQRLR V9CjqzFQN1swu9PDMn0BQp01JbtIzDoPwmBsiXNJqZFjovKkM4pdPCRwJ9LksB2ENDhT ErMPRzfmLmBxSvqP0KZNcpbN/US87jDIoOd9cwIjqNu16I3WycZ6FryvxmAAeplWlW/o mS3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709254459; x=1709859259; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tftcmnntcbV6/bHuFB1XAMaQpSPTXIzs4LXNnedmduY=; b=mXO5x6YpXbnd1FKehkl76mLVGvpd6dtWBOOyaxaIQayDD0sYuXOPRa1adjw6ZhVd7b 16nVPSZTMUb+QzC3K4+DARsXEFUJ6PK1Vlw5YPuEGyDmiPcw7i2laklkTf3qmoiJ9Kau pjclULKpnMOw0Dh2QV3TbAtaOQXV6BFdZHyjz1RvXiKdX9RwlJKbsM29S4Jw4VXzdfzD ONr4t8Xf2ylkZS0L+wJBta4FnUp96l58oSn+tIzUll0+Dvr2yDo0/DCdJEoGzxRDEuxP MQuyALFJFqIU+wL3ByhcRZJUMSs89MlvUKNM21VrJYJr3KDcX9aIacko5uQFNpcPPWqy YSQA== X-Forwarded-Encrypted: i=1; AJvYcCXkzlUAljg/RMGBb+3X59VDKxiA1MIKJOolXsUq8LIT7n63IOnAQ5aqFsG+nJ2WsROmt7AhMgw3Dg37oHEg2CO3aqBcnXpgicLD3hkL X-Gm-Message-State: AOJu0YzEF0Y7/M1xgrjUpwryzdlMNLMVfjE4VCuRWw42KfVIvdtBifn3 n+TOHn/GDGespdmeNNqRv6W/4BKzMvlRoYmeGSH9S8Mdsg+0Cz0UnPOd3sP8voFj7z+VObij3wt u5HHEjjwki663lSG4cf5X5rWMr+vjykYZb1we X-Received: by 2002:a17:902:e74a:b0:1dc:2f51:b120 with SMTP id p10-20020a170902e74a00b001dc2f51b120mr87629plf.14.1709254458494; Thu, 29 Feb 2024 16:54:18 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240229001806.4158429-1-irogers@google.com> <20240229001806.4158429-4-irogers@google.com> In-Reply-To: From: Ian Rogers Date: Thu, 29 Feb 2024 16:54:07 -0800 Message-ID: Subject: Re: [PATCH v1 03/20] perf jevents: Add smi metric group for Intel models To: "Liang, Kan" Cc: Perry Taylor , Samantha Alt , Caleb Biggers , Weilin Wang , Edward Baker , Andi Kleen , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , John Garry , Jing Zhang , Thomas Richter , James Clark , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Stephane Eranian Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Feb 29, 2024 at 1:09=E2=80=AFPM Liang, Kan wrote: > > > > On 2024-02-28 7:17 p.m., Ian Rogers wrote: > > Allow duplicated metric to be dropped from json files. > > > > Signed-off-by: Ian Rogers > > --- > > tools/perf/pmu-events/intel_metrics.py | 18 +++++++++++++++++- > > 1 file changed, 17 insertions(+), 1 deletion(-) > > > > diff --git a/tools/perf/pmu-events/intel_metrics.py b/tools/perf/pmu-ev= ents/intel_metrics.py > > index 46866a25b166..20c25d142f24 100755 > > --- a/tools/perf/pmu-events/intel_metrics.py > > +++ b/tools/perf/pmu-events/intel_metrics.py > > @@ -2,7 +2,7 @@ > > # SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) > > from metric import (d_ratio, has_event, max, Event, JsonEncodeMetric, > > JsonEncodeMetricGroupDescriptions, LoadEvents, Met= ric, > > - MetricGroup, Select) > > + MetricGroup, MetricRef, Select) > > import argparse > > import json > > import math > > @@ -62,9 +62,25 @@ def Rapl() -> MetricGroup: > > description=3D"Processor socket power consumption= estimates") > > > > > > +def Smi() -> MetricGroup: > > + aperf =3D Event('msr/aperf/') > > There are CPUID enumeration for the aperf and mperf. I believe they > should be always available for a newer bare metal. But they may not be > enumerated in an virtualization env. Should we add a has_event() check > before using it? It would make sense to have the has_event so that the metric doesn't fail in perf test. I'll add it. Thanks, Ian > Thanks, > Kan > > > + cycles =3D Event('cycles') > > + smi_num =3D Event('msr/smi/') > > + smi_cycles =3D Select((aperf - cycles) / aperf, smi_num > 0, 0) > > + return MetricGroup('smi', [ > > + Metric('smi_num', 'Number of SMI interrupts.', > > + smi_num, 'SMI#'), > > + # Note, the smi_cycles "Event" is really a reference to the me= tric. > > + Metric('smi_cycles', > > + 'Percentage of cycles spent in System Management Interr= upts.', > > + smi_cycles, '100%', threshold=3D(MetricRef('smi_cycles'= ) > 0.10)) > > + ]) > > + > > + > > all_metrics =3D MetricGroup("", [ > > Idle(), > > Rapl(), > > + Smi(), > > ]) > > > > if args.metricgroups: