Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp413644lqb; Tue, 4 Jun 2024 15:42:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWksHCShaFMMciT7xnsqzuleaeWk6cADX6DKAOYEeZI/YcNbyM4GfJo+nhV0hnkU71S2NcEhoPiWnohtNvhEcP6TU32wLu3xdlJuLUJYQ== X-Google-Smtp-Source: AGHT+IHaTjlh0b7BS6+CyBrjTZIZfgS5raSizJPpZ9qHTqKpivsLA5p//ebdZlOIRLBrgOuAXI9x X-Received: by 2002:a05:620a:846:b0:795:1e16:b22f with SMTP id af79cd13be357-79523d4db43mr86247985a.33.1717540932538; Tue, 04 Jun 2024 15:42:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717540932; cv=pass; d=google.com; s=arc-20160816; b=uJVqUQd7ppBJgNhLBkLT1KUIu5IhyjTL5uSr0rqEX990qsALwgBkBAgbzWenfEV3/G CtELjqlQQnAWcpvKvu1o0LW5jWh6Co5VU+DSZWIAaBGbqtuqGkmA+iksz53Zc3xfR1oy fzeRg4qKHqUXz9uE7bFbxeOnPZ2esb3XD9fwoO29vIGnos+PgCS2LpChm1tUUQgGQXj5 dbu2EmfHezPBjhTVpnZLQYVqGSbZWAE5X1NeuJ4oB/HXdFmUO2G79AdMSe/PZALE4eUZ E4BmiigSd+HvbGCiAGw5TO02uZaIVZuFXjkMQ6ce+McU/OqU6qgAnvKlTts2c8BSxAiH 7Hkw== 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=kxpHTd5BZykqrVKTAmTFLY0ccrzh8pYj5w+W6cIXXW4=; fh=NJrLjex8SRWwNkEPSy940pG01XoD8YAf1/gk/P+ZEtE=; b=Z4k2hNtKnWdrzcb4dlp8NVle+x6y8zNsRZIC2ADSIqthR8rtzTqRyaJDMH49hs6d4P 4ZutIwKlKlFxyK47jgAlXMpJ1bUv8mMZzQYSZ2x0IAh3t71ZWTMnJVHKIofIqClkFytE ohXK3eaBxKA6yGrmLBeh0XB5Tk4tJFfic+UoT8C8JcqWC83y2peBAZxAPluhpK49aq7E CsNckVbkX8F0hArFylrzeF7ingGoL7JtGKVK1xjoXw9uEVyqTA91lRmvqAoHedu5eZXe k9T1F43aCx56RAWRo+32ILIeUfHUTb2Ir59HC2vuRWhnjTV2J7oUJ+lVnqLvtsuxPapM KJqA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="YKVUfW5/"; 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-201501-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201501-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 d75a77b69052e-44025be538asi20568001cf.428.2024.06.04.15.42.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 15:42:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201501-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="YKVUfW5/"; 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-201501-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201501-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 4783D1C21C32 for ; Tue, 4 Jun 2024 22:42:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6713A14C585; Tue, 4 Jun 2024 22:42:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="YKVUfW5/" Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 309171384B3 for ; Tue, 4 Jun 2024 22:42:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717540924; cv=none; b=JCeRBMBJUwtdfD/kCcHAbXqkB/zoGf5gPeYv+afaH2yLwLfxmT8J3fK+xOEfwmZqqN4ybR/MRe9/Mz+E4hzjcNxjPWIQwKsVvNvj9q0VbgTEoKCtAStfGu4GyQhKGlGWQ9wZ2PPM/IcEPE7w6B1+IwJMekPn7v9FVGXgH/ee0Ps= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717540924; c=relaxed/simple; bh=RVJ4j4cMnToo44h4/Z5RpEHyocI7BKeltHV6TedRuMM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=WwE8lvl0nx4iR3uL+MnX5Gc7EMBDvopn3qacS3JrBUwaMllAvXA/e0oxqD3Ays1rjKy5LJALiC1/ouE9odUJdvxtRJGtSG1zI7B3WPdbF0SX45x5Q/SGYxUaLOgWMj0hvsW11t+AvLm7nZhtFEak1Yf7G00BdP8IuP9//fXrmlg= 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=YKVUfW5/; arc=none smtp.client-ip=209.85.214.170 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-f170.google.com with SMTP id d9443c01a7336-1f66ad03847so35775ad.1 for ; Tue, 04 Jun 2024 15:42:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717540922; x=1718145722; 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=kxpHTd5BZykqrVKTAmTFLY0ccrzh8pYj5w+W6cIXXW4=; b=YKVUfW5/0oiRZTH6NICPCFNahbZoopPB/m75XTy/cVc9eQFFa6KIGbbf2n+dwB4Rt5 pPZ9899gjhv32Nfwj1z9xP5AxcOH+gr3sbkzNKfnm41mQNyDEHC6MBhbUmlXUfsFJYH6 0MykcoY9zGQ4mcjQCv/wlmw25VUx5/Le/NVfMSX5Nk+pU8aQ1GVEx7p23XK+P6kOXLA6 Am/v8C4cd+U1+IoQ8aipdZN1Nvt61jnu39ObdgEgiDQSAQauBOYJ+pdDMh8P+/DZXi0J YJ3FW/DV3b3ZBVxcRbNPzzgdAzx5zxdAlg1SHiIhLsGv12fEnjgyPSUmQwPcdU8QOdkR aNCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717540922; x=1718145722; 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=kxpHTd5BZykqrVKTAmTFLY0ccrzh8pYj5w+W6cIXXW4=; b=b/MHTyTPNTJlSbX67OwgnDxopvuRv7tFHQVflInEZXLcGQovmB7O1lLVj6VuEllVlx gnKE2tlf3ls0uWHUWdYlTszRc8ZG/crQwUPnBWWb1sDjJeEtqv+0AoUX5qFQU4xvUpyj pMA/JLy2Qsz7y+1nMt0rE0NCW2/XMJdQ9P+gr6sfqjeGjzmL5BfSihrE2FgOSIBGb8Sz JjLYrBuJcT/UJCI7V8teuQnvT1pseMQZFgi9VL4VawU8ReTH9pVbStF0Oab7iYPuPcLp E29y3ayTVBTdwxdAuzcqdFQj4dj8UkT5kwyEeod7FNxWAzPo2kGK9zIklFJ6K7WneL/t cZ2w== X-Forwarded-Encrypted: i=1; AJvYcCUZOan7M0w44o4lDRNUwCBu9VfxhntPrWMnMM3EfXMb+vj4+S4byhdMKT/BmRRTk/mzv0Ik7emFDI6zzbihEYT5d+AELAdyLgw1RVZZ X-Gm-Message-State: AOJu0YxDy+7VNFFACCXdMdn8SDwWkCRmhVKjASVPyncOgcjCgx6I9yGa lYGMNDdD29BTYQnlyPnpOSg/XCRJXf8BvKllF44dTWe+sap4MhqBgiDVCTNUBwIzrDnETj05ADJ GQvBnBq8g3wkletACIrliFYEeEPHTwz1eXHLu X-Received: by 2002:a17:903:8c8:b0:1f6:92be:2c9c with SMTP id d9443c01a7336-1f6a64bdc8fmr1186625ad.6.1717540922141; Tue, 04 Jun 2024 15:42:02 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240529064327.4080674-1-weilin.wang@intel.com> <20240529064327.4080674-4-weilin.wang@intel.com> In-Reply-To: From: Ian Rogers Date: Tue, 4 Jun 2024 15:41:50 -0700 Message-ID: Subject: Re: [RFC PATCH v10 3/8] perf stat: Fork and launch perf record when perf stat needs to get retire latency value for a metric. To: Namhyung Kim Cc: "Wang, Weilin" , Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Alexander Shishkin , Jiri Olsa , "Hunter, Adrian" , Kan Liang , "linux-perf-users@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Taylor, Perry" , "Alt, Samantha" , "Biggers, Caleb" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jun 4, 2024 at 3:32=E2=80=AFPM Namhyung Kim w= rote: > > On Tue, Jun 04, 2024 at 08:00:26PM +0000, Wang, Weilin wrote: > > > > On Thu, May 30, 2024 at 11:46=E2=80=AFPM Wang, Weilin > > > > > > + /* > > > > > > + * Only set retire_latency value to the first CPU and t= hread. > > > > > > + */ > > > > > > + if (cpu_map_idx =3D=3D 0 && thread =3D=3D 0) { > > > > > > + /* Lost precision when casting from double to __u64. An= y > > > > > improvement? */ > > > > > > > > > > As I said before I think you can set t->val * 1000 and then > > > > > set the evsel->scale to 1e3 or 1e-3. > > > > > > > > Hi Namhyung, > > > > > > > > Sorry if this is a repeated message. I thought I replied to your su= ggestion > > > > on this last time. I'm thinking we should keep it like this for now= and make > > > > this change unless we find the precision loss is critical. Because = I thought > > > > we don't want to add special code to handle the calculation and fin= al print > > > > to keep code simple. > > > > > > > > I kept this comment here so that we don't forget about it. Please l= et me > > > > know if you'd like me to remove it. > > > > > > Please see print_counter_aggrdata(). It's the generic code to print > > > the event value and it'll display the value multiplied by the scale > > > (default to 1.0). So you can keep precision as long as you set the > > > scale properly (1e-3). > > > > I could see the retire_latency is printed correctly after set the evsel= ->scale to 1e-3 > > and multiply the t->val * 1000. However, this scale is not used in metr= ic calculations. > > We need to add code in metric calculation or display part to scale it a= s well. Is that > > acceptable or do you have other suggestions? > > Hmm.. I don't know if other metric already dealt with the scale like with > RAPL events.. If not, I think it's reasonable to add that to the metric > calculation. > > Ian, what do you think? Tbh, I don't understand the conversation and it looks like we're in the weeds. In metrics the scale/unit from the event aren't used - that is all events in a metric are the unscaled quantities unless something is broken. Thanks, Ian > Thanks, > Namhyung >