From patchwork Thu Dec 30 07:20:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 12701309 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9EF81C433EF for ; Thu, 30 Dec 2021 08:00:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=idkmQImD8oQKOSfTLbWJZiwYlShg1NgdI5Y8nl20jE8=; b=gPGfaTg1FLQrguQ2F6sIgwwTCu N5a7nWD1mwCuOqWGM/Jr1AKMwaBTfFuVxUyOsJy+s0/3bu7WRuTAczZXibTvIFTdeUZUPDAXZ9qsk VT07Dhb4mgG6vizLnp1k2PslGb3fzQEnIz14rnxITVxVyIrzyWCJddU0qor6b9RSPpbvkUCEP73EU V8LZnIFGpFyz04b8s479hvD7X2SlQKDGZ+A+dfMxh+udfr4gxOpQ45P9o5bAb3R9+CSbMZ9DPpLig Enshu5zbLMVrXpXZ7HoYtfHBnSq8pNUyWLdWdBdg6A5Cl1Z2mGI/I0AqX+VL4yC6YrYxJn73Z737n s9qD200Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n2qKp-003x04-8T; Thu, 30 Dec 2021 07:58:52 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n2plm-003kRi-In for linux-arm-kernel@lists.infradead.org; Thu, 30 Dec 2021 07:22:41 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id j18-20020a258152000000b006000d292a42so42360120ybm.0 for ; Wed, 29 Dec 2021 23:22:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=on9cMkVsbDIIWgmJUXNGZPB7xxaMgvNoxu0hM4zjpQ4=; b=sQovDeSS1jmqBxyi8qxJA+KJCHl0AO0LQutJiPf1kHryt/x0gH4bjxri2JsVCBPicu nRLqgEPUcnDXxQihf5alINa23pgAV3UpQPVPSM9DyzZv7Ul6K1ERcTDvkyY4FGzIfssJ LeSLcbVvmAM9/jD4nJeYrtx3SMM2OgZs3GZD7ZabjfJ6EZin/unbSFqWcTNca5Q532wq svLlxXJlSCgicDaH4twPedwjgrimmZo6ocAzh0yED6ASiT74eqBTRjgRwuWnBlonGnLG jPXmsMiRgsUVaqjuC73QMBbcCgyRBQ7H540aQX16AaHAqwH+SXvLBbqOdKNnu/mMoOPJ 0t2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=on9cMkVsbDIIWgmJUXNGZPB7xxaMgvNoxu0hM4zjpQ4=; b=oTbo7YxsthBsxt1q6bwZmXKAJsfjN7F5sTpfAtW2AS8WcZ+i/gtUk1P05mHzTjJXEf CBkD7JrY34AXcejbKcyhOUVRbGmiWqY9G6Qi7TpqlYe/ujmlIHU19qY+gt9ydE+ter11 56Rkhq2r7iyckTB3+WqNFF91kQgH3kIdcoLBC45mBya36fkDwmsofMg3Cpx1a9w/QyUz QWO6Ym8baGJtfyEz4t2wNtOorVDTEDTiBirTgPOLuSzO9q0RpPxWSXMKqDMD90aKvbEX /wTgryPKlQa2IJDqN+vXQL6TgAJlwgAvNdhAbk/nNnUhr7Uk0cWIkG69JFJjjJCcnTF9 6NoA== X-Gm-Message-State: AOAM530xRqd+zf70dTX8j1hC4Zp5MTXVFPRVWsywOucn98tiXkgUIhKA BgqoDHOCv/wqFm+l6LnuwDf1NpCmD2pI X-Google-Smtp-Source: ABdhPJzqq/QW5bQnoe90buoTODwyR2SzuN0kDoT9thVbRJhpcfDXrVUv+7YeJTwa7LJD/r1+V+Jdxh6BSnki X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:31c4:9539:dba1:a82b]) (user=irogers job=sendgmr) by 2002:a25:3716:: with SMTP id e22mr22191982yba.57.1640848956645; Wed, 29 Dec 2021 23:22:36 -0800 (PST) Date: Wed, 29 Dec 2021 23:20:29 -0800 In-Reply-To: <20211230072030.302559-1-irogers@google.com> Message-Id: <20211230072030.302559-49-irogers@google.com> Mime-Version: 1.0 References: <20211230072030.302559-1-irogers@google.com> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog Subject: [PATCH v3 47/48] perf stat: Correct first_shadow_cpu to return index From: Ian Rogers To: Andi Kleen , Jiri Olsa , Namhyung Kim , John Garry , Kajol Jain , "Paul A . Clarke" , Arnaldo Carvalho de Melo , Riccardo Mancini , Kan Liang , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Vineet Singh , James Clark , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Leo Yan , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, zhengjun.xing@intel.com Cc: eranian@google.com, Ian Rogers X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211229_232238_695165_DA7A2FAD X-CRM114-Status: GOOD ( 13.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org perf_stat__update_shadow_stats and perf_stat__print_shadow_stats use a cpu map index rather than a CPU, but first_shadow_cpu is returning the wrong value for this. Change first_shadow_cpu to first_shadow_cpu_map_idx to make things agree. Signed-off-by: Ian Rogers --- tools/perf/util/stat-display.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index 0f192360b6c6..ba95379efcfb 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -327,24 +327,23 @@ static void print_metric_header(struct perf_stat_config *config, fprintf(os->fh, "%*s ", config->metric_only_len, unit); } -static int first_shadow_cpu(struct perf_stat_config *config, - struct evsel *evsel, const struct aggr_cpu_id *id) +static int first_shadow_cpu_map_idx(struct perf_stat_config *config, + struct evsel *evsel, const struct aggr_cpu_id *id) { - struct perf_cpu_map *cpus; + struct perf_cpu_map *cpus = evsel__cpus(evsel); int cpu, idx; if (config->aggr_mode == AGGR_NONE) - return id->cpu; + return perf_cpu_map__idx(cpus, id->cpu); if (!config->aggr_get_id) return 0; - cpus = evsel__cpus(evsel); perf_cpu_map__for_each_cpu(cpu, idx, cpus) { struct aggr_cpu_id cpu_id = config->aggr_get_id(config, cpu); if (aggr_cpu_id__equal(&cpu_id, id)) - return cpu; + return idx; } return 0; } @@ -503,7 +502,7 @@ static void printout(struct perf_stat_config *config, struct aggr_cpu_id id, int } perf_stat__print_shadow_stats(config, counter, uval, - first_shadow_cpu(config, counter, &id), + first_shadow_cpu_map_idx(config, counter, &id), &out, &config->metric_events, st); if (!config->csv_output && !config->metric_only) { print_noise(config, counter, noise); @@ -532,7 +531,7 @@ static void aggr_update_shadow(struct perf_stat_config *config, val += perf_counts(counter->counts, idx, 0)->val; } perf_stat__update_shadow_stats(counter, val, - first_shadow_cpu(config, counter, &id), + first_shadow_cpu_map_idx(config, counter, &id), &rt_stat); } }