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 CAE0AC433FE for ; Wed, 5 Jan 2022 06:15:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229687AbiAEGPh (ORCPT ); Wed, 5 Jan 2022 01:15:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237743AbiAEGPA (ORCPT ); Wed, 5 Jan 2022 01:15:00 -0500 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99417C06139A for ; Tue, 4 Jan 2022 22:15:00 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id k130-20020a255688000000b0060c3dcae580so50720898ybb.6 for ; Tue, 04 Jan 2022 22:15:00 -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=MyX41obsfTbklj5mP7URo6KOdoHhcEiYJDRkMl7AGdI=; b=jEuPSgJL9JSgjNKG0RChwu9xGaqg1t/hIA+Sdzpvmd8lrbqtts928yn4ZLM23kTb0Z RFq/Z9q94n/9EqpLfoJVB0iXZA61XZ5391QZ547a/eIpIZqDbpRcWX7+TQG25cX91Thc sUdye69R+aw1ihrti0jPd8Bs+5el1eDNhPbvU8xvECm2jT66i7UZp2K1MUHltIdS2Z/r 4ar0HWvw3g4kD6x55DCTloQK5Tm9GfTW+3dxPVeLcTt7z/7Yf0ktlJtjtrZMjgrxnylF LkDsVba9cmmK7VSh2IWv1di1xYKz8VaTOZpifterm5w2k53KtmgAAQTDbTBFSAtIz0kb eenA== 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=MyX41obsfTbklj5mP7URo6KOdoHhcEiYJDRkMl7AGdI=; b=1M/ySezYOJ1Q8S+akjknxTIKOMioiKcvORow1vXl76NNo2nx2L58WkFhFuuh3wPFjt CZjChZALEgzFJo+HKXycaQ799TJSSsAWJx60Oe47kls3ZCM7FuYhgU7sl1kfblf5yN+t zx16wjuY+230j4oqGm2au74+JwMNo70qA81bIW1SIZOLZP/UkMeO7+A+lacHt5SF5ADU sv6UCif3jjSCmbcFL4DCuS1TbWh1nr56CsB7h9fzaRfGIZE2pgGEBDroTAvhfMt7fGXY fgomDKmo/B06+xPuI9kSvc6bymHR5lnama4aAhEFgdGjDpQw69H9ZSBX2S0kqod/dABm D0fg== X-Gm-Message-State: AOAM531Zc6dzRzRkdPVRROO3U5RH6tUSbeUaqpoNlPXTRw8S32F2qQCa lyuBDhyLvxp6LlENrEGXO8Cv0LFn0vfy X-Google-Smtp-Source: ABdhPJzeYuauxHIdcoVuJQH3u1AjHhrA8OEagRyvRcGzYdtQhltyyIQxFOOWe8cuNjLWj5riqHFL3uHXggR6 X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:3af1:caef:2937:5d2b]) (user=irogers job=sendgmr) by 2002:a25:c753:: with SMTP id w80mr52281820ybe.567.1641363299859; Tue, 04 Jan 2022 22:14:59 -0800 (PST) Date: Tue, 4 Jan 2022 22:13:28 -0800 In-Reply-To: <20220105061351.120843-1-irogers@google.com> Message-Id: <20220105061351.120843-26-irogers@google.com> Mime-Version: 1.0 References: <20220105061351.120843-1-irogers@google.com> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog Subject: [PATCH v4 25/48] perf stat-display: Avoid use of core for CPU. 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Correct use of cpumap index in print_no_aggr_metric. Signed-off-by: Ian Rogers --- tools/perf/util/stat-display.c | 45 +++++++++++++++++----------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index 870b1db71fbc..f48d1678861c 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -120,11 +120,10 @@ static void aggr_printout(struct perf_stat_config *config, id.die, config->csv_output ? 0 : -3, id.core, config->csv_sep); - } else if (id.core > -1) { + } else if (id.cpu > -1) { fprintf(config->output, "CPU%*d%s", config->csv_output ? 0 : -7, - evsel__cpus(evsel)->map[id.core], - config->csv_sep); + id.cpu, config->csv_sep); } break; case AGGR_THREAD: @@ -334,7 +333,7 @@ static int first_shadow_cpu(struct perf_stat_config *config, int cpu, idx; if (config->aggr_mode == AGGR_NONE) - return id->core; + return id->cpu; if (!config->aggr_get_id) return 0; @@ -697,10 +696,9 @@ static void print_counter_aggrdata(struct perf_stat_config *config, fprintf(output, "%s", prefix); uval = val * counter->scale; - if (cpu != -1) { - id = aggr_cpu_id__empty(); - id.core = cpu; - } + if (cpu != -1) + id = aggr_cpu_id__cpu(cpu, /*data=*/NULL); + printout(config, id, nr, counter, uval, prefix, run, ena, 1.0, &rt_stat); if (!metric_only) @@ -911,8 +909,7 @@ static void print_counter(struct perf_stat_config *config, fprintf(output, "%s", prefix); uval = val * counter->scale; - id = aggr_cpu_id__empty(); - id.core = cpu; + id = aggr_cpu_id__cpu(cpu, /*data=*/NULL); printout(config, id, 0, counter, uval, prefix, run, ena, 1.0, &rt_stat); @@ -924,29 +921,31 @@ static void print_no_aggr_metric(struct perf_stat_config *config, struct evlist *evlist, char *prefix) { - int cpu; - int nrcpus = 0; - struct evsel *counter; - u64 ena, run, val; - double uval; - struct aggr_cpu_id id; + int all_idx, cpu; - nrcpus = evlist->core.cpus->nr; - for (cpu = 0; cpu < nrcpus; cpu++) { + perf_cpu_map__for_each_cpu(cpu, all_idx, evlist->core.cpus) { + struct evsel *counter; bool first = true; if (prefix) fputs(prefix, config->output); evlist__for_each_entry(evlist, counter) { - id = aggr_cpu_id__empty(); - id.core = cpu; + u64 ena, run, val; + double uval; + struct aggr_cpu_id id; + int counter_idx = perf_cpu_map__idx(evsel__cpus(counter), cpu); + + if (counter_idx < 0) + continue; + + id = aggr_cpu_id__cpu(cpu, /*data=*/NULL); if (first) { aggr_printout(config, counter, id, 0); first = false; } - val = perf_counts(counter->counts, cpu, 0)->val; - ena = perf_counts(counter->counts, cpu, 0)->ena; - run = perf_counts(counter->counts, cpu, 0)->run; + val = perf_counts(counter->counts, counter_idx, 0)->val; + ena = perf_counts(counter->counts, counter_idx, 0)->ena; + run = perf_counts(counter->counts, counter_idx, 0)->run; uval = val * counter->scale; printout(config, id, 0, counter, uval, prefix, -- 2.34.1.448.ga2b2bfdf31-goog 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 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 F0F02C433EF for ; Wed, 5 Jan 2022 06:35:14 +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=aYHc8JNSkuPEP6nD3vI3zt4INtY0uswgWdXplZoIuuk=; b=ihHlduO7KODfFTzDqVNHYJ6KHH khF0S2itaqj/gaYk3bWx0PoOtgB/kioYKL3+wGRavIlWb/VtDj+ljRMdb0KNlC3Xao1dlQPuE+dMZ 2P1U7Tc4sWA0AypDBHuY40BAQUhYEOn23pTr+l+FLet2XfYBTZTRv0f8brgS6UWRICv0UyU4TSbOV Dcjg0T1muHEaWxkQES2L8bG/BwFYPSW+6KWzruLR6DLti2Hcfn0HgdmyMSrfCmqK4320r1MOoEYa4 9iKsiFfmgLxyqdZyIYcmzH+Yza05c0fmmGXRmap2CN/on5grHun5eq5sPd+BNJ3tL3STp8VNm5d67 ENHfzucw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n4zrm-00DngK-2j; Wed, 05 Jan 2022 06:33:46 +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 1n4zZd-00Dg4W-6i for linux-arm-kernel@lists.infradead.org; Wed, 05 Jan 2022 06:15:02 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id e137-20020a25378f000000b0060c1f2f4939so51887110yba.3 for ; Tue, 04 Jan 2022 22:15:00 -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=MyX41obsfTbklj5mP7URo6KOdoHhcEiYJDRkMl7AGdI=; b=jEuPSgJL9JSgjNKG0RChwu9xGaqg1t/hIA+Sdzpvmd8lrbqtts928yn4ZLM23kTb0Z RFq/Z9q94n/9EqpLfoJVB0iXZA61XZ5391QZ547a/eIpIZqDbpRcWX7+TQG25cX91Thc sUdye69R+aw1ihrti0jPd8Bs+5el1eDNhPbvU8xvECm2jT66i7UZp2K1MUHltIdS2Z/r 4ar0HWvw3g4kD6x55DCTloQK5Tm9GfTW+3dxPVeLcTt7z/7Yf0ktlJtjtrZMjgrxnylF LkDsVba9cmmK7VSh2IWv1di1xYKz8VaTOZpifterm5w2k53KtmgAAQTDbTBFSAtIz0kb eenA== 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=MyX41obsfTbklj5mP7URo6KOdoHhcEiYJDRkMl7AGdI=; b=v+4KEqq0kNub9bS1mkYrWI26NuTcWlvd82Ud3zOBzVfa+xrdnBmj7EO4PM+8+4woR0 fb5rOg+6ui0ipuszKt64kx/OA2e72HSnpRlKJHsw+qqBmOKRFgX0Ou5Q2JgXzk9XgtKp fGPqOzMqKMKfMugmD+0rBt6X67GajBpLidq4wW5YzUd/SAwI6E8ZxprdtfTUEnJ7Gq4b NkNJAX14F1UmjKnZ6JjD+ar1tkigb5qV4vKyGMcfYhL9gxYnraRDELx7fsTAXmhkSwwM cbQQvk/2ui25eJL5fmS9Cjf7QVha3PgoRdo7vBD57KFpEvJq4qCBigcXSVqbQxpDIY4e 7zGg== X-Gm-Message-State: AOAM531CpjnW5kG1ebvq4VJFGOSWARODGDNqjEJCGlaevN6tKrbKyLo3 W/OMfv0oFO5PpTy5c/gCf140X3TMGaid X-Google-Smtp-Source: ABdhPJzeYuauxHIdcoVuJQH3u1AjHhrA8OEagRyvRcGzYdtQhltyyIQxFOOWe8cuNjLWj5riqHFL3uHXggR6 X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:3af1:caef:2937:5d2b]) (user=irogers job=sendgmr) by 2002:a25:c753:: with SMTP id w80mr52281820ybe.567.1641363299859; Tue, 04 Jan 2022 22:14:59 -0800 (PST) Date: Tue, 4 Jan 2022 22:13:28 -0800 In-Reply-To: <20220105061351.120843-1-irogers@google.com> Message-Id: <20220105061351.120843-26-irogers@google.com> Mime-Version: 1.0 References: <20220105061351.120843-1-irogers@google.com> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog Subject: [PATCH v4 25/48] perf stat-display: Avoid use of core for CPU. 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-20220104_221501_274908_3F05E512 X-CRM114-Status: GOOD ( 15.39 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Correct use of cpumap index in print_no_aggr_metric. Signed-off-by: Ian Rogers --- tools/perf/util/stat-display.c | 45 +++++++++++++++++----------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index 870b1db71fbc..f48d1678861c 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -120,11 +120,10 @@ static void aggr_printout(struct perf_stat_config *config, id.die, config->csv_output ? 0 : -3, id.core, config->csv_sep); - } else if (id.core > -1) { + } else if (id.cpu > -1) { fprintf(config->output, "CPU%*d%s", config->csv_output ? 0 : -7, - evsel__cpus(evsel)->map[id.core], - config->csv_sep); + id.cpu, config->csv_sep); } break; case AGGR_THREAD: @@ -334,7 +333,7 @@ static int first_shadow_cpu(struct perf_stat_config *config, int cpu, idx; if (config->aggr_mode == AGGR_NONE) - return id->core; + return id->cpu; if (!config->aggr_get_id) return 0; @@ -697,10 +696,9 @@ static void print_counter_aggrdata(struct perf_stat_config *config, fprintf(output, "%s", prefix); uval = val * counter->scale; - if (cpu != -1) { - id = aggr_cpu_id__empty(); - id.core = cpu; - } + if (cpu != -1) + id = aggr_cpu_id__cpu(cpu, /*data=*/NULL); + printout(config, id, nr, counter, uval, prefix, run, ena, 1.0, &rt_stat); if (!metric_only) @@ -911,8 +909,7 @@ static void print_counter(struct perf_stat_config *config, fprintf(output, "%s", prefix); uval = val * counter->scale; - id = aggr_cpu_id__empty(); - id.core = cpu; + id = aggr_cpu_id__cpu(cpu, /*data=*/NULL); printout(config, id, 0, counter, uval, prefix, run, ena, 1.0, &rt_stat); @@ -924,29 +921,31 @@ static void print_no_aggr_metric(struct perf_stat_config *config, struct evlist *evlist, char *prefix) { - int cpu; - int nrcpus = 0; - struct evsel *counter; - u64 ena, run, val; - double uval; - struct aggr_cpu_id id; + int all_idx, cpu; - nrcpus = evlist->core.cpus->nr; - for (cpu = 0; cpu < nrcpus; cpu++) { + perf_cpu_map__for_each_cpu(cpu, all_idx, evlist->core.cpus) { + struct evsel *counter; bool first = true; if (prefix) fputs(prefix, config->output); evlist__for_each_entry(evlist, counter) { - id = aggr_cpu_id__empty(); - id.core = cpu; + u64 ena, run, val; + double uval; + struct aggr_cpu_id id; + int counter_idx = perf_cpu_map__idx(evsel__cpus(counter), cpu); + + if (counter_idx < 0) + continue; + + id = aggr_cpu_id__cpu(cpu, /*data=*/NULL); if (first) { aggr_printout(config, counter, id, 0); first = false; } - val = perf_counts(counter->counts, cpu, 0)->val; - ena = perf_counts(counter->counts, cpu, 0)->ena; - run = perf_counts(counter->counts, cpu, 0)->run; + val = perf_counts(counter->counts, counter_idx, 0)->val; + ena = perf_counts(counter->counts, counter_idx, 0)->ena; + run = perf_counts(counter->counts, counter_idx, 0)->run; uval = val * counter->scale; printout(config, id, 0, counter, uval, prefix, -- 2.34.1.448.ga2b2bfdf31-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel