From patchwork Tue Oct 18 02:02:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 3892 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1737076wrs; Mon, 17 Oct 2022 19:12:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4KYJ3h+E2szSD7SbaE9Xz2KxtCnKYNS59ZZxYmeg8WUlhbheLy0Kr9+wLH0zKX6xuorgC7 X-Received: by 2002:a17:906:8a4b:b0:78d:d475:ff74 with SMTP id gx11-20020a1709068a4b00b0078dd475ff74mr477721ejc.131.1666059170266; Mon, 17 Oct 2022 19:12:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666059170; cv=none; d=google.com; s=arc-20160816; b=bhiTA+Bqey1lOJWXi/umKVbnssvh3hXAAwZgfZtbC1S+4CDn1wAkXYBhUkM5ArmFqq esBY1bXXuzc+MqGhnlRZqZd4i94h+y9gTrfcdInuMto733Amqjom7gbDDpk6fBo6d/7P h86DvHhOF3hdtzfCzsPj7jg3ZQyf34Zkx9VWoRNC2Gi8132t4Ld5+1uiLkXfV5gJfYTc y1iv3R5kZQB5Z7jsbsNIgQaRZb3QuoM8jUtHyb20A0vWmMRhIfymqlVWpMW3T2wiqYvl jp/ao2Amt2c7PGpfg9gAuVPYCkctFTvFjbIfWf/O+fZQZjBNS2mlNw20WHzE+v1DPTAM qp+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=1udheg5sHf0ONuxdfUoe8f9Q18ghdgubAqjN0gANnY8=; b=GCjk0QzzohFAK+iCh9DDHvlJpN/bp7M9vzrWsm0bR/4Fk6PoRyYgnDtiLgidXf67j8 gHboLhWzOvuO7BlJmef4l6ZtwZ9zpoWVLQ0oRqosiCKUnN5PUfq0fmY3ULeae9GnPKbH cKTYtmLoJUQKpwYQYbHaihR+VwjtCpmefvR+12EjbuNGpLa7LUCn85VkM2YcGrn2sc6W tV+goBX3WAxIHu9vSB2+RpT5W/RTkNx5ZRDFIG/yLtL5H6qMySIkP/3a7wYz+8iLMe9h rzD8x1Tul0bTLH/2VNS4JyemfM2joeLKK03vz6a7iCtyTv5KxUz78RyJVsMbH44UGMwh wXCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Rm62ohz+; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s5-20020a17090699c500b0078d878d8fb7si11110824ejn.920.2022.10.17.19.12.25; Mon, 17 Oct 2022 19:12:50 -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=@gmail.com header.s=20210112 header.b=Rm62ohz+; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231204AbiJRCEq (ORCPT + 99 others); Mon, 17 Oct 2022 22:04:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230517AbiJRCDy (ORCPT ); Mon, 17 Oct 2022 22:03:54 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA4468E797; Mon, 17 Oct 2022 19:03:08 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id l1so12436037pld.13; Mon, 17 Oct 2022 19:03:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=1udheg5sHf0ONuxdfUoe8f9Q18ghdgubAqjN0gANnY8=; b=Rm62ohz+DFBI6eZQNjQVIT9ILFhku/7CucD+oEe1lTPx2nneIj61QVcgLbQVNJS8wr SEAQOVT8IZtMNyzvXNmWihYWZ0qt27WRRfZLVI/W4LYnuQVN6E4pMpV6FJpId5XnQ5Jd EQj1A8vk8Rl6FwzGC4TsGaWpeHnmll90JApdakBxscK8vmwvGhXyDC54lfYV7X00+ob7 A/n1gZs7KO4oZJcyLC5fYzEJ9ZxfU1XMkFId6dm4pNFqg4dK3SgOB07ZNop+y7K6K9tF Wmu+EEffujOLcEZyjNB4kyXeFMEMN5AHUrfaoRE8lMrz77njT/2pDwm46SnddKCyDqSI pBzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=1udheg5sHf0ONuxdfUoe8f9Q18ghdgubAqjN0gANnY8=; b=mxW1JyQxjJuWDBU0q9ewvC+t9hbo1zWc6Hfu4RU6lBoYIFFb1SH4Rax/BIdID1JqCS vL0yX+cIhcuOAVcGCBa0+MYZzjdv9yPp1iTTCkXnyWxUPHtTvocghpLAw8ntwumyudLp zRlUujT5eNlsFxK4cvCN9nSMt2nKXXAfvVO+FJA+0KcarmoqtmReHBAfNZ6kIuITeJwI URbq5SVhr7/rXPZ9ZQuTIPLueF2yHjlcH0qyZ5q/oDaULzmyaWL4RqZng+7ljZR2nhNn aJKpclP1jEMGG0JUW3XvNJgZo08nnetu+jC+KH2eP4yuwWDYvXEbzTUMa2NgZYEEuKbM buBg== X-Gm-Message-State: ACrzQf32l5ZVYaRpLUpejTs3pycydpfZ+uWhSbSncO94Ff+8xYBkJMhT NX3k7ivpHQ2HTmTH7mWoVlU= X-Received: by 2002:a17:903:11cd:b0:170:cde8:18b7 with SMTP id q13-20020a17090311cd00b00170cde818b7mr651563plh.165.1666058587516; Mon, 17 Oct 2022 19:03:07 -0700 (PDT) Received: from balhae.hsd1.ca.comcast.net ([2601:647:6780:1f90:85c4:58f0:7a81:6bb5]) by smtp.gmail.com with ESMTPSA id t4-20020a655544000000b00464858cf6b0sm6851564pgr.54.2022.10.17.19.03.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 19:03:06 -0700 (PDT) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org, Kan Liang , Leo Yan , Andi Kleen , Athira Rajeev , James Clark , Xing Zhengjun , Michael Petlan Subject: [PATCH 20/20] perf stat: Remove unused perf_counts.aggr field Date: Mon, 17 Oct 2022 19:02:27 -0700 Message-Id: <20221018020227.85905-21-namhyung@kernel.org> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog In-Reply-To: <20221018020227.85905-1-namhyung@kernel.org> References: <20221018020227.85905-1-namhyung@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS autolearn=no 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746989660152762152?= X-GMAIL-MSGID: =?utf-8?q?1746989660152762152?= 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. 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 | 39 ++++++--------------------------------- 3 files changed, 6 insertions(+), 35 deletions(-) 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)); } 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; 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 0316557adce9..3a432a949d46 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 = evsel->prev_raw_counts->aggr; } 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); } -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) = - evsel->prev_raw_counts->aggr; - } -} - static size_t pkg_id_hash(const void *__key, void *ctx __maybe_unused) { uint64_t *key = (uint64_t *) __key; @@ -442,7 +420,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 = &evsel->counts->aggr; struct perf_stat_evsel *ps = evsel->stats; static struct perf_counts_values zero; bool skip = false; @@ -511,12 +488,6 @@ process_counter_values(struct perf_stat_config *config, struct evsel *evsel, } } - if (config->aggr_mode == AGGR_GLOBAL) { - aggr->val += count->val; - aggr->ena += count->ena; - aggr->run += count->run; - } - return 0; } @@ -541,13 +512,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 = &counter->counts->aggr; struct perf_stat_evsel *ps = counter->stats; - u64 *count = counter->counts->aggr.values; + u64 *count; int ret; - aggr->val = aggr->ena = aggr->run = 0; - if (counter->per_pkg) evsel__zero_per_pkg(counter); @@ -558,6 +526,11 @@ int perf_stat_process_counter(struct perf_stat_config *config, if (config->aggr_mode != AGGR_GLOBAL) return 0; + /* + * GLOBAL aggregation mode only has a single aggr counts, + * so we can use ps->aggr[0] as the actual output. + */ + count = ps->aggr[0].counts.values; update_stats(&ps->res_stats, *count); if (verbose > 0) {