Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp2115332lqe; Tue, 9 Apr 2024 09:54:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWSwsRph3/GVT9ob3FEuawcv+SxaQePJ/HjJCSpYHR/bBUSxqqSdFsAuxc3DcvdJQwlP7rAP0XbXmxu8uzd4QUTVNgeK0kRGS8UMnABZQ== X-Google-Smtp-Source: AGHT+IFpPAKpyHBSSehHEwFEOJjCMO9HWPUtOBVdbKNCpOMPgsA0m2ax0u3Az0tTpsJi6ihWdtwh X-Received: by 2002:a50:9f63:0:b0:56c:195d:b162 with SMTP id b90-20020a509f63000000b0056c195db162mr216868edf.6.1712681656546; Tue, 09 Apr 2024 09:54:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712681656; cv=pass; d=google.com; s=arc-20160816; b=mCDGh+YyY1xQtoxRo8YhES2R4vsFCbaTsl6E5huQ2X5WWnrYtqx9EUMjXxRrri2FIS KtwWea6gh4tlldu+qnIHhik4ywz+z7rzDJx3t0ccXenS6fcq/S2YQe8kHrFLxN3VIV6G 35nCgt4lqRWnJjUkFaFBu2sAC+D8C4+z/0eQJDKbSeyJpRE5NDuPAFq+yvgOwnA0iiDs 8TKegYg7nZhQwD0lnORg9fbJ0vIoy2Wv/aIREoh6L7tx3KReMQjAhw/s4868QQpuzt56 RtPIf88NW3POJoFXmyERNtq81EG8bp/QnxgJl7QaqyTwsAAhBA3R+xLUZl643BI3YahW 5RDQ== 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; bh=FHwKssPvQn08dZsaVs6XjTXIcqJ81SMFbyYxihTZRJg=; fh=YamDJ1e45GEEQdkYNt/Vk2V73LJ4F9fePhvWYJE6Ia8=; b=NRenaZ0y/uqYkVJG0mITCBOqYnRgg+5SEk3hxb0Quh9lLV+ox27qqQC+AVBNTwLY8/ RWqLJ1zdK/KhNBl45WFTRXloHAXKxTbCJa7bIHA927gRsXjIZ5Q04Tzl4F7yuX/v8Og4 gMaObGj20md4Tp0TWbUPFbv4jnK8bEju9VLuX3lZ2j77rkBjJFh/iXXO2nOUT0hHtdt8 MAjbQeWvUB2zdX6kUnCem7zajnVNZRg+WYE0fIx6mrorBL2s1VrXVxHwnV3mOPHdP97i Vq7DaZ/b2mDfW2KY545GhfuGLHQ8oi0Wt01zcrhzlL5h/jZVy0uh1osvNqO4n1u1ZZ9/ /PJg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-137343-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137343-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 5-20020a508745000000b0056df5574b6dsi4721754edv.541.2024.04.09.09.54.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 09:54:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137343-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-137343-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137343-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 1E4261F210C1 for ; Tue, 9 Apr 2024 16:54:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F02AF153809; Tue, 9 Apr 2024 16:53:55 +0000 (UTC) Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (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 EED4815380B; Tue, 9 Apr 2024 16:53:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712681635; cv=none; b=fw+c7V4cjT1zjT6yoPan+fKtjjdNtHJw7AVIeGhzPsQHix4KDGh/wMbf/jj/qIg2yNGzousWrQkx1h4zQkQslTlE0EOuhGhu8cQxVCEcz3CsMwZmc6qh7pBlsui0dL2mms30WnZU9e9wRo/AOOGsGrOmlOawt+qZ1l71F+eTq08= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712681635; c=relaxed/simple; bh=yw6TX9lO9P2YshT6dcCarnc+AJgRrHPkoasFjOF6+2k=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=TeRZX1bTFQpyVBOEoHQMamJDhU23bL20loUeB/vBiELJUM/rYbdUrRo5kQ07MgIKq9goCiC4EffEycm/9bjtzRB48RGhHiUh7VgQfn2iQS+/C9Y+7vN3McWi+RpGJACfV7dpAk+84hC7TkJADC1eg9i1s1Y/znWYF+TehcXPWM8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1e3ff14f249so18056765ad.1; Tue, 09 Apr 2024 09:53:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712681633; x=1713286433; 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=FHwKssPvQn08dZsaVs6XjTXIcqJ81SMFbyYxihTZRJg=; b=oRyC9Aaukr6wCa+jb7H9kyP2nPiATWu+SyYtFUUtrBuUfLhCVDHAEhOfGsAcmBRR5I Wcp2vBWhEvpDZRY9XIEziCwwxX61MVUszp5c/VKjiTTjkRa1KCeHEfzwVGJIz9E72kwt RRTwjxcWBFQOQ+/O3KU0kU7VKK5IjKF9yzos1nZQ0q/rNzYxfEihI4sY6tGG8TDxdgl7 IxttjA+8Gg2HT7bpKAuD9HiyZ4BBR/oOR7aY33V7Ufeok2jL48FQhfgNASRipF08ugJL njwwYG/DQ8+FARNViqEMVmocpkqD9WG40oB3NhcC6WexVEWhN4tGnwlDuB96JzgDPHHJ ihog== X-Forwarded-Encrypted: i=1; AJvYcCVrp8K+WKuGtPk9oYZqJOTKe/LkChA9F4YZfpyhSrT1cF5gpttPxlw+QWDOBm9hkEn+W/qT6yrPCUkrIL6yx0cjez8n7RBf0iMeUzPIZ5gtAOowLZUjm40M1AWMRtiWseAPEdIb8V97jOB1LUPElQ== X-Gm-Message-State: AOJu0Yx+J1/gFZodzazZNG3xx+eTGoIbuUnIAriqzk5aL9GU0SF4sonW NA6syy94CYvIGNq3fg1Cbtp5Zv9v88PX0/MBSEGp191KyMOQl2odgbr4yeVxIkJh8WA9NE1sltC Am6ugXtpBGVclHlHItBt5OezM81A= X-Received: by 2002:a17:902:d14d:b0:1e3:d242:418a with SMTP id t13-20020a170902d14d00b001e3d242418amr257214plt.9.1712681633110; Tue, 09 Apr 2024 09:53:53 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240409000659.1727785-1-namhyung@kernel.org> <20240409000659.1727785-3-namhyung@kernel.org> <0ec1328a-0731-42a6-b953-163ac5a56deb@linux.intel.com> In-Reply-To: <0ec1328a-0731-42a6-b953-163ac5a56deb@linux.intel.com> From: Namhyung Kim Date: Tue, 9 Apr 2024 09:53:41 -0700 Message-ID: Subject: Re: [PATCH 3/3] perf report: Add weight[123] output fields To: "Liang, Kan" Cc: Arnaldo Carvalho de Melo , Ian Rogers , Jiri Olsa , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org, Stephane Eranian , Andi Kleen , Athira Rajeev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Kan, On Tue, Apr 9, 2024 at 9:37=E2=80=AFAM Liang, Kan wrote: > > > > On 2024-04-08 8:06 p.m., Namhyung Kim wrote: > > Add weight1, weight2 and weight3 fields to -F/--fields and their aliase= s > > like 'ins_lat', 'p_stage_cyc' and 'retire_lat'. Note that they are in > > the sort keys too but the difference is that output fields will sum up > > the weight values and display the average. > > > > In the sort key, users can see the distribution of weight value and I > > think it's confusing we have local vs. global weight for the same weigh= t. > > > > For example, I experiment with mem-loads events to get the weights. On > > my laptop, it seems only weight1 field is supported. > > > > $ perf mem record -- perf test -w noploop > > > > Let's look at the noploop function only. It has 7 samples. > > > > $ perf script -F event,ip,sym,weight | grep noploop > > # event weight ip sym > > cpu/mem-loads,ldlat=3D30/P: 43 55b3c122bffc noploop > > cpu/mem-loads,ldlat=3D30/P: 48 55b3c122bffc noploop > > cpu/mem-loads,ldlat=3D30/P: 38 55b3c122bffc noploop = <--- same weight > > cpu/mem-loads,ldlat=3D30/P: 38 55b3c122bffc noploop = <--- same weight > > cpu/mem-loads,ldlat=3D30/P: 59 55b3c122bffc noploop > > cpu/mem-loads,ldlat=3D30/P: 33 55b3c122bffc noploop > > cpu/mem-loads,ldlat=3D30/P: 38 55b3c122bffc noploop = <--- same weight > > > > When you use the 'weight' sort key, it'd show entries with a separate > > weight value separately. Also note that the first entry has 3 samples > > with weight value 38, so they are displayed together and the weight > > value is the sum of 3 samples (114 =3D 38 * 3). > > > > $ perf report -n -s +weight | grep -e Weight -e noploop > > # Overhead Samples Command Shared Object Symbol Weight > > 0.53% 3 perf perf [.] noploop 114 > > 0.18% 1 perf perf [.] noploop 59 > > 0.18% 1 perf perf [.] noploop 48 > > 0.18% 1 perf perf [.] noploop 43 > > 0.18% 1 perf perf [.] noploop 33 > > > > If you use 'local_weight' sort key, you can see the actualy weight. > > > > $ perf report -n -s +local_weight | grep -e Weight -e noploop > > # Overhead Samples Command Shared Object Symbol Local W= eight > > 0.53% 3 perf perf [.] noploop 38 > > 0.18% 1 perf perf [.] noploop 59 > > 0.18% 1 perf perf [.] noploop 48 > > 0.18% 1 perf perf [.] noploop 43 > > 0.18% 1 perf perf [.] noploop 33 > > > > But when you use the -F/--field option instead, you can see the average > > weight for the while noploop funciton (as it won't group samples by > > %s/funciton/function/ > > > weight value and use the default 'comm,dso,sym' sort keys). > > > > $ perf report -n -F +weight | grep -e Weight -e noploop > > # Overhead Samples Weight1 Command Shared Object Symbol > > 1.23% 7 42.4 perf perf [.] noploop > > I think the current +weight shows the sum of weight1 of all samples, > (global weight). With this patch, it becomes an average (local_weight). > The definition change may break the existing user script. > > Ideally, I think we should keep the meaning of the weight and > local_weight as is. Hmm.. then we may add 'avg_weight' or something. But note that there's a subtle difference in the usage. If you use 'weight' as a sort key (-s weight) it'd keep the existing behavior that shows the sum (global_weight). It'd show average only if you use it as an output field (-F weight). The issue of the sort key is that it cannot have the total sum of weights for a function. It'll have separate entries for each weight for each function like in the above example. Thanks, Namhyung