Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp410489lqb; Tue, 4 Jun 2024 15:33:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUbZ+Ri/PsO1R7uSKaHgF1rj56cu3ft5oQijT3/B2nYslL17jKV5iNdwN005cOhaoyEgUDY7sCt/2L0iugo1Nu0DZdp0pfmXQPcKNFwRw== X-Google-Smtp-Source: AGHT+IFH+tQMeN3KkjuWIrhoyDX9Gu/MYDx6LyLVkW4K5Yit8RYqVHAvG5YeXS2jHUKhXpHYxjKp X-Received: by 2002:a05:6808:2786:b0:3d1:fe6c:5b5f with SMTP id 5614622812f47-3d2043cfe79mr807144b6e.44.1717540416521; Tue, 04 Jun 2024 15:33:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717540416; cv=pass; d=google.com; s=arc-20160816; b=pwNns7+4fW4iY4NDG6xZQwNxTsoTMsBEKp9aN7CeuAycikIx/kwVrzG85GEIpwAdl6 eDhHILbrMY0h2axC6+kzFLW2xChjmgfDOegYOPEEh0MUUQxGtmo2PuEp820YnQRPiRPB MITFMgEDEy8U5e/C5Jsp3cKE99ynKdaU4ftTMReuVk1BFZ2ftu72xswpcFx8zIEiUIZy UJaBb1dDqp/pJGpHl0u+b93wSA/1fNYO00nwDQkDS5Cu/MjIcTdNd9VQeilZP4to9wGz eKgnTq3hXXNC+wb7qNmS9aIxOuL9ROjoFdBbaqpillGz1bqoOMYZy/wFASaIFpPLTapi vglw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=6BkaGR2GsS5C7qo2aeuQh/kt0oxoIaIuxb/DU8UMBzc=; fh=kjbLFOpgZJew1yyP6clzIePrCjUdTW/oekFrEcUrTp4=; b=ol4Ikku30vajokhXW10kA2cWCau97WJ/Nv07ikghEeR8+o2HlBPKDKUsg9Y3+1shEu PwBry30svwfTImaqG5228wBjhz0hH75/d99Z2B1wdIulxlp+RMXK8tONnBhIWJVIIPaI RwCs1cuAXQqL4r7DoFwzzuwD9cbOpPrahex5RxJcLqJz+Id0gxaTy9sc5ELqJsv8DEIn MYnHsEWtqX15OCzLGsDTWc4/Qvi+ml3zDRKxbUf9wAJHJpNYbSeJMvc62aVv8ARoUTuC fhVJgIQgyDhjSxUNYP71FxGe7ugqHP9ulTAoGJp+nTGD1J/NZrVn1MkqoHuw+ni/nzW/ r3xg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QRaLms9k; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-201486-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201486-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6ae4b401f8csi31513816d6.311.2024.06.04.15.33.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 15:33:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201486-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=@kernel.org header.s=k20201202 header.b=QRaLms9k; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-201486-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201486-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 B4E391C2264A for ; Tue, 4 Jun 2024 22:32:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EC14A14C592; Tue, 4 Jun 2024 22:32:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QRaLms9k" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B5BC28DC7; Tue, 4 Jun 2024 22:32:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717540363; cv=none; b=Xw4WMQyeyg+k8r8j99/5x22ijiT/oyu6pQ6/B/HNWkQYTMuuinZgxwQ0kJfzXszqkY56c/4IEFQ5AMohIEMCmuNGInizAOJqFOnALy3Z+joO25GS6ABj7WTdpxS1EiPDaoA3MhKUxc7fOxodwa8CON5TcZsxszvKF8I1c/4ykCU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717540363; c=relaxed/simple; bh=XawMJtdC0qHgow9/zyc4Nni1uO2svRHYtADfu3hnoWI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CFIscfxCO4MzctH/fdmjDrQyaT7wcSsH9jjZ89bizZ52SbhMUOZUPKkuVtY1SwivgmyMG8rczFK5h6J2Ix0Twdt99+n+MSyc5iuETOmSnWmH6OwN3IvOe0O5JehFARReqV340gx5uQCO7fmxRWwhDi6jECvWMYR/TA1RcLEkm4s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QRaLms9k; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30E12C2BBFC; Tue, 4 Jun 2024 22:32:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717540362; bh=XawMJtdC0qHgow9/zyc4Nni1uO2svRHYtADfu3hnoWI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QRaLms9k6A4CkEPEk2PU+qCVJ52xV1IF278xkHuy+0o9CVRnMFrM3CH/6oYEE/qGw OiLmpPGBmtuFJZPuw44WE6u7DUFvLKLYJcRAQT4zrnR3o3BDqT375VCopEGSfWKFmm lTrLXF0J3ifQ8XNEC06u8tFkLDoWcROBTeHNul0Kl95cYsGDuEMLiVpaCCJ7riJ6sn OsX8PU93nAlGXcO0JXtny9U2dCpmVZtGNiY97HgHY4YuwYMhr7gRb86eSF3rQ0x/kc 1WCYaZolZixoot8BftAN06Ff2y3BBW3w7PAXSw7e79eQ7rMYpgkngllYzHe7WKy7/L o6oRPy+UpOUkA== Date: Tue, 4 Jun 2024 15:32:40 -0700 From: Namhyung Kim To: "Wang, Weilin" , Ian Rogers Cc: 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" 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. Message-ID: References: <20240529064327.4080674-1-weilin.wang@intel.com> <20240529064327.4080674-4-weilin.wang@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue, Jun 04, 2024 at 08:00:26PM +0000, Wang, Weilin wrote: > > On Thu, May 30, 2024 at 11:46 PM Wang, Weilin > > > > > + /* > > > > > + * Only set retire_latency value to the first CPU and thread. > > > > > + */ > > > > > + if (cpu_map_idx == 0 && thread == 0) { > > > > > + /* Lost precision when casting from double to __u64. Any > > > > 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 suggestion > > > 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 final print > > > to keep code simple. > > > > > > I kept this comment here so that we don't forget about it. Please let 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 metric calculations. > We need to add code in metric calculation or display part to scale it as 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? Thanks, Namhyung