Received: by 2002:ab2:3b09:0:b0:1ed:14ea:9113 with SMTP id b9csp156880lqc; Thu, 29 Feb 2024 13:13:32 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVhzlY+zLDoRw80wWBPbr8IizwwCBeZopu4EPjmI4wfAa4x0YoMKWvNwhVeLZ7pQRw/811TTcCxukrSvhIP4caFV9DwjOAnC5w+K4vgqg== X-Google-Smtp-Source: AGHT+IGVzVQYBvItnK+9/7RJH6tDhgB422Cur4scoUxKJGe5VhG8BnUZWE57hp/ChsphTcAxPjRu X-Received: by 2002:a05:620a:29cf:b0:787:e42f:124a with SMTP id s15-20020a05620a29cf00b00787e42f124amr4221145qkp.36.1709241211819; Thu, 29 Feb 2024 13:13:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709241211; cv=pass; d=google.com; s=arc-20160816; b=V20QShuSvVCJBozDviL/xSwJUASGADzfg/kWZelwqLzUU3t/NVoZobOsu5vyrYgxnW b66DznwT8x8StAaJvbRPSO/81YQh5sPvRHuJrv04EznpqF5ghktUuJRC7+jtnTWLe5Am IqJJIFuIbS5ggWvAuH4S/38u1RYpLtzsLAfUX458g7aFFuS6E3cSop5a8e3poaUZ8GM2 JfJ9cc1BmHa1sYxrr6e3DldY+drnrs4wdeZavLUPvMcxf+jbSu5qxR9qXrt9Du+gnj0s beRXbFOTIQ1Tf7eEgYhcY9i7Z4+rsQSMR7ZniYEmamcm4gHqyhbKLmTUCw6DqwVm35Ac 76Ag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=zIZ5796uUXvnupoMz5v/gwPry/0IGCbnGNPX91tq9wM=; fh=xwiTb8dW8FnIyS8b3h9/neqRLRhsKMpwfKiuZ0NbPVk=; b=DEN8hIoFPGkqVj4N2dpKMAr/YXdMP+P+cCwDlFV6dxtCAB1+cFO7ikDYvOLChOi/yr Qk4gp4lw63GFx2ZSUSuYLn+9HoVke8AmN1ZeoTyxXcGg7QSajhBF2UUKmbjdw+N7HNPR Zlvdcp0iqPtrXgQChqGD/EFfrcDXhZNHbJMLpRe9T2he1HuJ9pasGvJGEXM2YiinD2Ys wQStr1cYOZvDhhweXS6ys1jIlT+fDsaMCVti3TfoQtUmjFrML3SzkGigavhV0+DGfLCw pn7TWgABMDE3okdOcH2Sh93ojBHPBgEWNWu9W1uQhjKkn6pdOq8ecu3hQTwv4T2lAkyE DWiA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=f8vbRf1r; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-87562-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87562-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id w19-20020ae9e513000000b00787fdbfbbaasi1618996qkf.429.2024.02.29.13.13.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 13:13:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87562-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=f8vbRf1r; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-87562-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87562-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 8E22E1C23CC0 for ; Thu, 29 Feb 2024 21:13:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB5CA74BF2; Thu, 29 Feb 2024 21:09:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="f8vbRf1r" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67328143724; Thu, 29 Feb 2024 21:09:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709240953; cv=none; b=rrgHH70a8tTGEvasTO/7sH7tY9S+pE8WYXAhu6/vKkAaf3kFgfm2cg0V5Qgsx/pR9GKjW0ckPdAIthEb/gn6MAdAwjyZSFkIIFQasLMGEjwzl0CZT367S+SdEJAmmMhYAuXy+CIDw/yOszFqF8ET5d1gU/bwRofSmf1N00mVnlA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709240953; c=relaxed/simple; bh=vI3JErcIXK8PkI3jc2jIkSRfvAVQ/YbU0r8nU36vXdA=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=ZU67VgxNNKHB/U9+pNuide+2jqEe9K/e9c8FqgPJo025qR9eIyIDQi2CoLKPcIwqedV1ZY14g6KZc144DGGLP1Ij7EyMpgXMVtFxdaIJ4VFGA0+Qha5WoSF3Cb8F0Hl+5HnCFAqc/ph6AMwMtfRHCgtwgW6hk08JAG72RgC8qNQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=f8vbRf1r; arc=none smtp.client-ip=198.175.65.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709240951; x=1740776951; h=message-id:date:mime-version:subject:to:references:from: in-reply-to:content-transfer-encoding; bh=vI3JErcIXK8PkI3jc2jIkSRfvAVQ/YbU0r8nU36vXdA=; b=f8vbRf1rszH2B0+Zi46r4K54MsoZOMtq3fOl7jnw8EP9gUs3FXM0YXUQ 9WvlOHfpV3cfQfehraXGAhpmGcnIEdiqd9pjYPLSSGkJDrsB1iT6OsdK3 Y+spqIHcm5fwjJgnVc5WdyKeVGfVTv4oH9tkxsBQvPWmg6ERPbX8zwLj+ sKlq0Yoiy+lybeu4Fm2VM9MAMjkNJVekaIN6Zi185IU7VuVskTbB+owds ICZbioBhGZSmlR3qWk8O2xh+dvTlTPfMNpbdZXunizffAcql7/f6KzWSC Vjyrh3Sjk4i5o10PILa7QLDThaA9V/NCHSvac7K+9eGj2qNM+ZaWt1Ioz Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10999"; a="3865398" X-IronPort-AV: E=Sophos;i="6.06,194,1705392000"; d="scan'208";a="3865398" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Feb 2024 13:09:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,194,1705392000"; d="scan'208";a="8341044" Received: from linux.intel.com ([10.54.29.200]) by orviesa007.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Feb 2024 13:09:04 -0800 Received: from [10.212.85.217] (kliang2-mobl1.ccr.corp.intel.com [10.212.85.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by linux.intel.com (Postfix) with ESMTPS id A8308580D37; Thu, 29 Feb 2024 13:09:01 -0800 (PST) Message-ID: Date: Thu, 29 Feb 2024 16:09:00 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 03/20] perf jevents: Add smi metric group for Intel models Content-Language: en-US To: Ian Rogers , 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 References: <20240229001806.4158429-1-irogers@google.com> <20240229001806.4158429-4-irogers@google.com> From: "Liang, Kan" In-Reply-To: <20240229001806.4158429-4-irogers@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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-events/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, Metric, > - MetricGroup, Select) > + MetricGroup, MetricRef, Select) > import argparse > import json > import math > @@ -62,9 +62,25 @@ def Rapl() -> MetricGroup: > description="Processor socket power consumption estimates") > > > +def Smi() -> MetricGroup: > + aperf = 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? Thanks, Kan > + cycles = Event('cycles') > + smi_num = Event('msr/smi/') > + smi_cycles = 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 metric. > + Metric('smi_cycles', > + 'Percentage of cycles spent in System Management Interrupts.', > + smi_cycles, '100%', threshold=(MetricRef('smi_cycles') > 0.10)) > + ]) > + > + > all_metrics = MetricGroup("", [ > Idle(), > Rapl(), > + Smi(), > ]) > > if args.metricgroups: