From patchwork Thu Feb 29 00:13:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 208079 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp87037dyb; Wed, 28 Feb 2024 16:14:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXGi1X3GFwk1d8QblVUq1tKVzDrs8miZmlB7YIASyb1U6A56TPy+TfYroxhR3YA0k94v8lBARPjjF17LzFjoH+TcbXctw== X-Google-Smtp-Source: AGHT+IHi7lGXkrc9n7vFTiZ5COgZYv7H3lAzTRxplB7cdjrkrWzeeR+5YVWOzWZBL8VL1imjZXa8 X-Received: by 2002:a05:6512:3e19:b0:512:fe34:9384 with SMTP id i25-20020a0565123e1900b00512fe349384mr308734lfv.58.1709165652164; Wed, 28 Feb 2024 16:14:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709165652; cv=pass; d=google.com; s=arc-20160816; b=KtK/KOE8ruK1iSYV/aSAM/sQjN1mnwc8h/RKBNVV9tJ+I4lEKtPZhw2WQ1tuLRSz1d ddfuMHjK18HOhyHGU7G7erE8cSIFL1nCHBWHGOMs4wqWcHdDbFvRZfthwO23tbklJiWU O2G2nWvX+CHc8g5uZazfE9w9tFUtgNU1SPV6s3joXENc3qjfiZeWLBTqgEDn1N91uE/B /K+O0rROQJ3dbgbW/zhuyc8GdTG+TuvKik7jhochobvcDgVRtR/Z0leHj/Kr06CCtb/c ZjkAhJXdyFSPQBAeLm2U8bQaGBQtj3IfiDp2es+//ux3S5f+peLo+exCNH0hNC9BM3fP 5t4w== 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=7G72lluaDAnsWJX5YIbxhUo5zYGBJynYcdzkkcMI8Zo=; fh=Yn68hS8T4cvDALOWIbjgMVQIRR9Ju9QDqDynvtQyOSA=; b=GUvrKoKYOmQeBvHqdQRA295NGrxQLuSf4Gc7m6kpFuF0xeLouMURfTwBRuM3Oivtxo SgtQLvbvUY5FI2bdTJTf+BC9hnu1MWpaBQyKSmDcPU3ce+hw9mS4tgddi50Z151D0SYT TppXBquZBXX31TBXf6jyKws3r0Z2CpSlwdOlRyuiSZQMiakEOgTnHoVqJDvIKVle3pQF PBplJoccLdbaLoFKnbuMeN8jWmYXomGmTS3bWZPrxtkIbJQI7TrUW2ujR39g2kTRQTXr aghpmRmNAK5HRuYBy+yLG9bl44qtZnOPWpqKs7Es2dnTnlvEtlmoqboCjTiFxvKKWQB4 GweA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=z+O+gPxR; 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-85874-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85874-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id he44-20020a1709073dac00b00a3f4b35cc31si57921ejc.132.2024.02.28.16.14.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 16:14:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85874-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=z+O+gPxR; 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-85874-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85874-ouuuleilei=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 BFC571F25852 for ; Thu, 29 Feb 2024 00:14:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 262FF1DFCE; Thu, 29 Feb 2024 00:13:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="z+O+gPxR" Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (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 04FB9C120 for ; Thu, 29 Feb 2024 00:13:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709165617; cv=none; b=Fxmp6ZNK7eX2I9nL2238JoiZ3eS6faP4FZpUUjd8aPOLqqxcqEIRDWNdSlLh7OQDeNLQDaNS0hCEiLfLhyh1TI2c4KCO2iNyQnW3/1gkxSh96ZKGBDk5HVV5AMsmvwtBaMFAjlghF0uRQ2EwzekHlxggtbteec2Ip/LLh4kk44Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709165617; c=relaxed/simple; bh=RmBYm+ZtRWY2Q7E8540FsapTEKqB2m8rCmYuA4GJXNw=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=DMt2AnQP5PIZ1DDs6IegdcTFqpzxZu/DiqRK+3dQ4nXkkVJWsN6SR/+pMTGPgdB8WXvJHfBmNdc+OLwIsmmcctfCDy+jyJx6IrX6KAqpgkulLblj6gvKKd3y4jDhZppnr2opSt/nwH0mcaICvrAJBW7MfWmY6xuIc294H/0za5k= 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=z+O+gPxR; arc=none smtp.client-ip=209.85.128.201 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-f201.google.com with SMTP id 00721157ae682-6092c637278so5401057b3.0 for ; Wed, 28 Feb 2024 16:13:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709165615; x=1709770415; 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=7G72lluaDAnsWJX5YIbxhUo5zYGBJynYcdzkkcMI8Zo=; b=z+O+gPxR0ziqUTninrIUFj6Co+uH1LwXXPDYj9itPIuDbOvUPiuEPnd/vCIKgMnOQU m187qJ9QEhZmpAUr/NdAXItYLhGqwcz43n/w77EXr798F/nqGCFU31fWKQg8h/NffzSD PlPWm+RJd/8WHgzE2vebUL8wjBeaMdtDXQmJJV3mSuNf9UesYkkjIlFR+ZZVcAEGyEyw c/+f0u63MlabU4/52mIUERnIaV01ZLLMTYivo/ikR37atGpWX+7GnITNmojN7x2iNt69 iEgsneebhtQ4xO8EDzxb5gKDcKOgSvpbkdnoYCpHx4VmiKc2dHGbhG9idOKQBijBiB1l jPXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709165615; x=1709770415; 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=7G72lluaDAnsWJX5YIbxhUo5zYGBJynYcdzkkcMI8Zo=; b=fHNJekQVE1NARdYqCfCGnqEQCVYq3+LlpjCyNv+AxZAYBvLtlFlj1nhtsOJKVVJ/sB HdbC5M6J1SZk0f7axIn3FtCgejhI2UVPvLbcL/bDo7F/n+oQXg+kFOJ/++jnhzmOglVG E0vEF8LSPRqQPiuqKdBNDf2amFT46Z4BjfaN+sKHJliTIu9/Nu7Bfk1Wm21VOWXfulan +LhlayD8akN5r/U9dA7sMl0TXqf5zKq7ocT4qyPnBglxHQ182pBct119fom7BYKo5U90 qlK+VfUOmjln9PqzBUAo2/YWb3ZFcXxjtBp883BYVSdrcSztkUL9AiwIK3L3U2P3fap0 OqBg== X-Forwarded-Encrypted: i=1; AJvYcCXnij/K+uET/ITZZsJQu+011fydvs0Z3QarF0x6r3WoeK+FEAaJtJU/o29iWY2QWOecClYcRCmFygXdu45rfASULJjDT3nKK6QW310j X-Gm-Message-State: AOJu0YwfUh+T5me5Hf2Kl4+RL/+nfeOETGYs0+8fCl3Lg3rJK6O+wz6r dLBTl1b80WEUHmcr8kRsexlmAoq6j8eaw7JPBkcEA00Isoe4hHGR8dyYaVbh+CAokzlOk7K+Aaz hGtN0mg== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:77dc:144c:334e:e2dd]) (user=irogers job=sendgmr) by 2002:a05:690c:c9d:b0:608:ced0:eb2e with SMTP id cm29-20020a05690c0c9d00b00608ced0eb2emr126092ywb.0.1709165614975; Wed, 28 Feb 2024 16:13:34 -0800 (PST) Date: Wed, 28 Feb 2024 16:13:25 -0800 In-Reply-To: <20240229001325.4157655-1-irogers@google.com> Message-Id: <20240229001325.4157655-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: <20240229001325.4157655-1-irogers@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Subject: [PATCH v1 2/2] perf jevents: Add cycles breakdown metric for arm64 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, Stephane Eranian X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792190083154694726 X-GMAIL-MSGID: 1792190083154694726 Breakdown cycles to user, kernel and guest. Signed-off-by: Ian Rogers --- tools/perf/pmu-events/arm64_metrics.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/perf/pmu-events/arm64_metrics.py b/tools/perf/pmu-events/arm64_metrics.py index 0dcf5236ea1f..e1874d8024c1 100755 --- a/tools/perf/pmu-events/arm64_metrics.py +++ b/tools/perf/pmu-events/arm64_metrics.py @@ -152,8 +152,26 @@ def Arm64Topdown() -> MetricGroup: ]) +def Cycles() -> MetricGroup: + cyc_k = Event("cycles:kHh") + cyc_g = Event("cycles:G") + cyc_u = Event("cycles:uH") + cyc = 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 cycles", + 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 = "cycles breakdown per privilege level (users, kernel, guest)") + + all_metrics = MetricGroup("",[ Arm64Topdown(), + Cycles(), ]) if args.metricgroups: