Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp169207rbe; Wed, 28 Feb 2024 16:20:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVZnIbL/ylOTT0xlnTRuO73153d20fxL4y7DMkbOK9lPTHubNVaruJDlQsGf34z6Z1lz9RiCOwha8Lreg1/0DQQfT/LsRh9y7qHY5qysw== X-Google-Smtp-Source: AGHT+IGcMvp6gOAAffk+oXy5lVEeoM7YN3XGEzSBTRbTLKc3IeWTveEKRq4p2Y+x0ze85MdHKCAw X-Received: by 2002:ac8:5cc6:0:b0:42e:b793:4acc with SMTP id s6-20020ac85cc6000000b0042eb7934accmr698556qta.24.1709166040418; Wed, 28 Feb 2024 16:20:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709166040; cv=pass; d=google.com; s=arc-20160816; b=dLYIJYelekWFIZmrxRLS+oZpad5AVS0W2Gxrr9SzMM/kj4TY8CSUSZLjF8p3vkAQMk hgfaTQUbQiXtBa/EqhX2DMlDH4lTXM7j7w9KCjxd8062CTdUSOxi8ttfBUUiKkkpChS8 2y96uUNwkLE5QzK7U3W5FOBB+NYOf6KhJ5dL1TMmyoTAnBo6Gy241Wro/Ylcs/gBbO7/ F7At71AymDSzruO0qNCLPwkrQbsmWaeSAjaCK40VGLO9EStDj9VDOsrZBDRpozL1pF7G inuMqaDyzKMf7QQy56Gn+yKjPlPwZIDpv2+2o+cTsspu/bJmNXhZv0J6yprTGfRzSqAB xVqw== 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=QHYTrWPQQfDvRO2Y3kXJ96unWdbam7XTLAS0vgfzft0=; fh=8LZH8zANhwST2YFan8xfpG5o46UJBT1Yl1d4dlzlybA=; b=CG15Wv4Y2WCauGYk49l+CoIfscgDlGbKpp7fhOas1UVZ9YYIfR4ORUVeiVhIcbZe5+ /WMoRnxCD1My+xqGGSW0J3Vq/N+8/M6cjaz/zE0HzyrU6bhCRXMGrNHbc2lNpgmI2yAQ HxH3gAmpDlC8JG0ZmbM0EGu66riTdtIiaxRUhJQdYX+GAOsJVvjvcT+vYPiEOLfHviDZ BGWE0zLaC2fWF6V8xfAHE5ORMjhXdPG/x2ba8DBJ8grhcICN40NlpbuZl/LNDj1LwKdS YyGKoJwX8O5Eg/S0OboVy9ENHLj1Gmat4pFX9mrwhZO0rzNxDHqTSPvfXrryUyosk60M /7Aw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=pR06XwA5; 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-85898-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85898-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 v15-20020ac873cf000000b0042c60432fc7si247748qtp.809.2024.02.28.16.20.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 16:20:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85898-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=pR06XwA5; 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-85898-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85898-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 0CF011C20B9E for ; Thu, 29 Feb 2024 00:20:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 679A952F61; Thu, 29 Feb 2024 00:18:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="pR06XwA5" 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 B059E44C9C for ; Thu, 29 Feb 2024 00:18:38 +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=1709165920; cv=none; b=iIOF9L9Umbkb+ksKsS9pu56VqKQbDTRlhmNOHF3BfvNJWYbjCjmACIHWbDEdUnEoJfRgNrGpVuTmeQ8+hVI7YCrsaWIBOm5Q9PVxE+X5h4nt/a3lMwvYCo5jx0eOaMAYH8/+KDqLdLoHjqufCHSycoeUdOZFVzeczUapqwucrBE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709165920; c=relaxed/simple; bh=OGxEkqtAUV2coFbRq/RJ+uPweZKIEnWlAUORKInoJ9k=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=o1OSfn4TSCNKQoyUDlmR4CxtUbLYRZkxxPq1x46Wl6DyBw8H1Of62gjXflVLGDW25zpaZ9eB1JpW/mC+hDq2D4SdC/pa1QpgkBaOby5xd06npUFimUAmPxe18UJPcYJP2jNa2vXlKMaLfAN4MP1TvO9QJHg8qNeebQS8ULR/Pjs= 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=pR06XwA5; 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-607838c0800so16776767b3.1 for ; Wed, 28 Feb 2024 16:18:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709165918; x=1709770718; 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=QHYTrWPQQfDvRO2Y3kXJ96unWdbam7XTLAS0vgfzft0=; b=pR06XwA5lQ9LpnUlZYP7b9tIwA5e47krSbwhi7Nkhfatb4DJAwfubLgO90TwYDmEO4 FgbArula5qk/jcYnL0B9xl4pidhkd7LaDW/9t0NYBJzou60+vBBETmiZU9/x4C4kgg4L HSoavzNP1z4zKcEjKV9DSD2fUAKrNLFvDWXebXOCa8re02Dtsjh0BEzggc407h0ZX8L8 mS7u2VxhhXGkfZEOA6E1hge/ToiGYDDt3cL0b5zMqUR14xMCgvxEq2JRDvsHMe6aU63c Ka++HWop1e36Caj/nGWHNPzq4P1dnHlMaNH+GZiQFgH7lZK/QqOTOxKcdLQ9+EP5VaAe oEQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709165918; x=1709770718; 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=QHYTrWPQQfDvRO2Y3kXJ96unWdbam7XTLAS0vgfzft0=; b=fSFUB1vaQKOzeDeUNobJr3jMkIT4PBLLr0G2C6XJ21UBAROVTKiS9bEYZu/wloJ+oj OzqdTJfwlEniQJIckK4+JmN/mL+XD4vsMo9tHL3T+ptLPHnuNKnfxSQCPF0ss6zBBAgt i6aVTLIY5kX/dPPfEHhBl2fZqechdl5BEVjchAB84puDTNtk/wcyc4MGUnOw0uJg4lNU 5iV5DxI1AYuRoZXt0RfNBx/oK2JWumr37jQUF8DKvDablYgbEZIV7w5IORst/UMufBLY 39IJwbQTRRZzv2aa4rw7upQp4gjuDawu+Nr5WqD0bv0UoI5AqZFqH4LdJewrDDSFQRCY pnvQ== X-Forwarded-Encrypted: i=1; AJvYcCWzX5v871M6VNb5FrmhNJXfmN4gxfKkbFCsWc/8xjIPmfwi980LHINlAnwjEQuqHv7AgT5iR8pSKBTesxa0dCj2WKYRSUnXkqmd7nqE X-Gm-Message-State: AOJu0YwjrqezrxKdBgS/IJbvgTFb4KHn4Ahx+6R+NC1uVwLDbcfLCO1w SwN6FuutxJOM/Jd+0uzlaIW21e96N8QPRiNdhvSJj2YLToXAAdzrHMfylOjq09gGe47gIaWexz+ /CELFyg== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:77dc:144c:334e:e2dd]) (user=irogers job=sendgmr) by 2002:a05:6902:505:b0:dc7:4ca0:cbf0 with SMTP id x5-20020a056902050500b00dc74ca0cbf0mr46479ybs.3.1709165917807; Wed, 28 Feb 2024 16:18:37 -0800 (PST) Date: Wed, 28 Feb 2024 16:17:51 -0800 In-Reply-To: <20240229001806.4158429-1-irogers@google.com> Message-Id: <20240229001806.4158429-7-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 06/20] perf jevents: Add software prefetch (swpf) metric group for Intel 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" Add metrics that breakdown software prefetch instruction use. Signed-off-by: Ian Rogers --- tools/perf/pmu-events/intel_metrics.py | 65 ++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/tools/perf/pmu-events/intel_metrics.py b/tools/perf/pmu-events/intel_metrics.py index bee5da19d19d..f11273e9935c 100755 --- a/tools/perf/pmu-events/intel_metrics.py +++ b/tools/perf/pmu-events/intel_metrics.py @@ -265,12 +265,77 @@ def IntelBr(): description="breakdown of retired branch instructions") +def IntelSwpf() -> Optional[MetricGroup]: + ins = Event("instructions") + try: + s_ld = Event("MEM_INST_RETIRED.ALL_LOADS", "MEM_UOPS_RETIRED.ALL_LOADS") + s_nta = Event("SW_PREFETCH_ACCESS.NTA") + s_t0 = Event("SW_PREFETCH_ACCESS.T0") + s_t1 = Event("SW_PREFETCH_ACCESS.T1_T2") + s_w = Event("SW_PREFETCH_ACCESS.PREFETCHW") + except: + return None + + all_sw = s_nta + s_t0 + s_t1 + s_w + swp_r = d_ratio(all_sw, interval_sec) + ins_r = d_ratio(ins, all_sw) + ld_r = d_ratio(s_ld, all_sw) + + return MetricGroup("swpf", [ + MetricGroup("swpf_totals", [ + Metric("swpf_totals_exec", "Software prefetch instructions per second", + swp_r, "swpf/s"), + Metric("swpf_totals_insn_per_pf", + "Average number of instructions between software prefetches", + ins_r, "insn/swpf"), + Metric("swpf_totals_loads_per_pf", + "Average number of loads between software prefetches", + ld_r, "loads/swpf"), + ]), + MetricGroup("swpf_bkdwn", [ + MetricGroup("swpf_bkdwn_nta", [ + Metric("swpf_bkdwn_nta_per_swpf", + "Software prefetch NTA instructions as a percent of all prefetch instructions", + d_ratio(s_nta, all_sw), "100%"), + Metric("swpf_bkdwn_nta_rate", + "Software prefetch NTA instructions per second", + d_ratio(s_nta, interval_sec), "insn/s"), + ]), + MetricGroup("swpf_bkdwn_t0", [ + Metric("swpf_bkdwn_t0_per_swpf", + "Software prefetch T0 instructions as a percent of all prefetch instructions", + d_ratio(s_t0, all_sw), "100%"), + Metric("swpf_bkdwn_t0_rate", + "Software prefetch T0 instructions per second", + d_ratio(s_t0, interval_sec), "insn/s"), + ]), + MetricGroup("swpf_bkdwn_t1_t2", [ + Metric("swpf_bkdwn_t1_t2_per_swpf", + "Software prefetch T1 or T2 instructions as a percent of all prefetch instructions", + d_ratio(s_t1, all_sw), "100%"), + Metric("swpf_bkdwn_t1_t2_rate", + "Software prefetch T1 or T2 instructions per second", + d_ratio(s_t1, interval_sec), "insn/s"), + ]), + MetricGroup("swpf_bkdwn_w", [ + Metric("swpf_bkdwn_w_per_swpf", + "Software prefetch W instructions as a percent of all prefetch instructions", + d_ratio(s_w, all_sw), "100%"), + Metric("swpf_bkdwn_w_rate", + "Software prefetch W instructions per second", + d_ratio(s_w, interval_sec), "insn/s"), + ]), + ]), + ], description="Sofware prefetch instruction breakdown") + + all_metrics = MetricGroup("", [ Idle(), Rapl(), Smi(), Tsx(), IntelBr(), + IntelSwpf(), ]) if args.metricgroups: -- 2.44.0.278.ge034bb2e1d-goog