Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3265059rwi; Sun, 16 Oct 2022 07:59:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4iUvOitshgwJJD6vQLKO35s6ZF2QFQlraeiGfgBAUT6DLqyCO5WV3qPKzeusak+DbC1gM8 X-Received: by 2002:a17:906:5dcc:b0:78d:e76a:ef23 with SMTP id p12-20020a1709065dcc00b0078de76aef23mr5235849ejv.317.1665932356162; Sun, 16 Oct 2022 07:59:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665932356; cv=none; d=google.com; s=arc-20160816; b=rn99vtwVUr/LxJlaGAcKtSh0/6O1X5LoeZXt+Y0l5qS7naHV3ZDtSCFJzQAVKZl4fB nxndDJesA/HIsiKBVkZjHtgT1PG28DcIDFXQ5Ps3B6oQPF1MNrf7aYCgDEUH3WaihoI1 GwO9ArYHgxZ3pC6hg+gGm8pxQqH9zvYizHvHo8Mh3730DTpgnXmXLn8BdXIeXds9aSEZ NhepgVgEXbGPdycYWcWJD/3qJePreB4Z2/rfP4WK/4a44RQfD10bJhGramphDdp4HNqI R7rnUKaHF0QpS6MGdsEzf6l5JVZgqSgBTZamf16vWAIX3leqqmw6hT3Lf1SLvPzRgOzU piNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=2hRzO31+Md1Q3g7FmcbREZ1Eseo7Rtjis60g3mWxP6c=; b=m4cwRoY91CqW98QE9IYOh2p7r7xG6VjDbvdQj7Yoa+Infffhe2SjQPVJqzwYsAGUfa V6sMKwoyF1WJydhp26YuYf4EICUTPwcmS8DhZQVYSnDpDnigdWzB8MvlCxsKzKgBmtJ9 lVUY3iyMQtkCr+0EaFrK/G2ZW9edYF69pqCb3jOBozq/S4O++GK5j2rkJjoUzvcVYjkH XTf7mCv+wEpl9NYkICxVGe6H5PwWU6xoT3ajnpdD9Iu3Mj1onp+d/51HleiuQ3O7UhEh JPvLfUDeieI59wKzepbm2CSM8YCvEZRUhkLQ6325AlnSfDG60/fuRRc5RPSp2X3uOpta Uirg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=k83KezfD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o19-20020a170906975300b0078dea4159fdsi6589127ejy.491.2022.10.16.07.58.50; Sun, 16 Oct 2022 07:59:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=k83KezfD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229730AbiJPNdX (ORCPT + 99 others); Sun, 16 Oct 2022 09:33:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229600AbiJPNdT (ORCPT ); Sun, 16 Oct 2022 09:33:19 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7F631F60B; Sun, 16 Oct 2022 06:33:18 -0700 (PDT) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29G9FJQ5016722; Sun, 16 Oct 2022 13:32:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=content-type : mime-version : subject : from : in-reply-to : date : cc : content-transfer-encoding : message-id : references : to; s=pp1; bh=2hRzO31+Md1Q3g7FmcbREZ1Eseo7Rtjis60g3mWxP6c=; b=k83KezfDLSMOMqTD9iQPXD5yZRCSjav1NmJXrSbo/fy8eilwjpAIEmWjuxVh+4DTEkGP vfxdp3RZU1a7aOvUI6dGcICCTFG5SSc5cFNTWernxgSXTHUjBiu8qHXSa23DQlmOKTEH FsjjRD+dFhp71BCji9c1VMfJxcfXpIfaQAvuookYpfoxMSVlKXnFmGvNoXqyJZ4ShzmQ vhhsY5hTzSftdHDUK/TSBVB+euEg1ezZKI7v6lCLgXzYCUBo2HMMSW5ifkYW0pH8Wy6B guZvEkNkZjKczkaZoMnKujgDgO+p3QHvGJCSNMskcGPd1XeJEWt14MS3B1DJIb47bq9M Tw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3k86hjn5xp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 16 Oct 2022 13:32:54 +0000 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 29GDOPCu008953; Sun, 16 Oct 2022 13:32:54 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3k86hjn5x3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 16 Oct 2022 13:32:54 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 29GDKqwm031522; Sun, 16 Oct 2022 13:32:52 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma06ams.nl.ibm.com with ESMTP id 3k7m4jhmx8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 16 Oct 2022 13:32:52 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 29GDWorR61997522 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Oct 2022 13:32:50 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EF8334C040; Sun, 16 Oct 2022 13:32:49 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D64B64C044; Sun, 16 Oct 2022 13:32:46 +0000 (GMT) Received: from smtpclient.apple (unknown [9.43.88.181]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Sun, 16 Oct 2022 13:32:46 +0000 (GMT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: [PATCH 19/19] perf stat: Remove unused perf_counts.aggr field From: Athira Rajeev In-Reply-To: <20221014061550.463644-20-namhyung@kernel.org> Date: Sun, 16 Oct 2022 19:02:44 +0530 Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org, Kan Liang , Leo Yan , Andi Kleen , James Clark , Xing Zhengjun Content-Transfer-Encoding: quoted-printable Message-Id: References: <20221014061550.463644-1-namhyung@kernel.org> <20221014061550.463644-20-namhyung@kernel.org> To: Namhyung Kim X-Mailer: Apple Mail (2.3696.120.41.1.1) X-TM-AS-GCONF: 00 X-Proofpoint-GUID: GX3PUlIjLwMNpWD9UETmwtZtyy8BcMH6 X-Proofpoint-ORIG-GUID: 5FZPWWfwD-5cnHlSOPra7PjL2zc-F5Mf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-16_09,2022-10-14_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 mlxlogscore=999 impostorscore=0 bulkscore=0 malwarescore=0 lowpriorityscore=0 priorityscore=1501 adultscore=0 spamscore=0 clxscore=1011 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210160084 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On 14-Oct-2022, at 11:45 AM, Namhyung Kim wrote: >=20 > The aggr field in the struct perf_counts is to keep the aggregated = value > in the AGGR_GLOBAL for the old code. But it's not used anymore. >=20 > Acked-by: Ian Rogers > Signed-off-by: Namhyung Kim > --- > tools/perf/util/counts.c | 1 - > tools/perf/util/counts.h | 1 - > tools/perf/util/stat.c | 35 ++--------------------------------- > 3 files changed, 2 insertions(+), 35 deletions(-) >=20 > diff --git a/tools/perf/util/counts.c b/tools/perf/util/counts.c > index 7a447d918458..11cd85b278a6 100644 > --- a/tools/perf/util/counts.c > +++ b/tools/perf/util/counts.c > @@ -48,7 +48,6 @@ void perf_counts__reset(struct perf_counts *counts) > { > xyarray__reset(counts->loaded); > xyarray__reset(counts->values); > - memset(&counts->aggr, 0, sizeof(struct perf_counts_values)); > } >=20 > void evsel__reset_counts(struct evsel *evsel) > diff --git a/tools/perf/util/counts.h b/tools/perf/util/counts.h > index 5de275194f2b..42760242e0df 100644 > --- a/tools/perf/util/counts.h > +++ b/tools/perf/util/counts.h > @@ -11,7 +11,6 @@ struct evsel; >=20 > struct perf_counts { > s8 scaled; > - struct perf_counts_values aggr; > struct xyarray *values; > struct xyarray *loaded; > }; > diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c > index 14c45f4cfdd3..6ab9c58beca7 100644 > --- a/tools/perf/util/stat.c > +++ b/tools/perf/util/stat.c > @@ -308,8 +308,6 @@ static void evsel__copy_prev_raw_counts(struct = evsel *evsel) > *perf_counts(evsel->prev_raw_counts, = idx, thread); > } > } > - > - evsel->counts->aggr =3D evsel->prev_raw_counts->aggr; > } >=20 > void evlist__copy_prev_raw_counts(struct evlist *evlist) > @@ -320,26 +318,6 @@ void evlist__copy_prev_raw_counts(struct evlist = *evlist) > evsel__copy_prev_raw_counts(evsel); > } >=20 > -void evlist__save_aggr_prev_raw_counts(struct evlist *evlist) > -{ > - struct evsel *evsel; > - > - /* > - * To collect the overall statistics for interval mode, > - * we copy the counts from evsel->prev_raw_counts to > - * evsel->counts. The perf_stat_process_counter creates > - * aggr values from per cpu values, but the per cpu values > - * are 0 for AGGR_GLOBAL. So we use a trick that saves the > - * previous aggr value to the first member of perf_counts, > - * then aggr calculation in process_counter_values can work > - * correctly. > - */ > - evlist__for_each_entry(evlist, evsel) { > - *perf_counts(evsel->prev_raw_counts, 0, 0) =3D > - evsel->prev_raw_counts->aggr; > - } > -} > - > static size_t pkg_id_hash(const void *__key, void *ctx __maybe_unused) > { > uint64_t *key =3D (uint64_t *) __key; > @@ -423,7 +401,6 @@ process_counter_values(struct perf_stat_config = *config, struct evsel *evsel, > int cpu_map_idx, int thread, > struct perf_counts_values *count) > { > - struct perf_counts_values *aggr =3D &evsel->counts->aggr; > struct perf_stat_evsel *ps =3D evsel->stats; > static struct perf_counts_values zero; > bool skip =3D false; > @@ -493,12 +470,6 @@ process_counter_values(struct perf_stat_config = *config, struct evsel *evsel, > } > } >=20 > - if (config->aggr_mode =3D=3D AGGR_GLOBAL) { > - aggr->val +=3D count->val; > - aggr->ena +=3D count->ena; > - aggr->run +=3D count->run; > - } > - > return 0; > } >=20 > @@ -523,13 +494,10 @@ static int process_counter_maps(struct = perf_stat_config *config, > int perf_stat_process_counter(struct perf_stat_config *config, > struct evsel *counter) > { > - struct perf_counts_values *aggr =3D &counter->counts->aggr; > struct perf_stat_evsel *ps =3D counter->stats; > - u64 *count =3D counter->counts->aggr.values; > + u64 *count; > int ret; >=20 > - aggr->val =3D aggr->ena =3D aggr->run =3D 0; > - > if (counter->per_pkg) > evsel__zero_per_pkg(counter); >=20 > @@ -540,6 +508,7 @@ int perf_stat_process_counter(struct = perf_stat_config *config, > if (config->aggr_mode !=3D AGGR_GLOBAL) > return 0; >=20 > + count =3D ps->aggr[0].counts.values; Hi Namhyung, We are using ps->aggr[0] here always. Can you please clarify on why = first index is used here always. Thanks Athira > update_stats(&ps->res_stats, *count); >=20 > if (verbose > 0) { > --=20 > 2.38.0.413.g74048e4d9e-goog >=20