Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp168959rbe; Wed, 28 Feb 2024 16:20:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVlMfLI/2QA/YdFFMHqNK3+pThk0kfOadm+51qsjHcGwyiaVs1sQ+4BLdCKqrxHIngnxLcdgOUsbVlD98CEj7RYtzN+hyl5AnYUw1hDhA== X-Google-Smtp-Source: AGHT+IFp/JzWTHwGXjO3oYHUgBAyrmTbp58Fk8KPBdIS9C1TqvYRUQTDu1hBer+rgGR70JXvZccB X-Received: by 2002:a17:906:e915:b0:a41:30be:4a82 with SMTP id ju21-20020a170906e91500b00a4130be4a82mr238877ejb.61.1709166004960; Wed, 28 Feb 2024 16:20:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709166004; cv=pass; d=google.com; s=arc-20160816; b=AwZUfbrBXAImYiNggDSEgaLuvKTcjnVQUClC6rnyf/BTeHeGXtB2QxIJTMBB2F4dmx qUHC6d8MIHZ3X6kLMfKAfuTJH6/KcENIjtx5+2ZJODt5AFftb/Z0m6hF+bcfixUol9OU m6ew6qSwQlyQPjx/mdhUuY8pUb/JdmWaItkT8J+bRPvS59ub62jSBhKJR8NanAZUWKw0 vePCAn9OWHJ8rUXol7HKO7E1OiYTZOcJEEVd6erL1MFui9IOGg5eitFXidPAkZBQOZ7i tQHmrrzE06i6BR7l3cXWJ2IWCR7ywyQ4kOwU2WBCKi9BHIRfsABFwBEyb8N4V7qDHKlT ylkg== 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=dSyxWL9CUFX3fE6recAd0yV0Q+Es3D3sjDkm1nLuaoo=; fh=V3Ay7NMi+Fjhk0Yw9uh1mb1vsO5xuZ6rM9biBwelcNA=; b=Ccb9AA51qdVFDkvP46/umFebo8p5rm57+BLdb+eJHhJge6X1GDI8agIFQfnkV/b/vf nkZXvSb9No3RzCuYCoNOu0d9cbLuyhUeHHslUbR58p8+2Zncy434Rkdt7AHk9i3FcCgX MtQUrIod1MvPX8hhxSrMzgYjWo+5S087C5kyekmnRobLuafLU7TWGRfGOst+PRWFKyEY BDNZ0v+UcCuaI5b6+NQYBLNS4E8QgEuZBfOvqG1PedVqWJhMVsuDM3YK7estYiQYVaBZ vh5mrLxGBEVdGLdnBbXbIMZXmXC89JQqLONRB9Gsowqhwq9uo1rcWfn8AwMvQbiNSfmv 3Nuw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=0DKo0cfc; 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-85895-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85895-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h21-20020a17090634d500b00a44052d7f2asi54696ejb.314.2024.02.28.16.20.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 16:20:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85895-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=0DKo0cfc; 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-85895-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85895-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 am.mirrors.kernel.org (Postfix) with ESMTPS id B5AE01F214F2 for ; Thu, 29 Feb 2024 00:20:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 83D8F3E489; Thu, 29 Feb 2024 00:18:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="0DKo0cfc" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.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 22C5E2E851 for ; Thu, 29 Feb 2024 00:18:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709165913; cv=none; b=LikWfCiyFvqWp0kufmGyIaJk0V3CjOO3R1EYDVOe1lEg3zL8QoF2KihCObwtT4LH6TJ6XRtjntcuUtFoSeBBQJb0rBfDshBJqiyaOWUzcxo2kBnp6/jWbaSo7qb5dbHxC76gtdS3ElJ+yVKP+I3ZFVXzYVoxqMO176tnfBv6tPE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709165913; c=relaxed/simple; bh=HP0z9zpsAm/qTeZtLVT9exF49dLNPcCcFWKRdfJf6nA=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=qDi3zdGvvq0Lfa4aZMhDCMTmYi45ylKRbZe9QYITgn3ktGNv5bot9/fsXGE54mN9BZ3yT6Z25hFU8c/V4NNkJBjVqXsWhudP+nPb/gZOjZF1Dg5JmH/BtIzSdcivDw6wVXmk14ZCNCuxyL8srSrREsYUEPT2FHBYSiMwuZRNjpM= 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=0DKo0cfc; arc=none smtp.client-ip=209.85.128.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-yw1-f202.google.com with SMTP id 00721157ae682-6093c69afafso5830447b3.2 for ; Wed, 28 Feb 2024 16:18:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709165911; x=1709770711; 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=dSyxWL9CUFX3fE6recAd0yV0Q+Es3D3sjDkm1nLuaoo=; b=0DKo0cfcYcLlMxdtDJlIhQjM0JdBLbm+JXZENN+2tKejdWX1G7fxC3qGsvv/0o9QfY Kq6wJqvoWwfj7anM2JiTkQ5H/be0aWKSpXJ6TNqhnbatjobhcx2Sg9IvfRzcitJ2oVU2 bJ4ZUSVPWwBjrzOmZmFThh5pDkVBDAP8pDm0hBq5NIJaBuhAggkD/bJnKPnJpKhqmrbY hQluloJt+DHG2MUG5XhJJ1IK+TfO8xrYvOiABGzPJ8MruRpNsYpUEpMVBb8SSx8imRRP T2GyKNxhhIqZ8+BgUsACa7zX5mroqqVkS3ouudEN5f6QtlgkvbTQ2hMMEIV44mDu7mko fCTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709165911; x=1709770711; 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=dSyxWL9CUFX3fE6recAd0yV0Q+Es3D3sjDkm1nLuaoo=; b=hX3ryv79EJBWsXCe3ggq00tR7yraZiJlk6H5sIt1XNaaMQIP/zE28qxjJWiqbDsKfk rfk6+5wHHtOikYVA01Pw6pghvgK3pENmz6s4zYC3hfSu8N49UTyNMfYVdPF/BKZFUU3d KhwaaxkvA3PVNBqi1Lc3kCkKUgADoGUcVoA82X6fCzGksZkjBKza0OeL0spKyd1Au1zp H0m6FC+fTUonKX47JYEvWz7VShYrl6MwgtF0Xrq89pJnrdvPEksjH5ynr8PLtH5mXhVC fiqVxn9pwCmCyHgOa/YdPVI6PIcM+9gX4lfQLm0Y0iJmF7nGws7MmdMn5B8BTnV/dfZ0 McEw== X-Forwarded-Encrypted: i=1; AJvYcCWxMHS2kWpC171pU0lZi2m99zA1ygIgX1F7M1gOdA5Add5sKnd7OnNKIZyoGvuOl39Xk40hA+8jd2Jzby/DC9rXl9TmX9UrMuPPkAyt X-Gm-Message-State: AOJu0YxdUGYfCjIxqZIoVTSk8F87fWNa3H7P5ef9UoJv+7FSeVIHFdyx 0dhMCn2hhSYobEjsWBf20Uo+mZwHbSNQ5dt4uZITVFC7Zht9e+SwT6g9jkfFfOLLaVUJVvQR/JD CIKtY9w== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:77dc:144c:334e:e2dd]) (user=irogers job=sendgmr) by 2002:a05:6902:1885:b0:dc6:b768:2994 with SMTP id cj5-20020a056902188500b00dc6b7682994mr43238ybb.0.1709165911067; Wed, 28 Feb 2024 16:18:31 -0800 (PST) Date: Wed, 28 Feb 2024 16:17:48 -0800 In-Reply-To: <20240229001806.4158429-1-irogers@google.com> Message-Id: <20240229001806.4158429-4-irogers@google.com> 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> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Subject: [PATCH v1 03/20] perf jevents: Add smi metric group for Intel models From: Ian Rogers To: 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 , 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, Stephane Eranian Content-Type: text/plain; charset="UTF-8" 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/') + 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: -- 2.44.0.278.ge034bb2e1d-goog