Received: by 2002:ab2:3b09:0:b0:1ed:14ea:9113 with SMTP id b9csp249132lqc; Thu, 29 Feb 2024 16:48:38 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVwilYs3+BCur8vvXPifM96kvd3kb4JPv+BnANUR+snxKsLCvFZ3oXCcO2Jnxw5JiRl7RtYBhLjtNbBd3B22NcPvKgnwIjGw86A3TG83g== X-Google-Smtp-Source: AGHT+IEtYBAUSXG23/zNg28+0h+QEPn974ZXXLD2iOfiOTF76etj1kCy1/apG+qtxJrDFxXfNciV X-Received: by 2002:a05:6808:347:b0:3c1:c1ae:1613 with SMTP id j7-20020a056808034700b003c1c1ae1613mr226700oie.54.1709254118462; Thu, 29 Feb 2024 16:48:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709254118; cv=pass; d=google.com; s=arc-20160816; b=y2sJXcDEAMA/27mXZZxBQZ+weCDtdFhPY1GVdpAIPuTRclsCaQ8j5m81C4cuMuRTmG dsTr/0Aja/Ck1iQfss5CCPym+yzIIgZ+p7TlO0YeGOVOeMKCLEoFtFfPE7a7blUfOu3s fvVYopft4zC3l1+kd1D+5eAv76VSvtizQrHocIsmCQTAFEgNBTZAWMrM2pqA56U1T/kx 26QL9PQJNHnTExrz74MFlkUR9pPFvwJ1W2CoXtZoEsl4/Yc4CDo6efbz0jMJ4IdpCW2V HiDxQuHbM81v2G5gsoUqYV86ZldTTxqUnER9xZQzD1zXkCFn04giZAQnLIl7XIn8C/Q4 JFkw== 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=QO8hdlL58lho+cQ23ggVJcM5manEQk2nVKwT7YU6wv4=; fh=X+Nyjoqps9FkezJMBWj3q5EgYVBnftvG6vseSRp6cT4=; b=rWQygFyZZlbAFPevdZnvDtCniPgVVAruSaPjU8w8Uji0O44EY7k1UWFkkjgjPrCwIQ ROXcjzTqebZgGQEGxa/nyp5qTmNmKZI5v8dS2CH7JwBFQ/zNsfs6Hj2gA8k7vPN2T7OE MoE+hJPaYhr2LZwhmz4y9wEgFKB99wkEZpstIu8uA5DB5Poy1fwyhUNCl9V94sfipEg2 GeXJDwr7grFIPXbCgAVHrrfUoAglbI+qG5IQxFb9Eu1NwwpEV92b8NumcuqTuGwiyy3J z7lOYl9ZG4L2lsaXAKLs/qy18L2mTHNQ8XPi9ZYVrMx8qhqCTrJkUMgcyj95abUXECMs m/6Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=aop4EUGo; 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-87746-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87746-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id jw40-20020a056a0092a800b006e5514c4de3si2461028pfb.349.2024.02.29.16.48.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 16:48:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87746-linux.lists.archive=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=aop4EUGo; 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-87746-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87746-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1EABF2847BD for ; Fri, 1 Mar 2024 00:48:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB80CC2CD; Fri, 1 Mar 2024 00:48:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="aop4EUGo" Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 98054C134 for ; Fri, 1 Mar 2024 00:48:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709254111; cv=none; b=ph0Se2n7TV0QHD3uZQ1LfleEYEly6LY6/PMu6sL+vR643GAFqhSYUPbiiFnwqWJNoZOi4BBcgGEp/PCW87N7TaYczI7u8iKTDqqoiiU51OAIpLXXhqBi8s0hG8Tw2+uLFJYbVkmDJ0dmUa+6oreue9VB2DvZ6YXXz8NAya7g+iA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709254111; c=relaxed/simple; bh=SBRUs1L7SWjgoe78TnGDqNJlwRB1w1wl2d4Ujn1Z/hE=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=U299qmvOKkKc3Q7tbvig2t0qGaHHIauYcoufgk4sTSxy8CWzKLPW+uFVMNZ3aisQZr76qj0YdxvuGLncboquZezpy8faU6kleGEx27DnSrS99LOX5rd+p4WIAe2DLzCU558W5rYy6ETKDlJjtchJpsMTELR1md8h0t7lbBs5QYM= 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=aop4EUGo; arc=none smtp.client-ip=209.85.214.174 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-f174.google.com with SMTP id d9443c01a7336-1dbe7e51f91so27665ad.1 for ; Thu, 29 Feb 2024 16:48:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709254109; x=1709858909; 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=QO8hdlL58lho+cQ23ggVJcM5manEQk2nVKwT7YU6wv4=; b=aop4EUGoBUup4rblaRolTFgeXEYQVcPBzJX8dtP81PRWpwn87EgWdgNPU6hYRYniiF lfSc40LfT/1FjqgpAwURskBL6/TXv1OLo4YAWu915HX+B9g5kHOfHKOAOhkY9l2UsSex ppejEXlp/Pk/ZyirEjG84iaxaVZgYqsmtUtRV4O7MqsLxbqY7klMlrbiKSqL1hsbu8FD MiGUx9mwDmSq02YeTmlq1GUkZUuLLoBGjX+0CeTo+MOogyQG7lY/eSpL/26pvZ4SlgzL KsbLUthQQZtp56j10INHUHEQrQ4M3OCymlLR3hDqE6CVDIJs1q3yAD7Tbs6QAmghAoNc o2XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709254109; x=1709858909; 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=QO8hdlL58lho+cQ23ggVJcM5manEQk2nVKwT7YU6wv4=; b=ikmdfy8chH7ph0wo5/WyhDc9ayp1Y3+wqIwToLMGdiDuDf2tMd/isEIDUuPq5w2s9r pqKh4eJMJS9I23G8QYIqNth1sRED0aTp/Od1LI23AY1sNUEoyE8+KyVpibj9m/18F7dJ Jt/yj3QaWiTX2cmV537dXRaij4Fswo6ZgkbpSvU6lncl49SAHcDkLDAYdr4kfr6Bxumy IdN8oUljYd4iNKBe5fFiM74hYeE8GHxUrx6GrtnvO/IhbpKyxWBED6pchx5fMGj/7pXO YtXGO+3oUdyNKyynumFQbFBuiI4LlFSA8L+B716okN3a7CjKnIdNLiH9adhsQ2lCEYCU 6VEw== X-Forwarded-Encrypted: i=1; AJvYcCVz/Zti2+UgHcpGkQ7d3WivRpv7UqpLQCw5pkBHJSRE6Ue2FenTXlXFYFmn85iw1+AkBKyPh3wXzSAVMA4QT4PiQCixAioCePHc+iwa X-Gm-Message-State: AOJu0Yy/2NmWJYGhWVbS1qIyPMOHqJjO6wj5cCF+OTTTEv0TfO6MrkRG b5vpIVb44UD5pdBW9NGXZgdohxNhfpVTRQDCWy/dG6WHJPTMyMFpQvPyfTvfa4c2Q+Td7nJlTpX ybOSU+5unQuIEe7P5oIewjTffkY5hZyQYAxXq X-Received: by 2002:a17:903:244b:b0:1db:e78f:4ce9 with SMTP id l11-20020a170903244b00b001dbe78f4ce9mr83835pls.24.1709254108425; Thu, 29 Feb 2024 16:48:28 -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-14-irogers@google.com> In-Reply-To: From: Ian Rogers Date: Thu, 29 Feb 2024 16:48:17 -0800 Message-ID: Subject: Re: [PATCH v1 13/20] perf jevents: Add cycles breakdown metric for Intel 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:30=E2=80=AFPM Liang, Kan wrote: > > > > On 2024-02-28 7:17 p.m., Ian Rogers wrote: > > Breakdown cycles to user, kernel and guest. > > > > Signed-off-by: Ian Rogers > > --- > > tools/perf/pmu-events/intel_metrics.py | 18 ++++++++++++++++++ > > 1 file changed, 18 insertions(+) > > > > diff --git a/tools/perf/pmu-events/intel_metrics.py b/tools/perf/pmu-ev= ents/intel_metrics.py > > index dae44d296861..fef40969a4b8 100755 > > --- a/tools/perf/pmu-events/intel_metrics.py > > +++ b/tools/perf/pmu-events/intel_metrics.py > > @@ -26,6 +26,23 @@ core_cycles =3D Event("CPU_CLK_UNHALTED.THREAD_P_ANY= ", > > smt_cycles =3D Select(core_cycles / 2, Literal("#smt_on"), core_cycles= ) > > > > > > +def Cycles() -> MetricGroup: > > + cyc_k =3D Event("cycles:kHh") > > + cyc_g =3D Event("cycles:G") > > + cyc_u =3D Event("cycles:uH") > > + cyc =3D cyc_k + cyc_g + cyc_u > > + > > + return MetricGroup("cycles", [ > > + Metric("cycles_total", "Total number of cycles", cyc, "cycles"), > > + Metric("cycles_user", "User cycles as a percentage of all cycles= ", > > + d_ratio(cyc_u, cyc), "100%"), > > + Metric("cycles_kernel", "Kernel cycles as a percentage of all cy= cles", > > + d_ratio(cyc_k, cyc), "100%"), > > + Metric("cycles_guest", "Hypervisor guest cycles as a percentage = of all cycles", > > + d_ratio(cyc_g, cyc), "100%"), > > + ], description =3D "cycles breakdown per privilege level (users, ker= nel, guest)") > > + > > + > > def Idle() -> Metric: > > cyc =3D Event("msr/mperf/") > > tsc =3D Event("msr/tsc/") > > @@ -770,6 +787,7 @@ def IntelLdSt() -> Optional[MetricGroup]: > > > > > > all_metrics =3D MetricGroup("", [ > > + Cycles(), > > The metric group seem exactly the same on AMD and ARM. Maybe we can have > tools/perf/pmu-events/common_metrics.py for all the common metrics. Agreed. I think we can drop cycles in the three sets and then once then do the common_metrics.py as a follow up. Thanks, Ian > Thanks, > Kan > > > Idle(), > > Rapl(), > > Smi(),