Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp417466lqo; Thu, 16 May 2024 09:45:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUDvW6VAs/Rn+nGGUMukyx46CEfyaZ4Whqri8S+FcNhpJ6SucM7eOOLEOV6gnnKPEjFm5rGFGJ0xrmkjwB27hpxj6jP7lPyoriXsv+PtA== X-Google-Smtp-Source: AGHT+IEpgWsjjXVTzcMyck79qZyoLLD8XSNY+ZISefivEkMuHMgCft54nE6cBtHS84TGlKEORDkw X-Received: by 2002:a17:902:d4cc:b0:1dd:6ce3:7442 with SMTP id d9443c01a7336-1ef43e34292mr220345965ad.39.1715877930297; Thu, 16 May 2024 09:45:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715877930; cv=pass; d=google.com; s=arc-20160816; b=Bs6/8/1r5HA29862MWFXOjm1buK2SNdHoUUkuvIaS6t9QAYSAfi3W0pmysAVem/mQJ LWUwTkbiWhw1Ot3+BCMDFDot5g0EQzHPmH5gYuKlpj8Xugv9VpIXogSaptUDtE7SyTZA k0qNgB8NO5KclY4eA4CEID4kshfsGs/pCb76+9c9FP66nYXarY/BOFiwNOUe6YjW/nav /Ad3l5TirSGGkkW9RI/fZfE9JLDegv9syJjpRpLJaZPF6LE3NDEzQXkXjr+0JOknZTsJ +ZvneUvRa7W6VNyPtDMxT6YzTxC01uVGpFBCsecCad7f49czFRxZz1/VDH4MwN08yVd6 2VBA== 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=RdYJOsDWTmNqWlkMdmJgsT3jwYhNIzkdpl7HU6s1mPM=; fh=vSQXT4E7rdjIlmU+wwJfB0E6/fDEX8aj+HYKRdrxgNk=; b=zqtPXN0U+k+lEugdTH3iC6MDnnJOGDeIxb9J3d/gy+07RLgrd5MKSTFjV07fMoae3Y Gs3h5AbgdxejDh1WiSafE92UIYJgus5acnoXXpodWHAq8NRKqIIX6mNQAZKCVeCduD4+ IOtt7E3YydBV0eq6669xvfrRXm8TQ5uZDHXYlsrO/ZQBVaMDtmlpwaDlc4bm6lYCkteS OxYpYMo7GnvtmCqh+X8xxSqlvR0JLdtbkCjMAp4TPSZmqBs86aRgN1kL3R9Gneil8EhQ TK4H8lFupaStTk+3tqVV5KyiBsgd4WnSd7ih69SRysziDNY3855PZ4UT/3E6FO7+grqL /TpA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Kz+G+R1q; 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-181335-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181335-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0b9cf370si18957285ad.106.2024.05.16.09.45.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 09:45:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-181335-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Kz+G+R1q; 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-181335-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181335-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 42362283566 for ; Thu, 16 May 2024 16:45:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2B9098821; Thu, 16 May 2024 16:45:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Kz+G+R1q" Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 CFD206FD5 for ; Thu, 16 May 2024 16:45:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715877902; cv=none; b=Q7kXXQNqAxlLHxcQ4LB7/IUPpM/QLH5SUyi2N1EEq3zocQKsAeOykXe03qkm7WnPJJCQkVKxwD/9C2kdpanZAfYhp5+gLNCAiwqvttnlIVrPuGgm5Cwm0SWqPph9V2mVex1dM3y5fWu9RxsDENOYvlpR4dOoAF+epW2c1W9I63c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715877902; c=relaxed/simple; bh=VPlsruD35JAQqV3gEarB9dVDjoQdF9uedLGs17A74Is=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=C2Se+tRNsxeGIHpd+zyxM01ROgED58jc/Z8UK0OcjYpVqRzoVykHFR5YF+M2EX+Kq6NWF1HThPN18pbK3+wtXUgIngEhC/apaQto0+Nxx5wYSVG3H0v6bkQIFrUbnaETmq4SzaecXXPbTRi8dleEkrcomh3JuLVh1GcgIh134iI= 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=Kz+G+R1q; arc=none smtp.client-ip=209.85.214.176 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-f176.google.com with SMTP id d9443c01a7336-1ee0ccf9c2fso3425ad.0 for ; Thu, 16 May 2024 09:45:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715877900; x=1716482700; 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=RdYJOsDWTmNqWlkMdmJgsT3jwYhNIzkdpl7HU6s1mPM=; b=Kz+G+R1qLk3OLN6bHUcpI4zJv1tFB3tEbn8aPL+XDjyuRoPG1KIaVRuit5M1fMrenO Q8V1z8hdpOWSusdBAQzEuBvHZDgXezvbuIvroWFsuQy1I2Y7P/9i3JAFvQN8kDDzyilf PiFe5nj08ieK0xXps3j5z8OHoz5XPh3HmBYhUMKKAeEdbUmrrY9Rm4/328wX9uv3RH6X xXvBhK9Ljd9D/CxBAIkoUfoRGazbbExkjU7lJAqO8dqPcZrDOuYkxZUQIS2gW+tjpegD Y1Hs0hMcHM1GVH0E1Z52GgZm/ajOgC8bSZuNew7mfMPc8nYoLETltWZoZ5z9rGyLlNN8 gxpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715877900; x=1716482700; 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=RdYJOsDWTmNqWlkMdmJgsT3jwYhNIzkdpl7HU6s1mPM=; b=e3fGx+H9C8wxsfpvZdusfAGyZKdXjYh2axQR6N+DnzJ+EqSc+GHye4NaHpO7qNfZ4G 2WRnqgXnzY3/fPUdLHSVxZNxvUUHLsdgbrOIBz2lrkm5lIOP+qHNq+PgDHPPjFQrKEWF h1G+czd6WhUU6TSCc1UD/AUl70Geyvai/A8zhgTZ1ASuLzlAL/PbBLCxNrSWkW5RbGnL 1CBJekMFUps3LqzexQh5g6GGvnNeKSCo4BJ/cu+rod23w/TqnLq9E2AJnSD/2oV2/mdX iEgX42g6DGCcz6eXBzlUoqLitimwintfzB6f6exakUm5yBckHzfBGXUywK2YIre/oXrF wfkQ== X-Forwarded-Encrypted: i=1; AJvYcCXqtqivF5/uYtgnqCp7Ym1hr+w+8vRbUTii+MKDJN83NhyiBIDC7eYHioMe0NqYpp050mfqRt3TnmOT0GAg2fY1qUP2Ot/rOLZkOSed X-Gm-Message-State: AOJu0YyAU0d+9yRhvQx/FPibXmlLBASjohCzUVQi782WnkIT7W+ukLrX 7KMi+hUJTcDiWXyTLZ4aW5A3VtXiEqbn1WPlA9FifzhZ+xt5YkB/Bujka4PUTd3BV2GmJ0k9+Mx tPowGIztJiXCDAP0wNC9+F/u1/Ae15WgbCeOT X-Received: by 2002:a17:902:ec86:b0:1e5:5cce:7eca with SMTP id d9443c01a7336-1f05f660814mr12642895ad.8.1715877899735; Thu, 16 May 2024 09:44:59 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240515054443.2824147-1-weilin.wang@intel.com> <20240515054443.2824147-5-weilin.wang@intel.com> In-Reply-To: <20240515054443.2824147-5-weilin.wang@intel.com> From: Ian Rogers Date: Thu, 16 May 2024 09:44:45 -0700 Message-ID: Subject: Re: [RFC PATCH v8 4/7] perf stat: Add retire latency values into the expr_parse_ctx to prepare for final metric calculation To: weilin.wang@intel.com Cc: Namhyung Kim , Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Kan Liang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Perry Taylor , Samantha Alt , Caleb Biggers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, May 14, 2024 at 10:44=E2=80=AFPM wrote: > > From: Weilin Wang > > Retire latency values of events are used in metric formulas. This update = adds > code to process data from perf record for required retire latency values. > > Signed-off-by: Weilin Wang > Reviewed-by: Ian Rogers In the evsel approach: https://lore.kernel.org/lkml/20240428053616.1125891-1-irogers@google.com/ we don't need to special case tpebs events like this. I'd prefer we went that route. My reviewed-by no longer stands. Thanks, Ian > --- > tools/perf/util/stat-shadow.c | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) > > diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.= c > index 3466aa952442..b97d23bfeac1 100644 > --- a/tools/perf/util/stat-shadow.c > +++ b/tools/perf/util/stat-shadow.c > @@ -15,6 +15,7 @@ > #include > #include "iostat.h" > #include "util/hashmap.h" > +#include "util/intel-tpebs.h" > > struct stats walltime_nsecs_stats; > struct rusage_stats ru_stats; > @@ -355,6 +356,20 @@ static void print_nsecs(struct perf_stat_config *con= fig, > print_metric(config, ctxp, NULL, NULL, "CPUs utilized", 0= ); > } > > +static int prepare_retire_lat(struct expr_parse_ctx *pctx, > + struct list_head *retire_lats) > +{ > + int ret =3D 0; > + struct tpebs_retire_lat *t; > + > + list_for_each_entry(t, retire_lats, nd) { > + ret =3D expr__add_id_val(pctx, strdup(t->tpebs_name), t->= val); > + if (ret < 0) > + return ret; > + } > + return ret; > +} > + > static int prepare_metric(const struct metric_expr *mexp, > const struct evsel *evsel, > struct expr_parse_ctx *pctx, > @@ -369,6 +384,9 @@ static int prepare_metric(const struct metric_expr *m= exp, > double val; > int source_count =3D 0; > > + if (metric_events[i]->retire_lat) > + continue; > + > if (evsel__is_tool(metric_events[i])) { > struct stats *stats; > double scale; > @@ -486,6 +504,11 @@ static void generic_metric(struct perf_stat_config *= config, > pctx->sctx.user_requested_cpu_list =3D strdup(config->use= r_requested_cpu_list); > pctx->sctx.runtime =3D runtime; > pctx->sctx.system_wide =3D config->system_wide; > + i =3D prepare_retire_lat(pctx, &config->tpebs_results); > + if (i < 0) { > + expr__ctx_free(pctx); > + return; > + } > i =3D prepare_metric(mexp, evsel, pctx, aggr_idx); > if (i < 0) { > expr__ctx_free(pctx); > -- > 2.43.0 >