From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B05AC433FE for ; Sun, 16 Oct 2022 13:33:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229737AbiJPNdY (ORCPT ); Sun, 16 Oct 2022 09:33:24 -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 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