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 0F1E1C433F5 for ; Wed, 5 Jan 2022 06:17:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238292AbiAEGRk (ORCPT ); Wed, 5 Jan 2022 01:17:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238197AbiAEGQO (ORCPT ); Wed, 5 Jan 2022 01:16:14 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76D03C0698E0 for ; Tue, 4 Jan 2022 22:15:55 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id n2-20020a255902000000b0060f9d75eafeso15621453ybb.1 for ; Tue, 04 Jan 2022 22:15:55 -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=cCPa+SHUCrMw8an8q45ZtRv/i64BmCmjROSrKJPgOM2PlHDZB4+gvUCwJ1zG+hj8fU IGxUB7AKkBFoSB9Iq/g5ay3aE4WzGhPsoWQn26bxpPYxsG8MFY2yG2H0Rn0JwycHgoMM f+Yu6rhevihqhazqUEML2fUjYVtCw0GRBAa/Jtuvu0haKFsRyHQdnq20hXmax0lUfN60 JyS6G7j64n3+q1DAcdkOdPw35XZCVVJPVoX9dWmjAdM8FDDYcFwCJkF/wmuJcE/8OOhS kcXb95CGgvWhzwN9Gjyj2OWN1UkZrO3kbC7uP7QgfmWOpEpSNx7iFR3WtmpOfoWT+vc6 4bbg== 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=nxPKk+5BSWZxEGadEB6UcVgiyvkPlJ+dHtkTQfc3Q9ixTiL9iBKUgvb5+0lSwniU8+ m8PzJKJaRco9V/tqhYa4V9bSvd1U9b56C2hGxjsydX4xvKN81U/ZOxIdRBypRHv3xpP3 OuShjMKLkz6hvndjrJeldVEggCvV+z4GZfHtdsHSSBGoOTkdk9QIVJfHnAhyezZ6O5VQ 505CnH4+Ybuy9MAGkPTayPKE5l3Cv4dZiL/KYO3m5sjxqVMNKB5ltkGwZAPjY+VvSH/s uUcstAUSmRFgxkRttiFq3/vifub1IjIEnEBDjMTvLGLiQeSV8cAgXMtGdi0tgYJMpylt aKtw== X-Gm-Message-State: AOAM531i/GWQD/SMVTJQiCqpwapF9VR2CA0BsmKNkCfj8zYgMe1QQ2wz qxHY1BAvZ0/Zy8gFXQAUYdySYgj/2GQs X-Google-Smtp-Source: ABdhPJyMIB+6RXZ4fgulTItYs0MJRIuoDNybHTF5irVS16tYmpzKDDP+9Nut1QNjJ9zINgchGiHA954cHJ4D X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:3af1:caef:2937:5d2b]) (user=irogers job=sendgmr) by 2002:a25:9b45:: with SMTP id u5mr24170194ybo.76.1641363354738; Tue, 04 Jan 2022 22:15:54 -0800 (PST) Date: Tue, 4 Jan 2022 22:13:50 -0800 In-Reply-To: <20220105061351.120843-1-irogers@google.com> Message-Id: <20220105061351.120843-48-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 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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); } } -- 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 30DD8C433F5 for ; Wed, 5 Jan 2022 06:55:52 +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=ZYcLvsifaB3dmfE+xl0wa+vxFJ yMe/i/Al1BIdbnS9Oc3d/0MYtkhC4/AtCnq5euPVBOac7PcNDc0Dh6RWRTREce+JaLBIgb3BkRAl6 ZUcOIgYKM31eHwrHK326cHrVDdlkVw/WBRbMYXjHO9zZCxQN6OCmXYGNFQU9jFfwLMcSaQ6nFJuP+ Ql8l94JFNZscwpfZy3nXW3XEvVwGG60sewCXDyH6Wt7eHjzGxB31QAucH6lBs2FOVb4pxeXigagih J6xDKmh3jnWiFES2bFgDfwz6iV6ijcbIkOoLy8B5vbMUUKmQUuDFZ11SVDzPH30HIN2RbT2GXWMl5 SqsabdBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n50BS-00Dv40-Mg; Wed, 05 Jan 2022 06:54:07 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n4zaW-00Dgge-HX for linux-arm-kernel@lists.infradead.org; Wed, 05 Jan 2022 06:15:57 +0000 Received: by mail-yb1-xb49.google.com with SMTP id e137-20020a25378f000000b0060c1f2f4939so51890698yba.3 for ; Tue, 04 Jan 2022 22:15:55 -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=cCPa+SHUCrMw8an8q45ZtRv/i64BmCmjROSrKJPgOM2PlHDZB4+gvUCwJ1zG+hj8fU IGxUB7AKkBFoSB9Iq/g5ay3aE4WzGhPsoWQn26bxpPYxsG8MFY2yG2H0Rn0JwycHgoMM f+Yu6rhevihqhazqUEML2fUjYVtCw0GRBAa/Jtuvu0haKFsRyHQdnq20hXmax0lUfN60 JyS6G7j64n3+q1DAcdkOdPw35XZCVVJPVoX9dWmjAdM8FDDYcFwCJkF/wmuJcE/8OOhS kcXb95CGgvWhzwN9Gjyj2OWN1UkZrO3kbC7uP7QgfmWOpEpSNx7iFR3WtmpOfoWT+vc6 4bbg== 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=wUpX8PQwLHeHjnVrZzaMJ1kcP1+F3k0B4wg8H0YOJrnZ/7Obi2HImOl+F0pzsG6Zqv wyVdCpaEPxSEyPftBGL1WExosjXROhSLPJfPQsRZcDumGoVAe3bEeihbgGrwzrtdxZ7J 204baOkEmaMbz3rjpEDmUE1v2XV/WkWVT21pey+YvXg35DjfkSR149uI0bkbXRLRGU/c 0svkzCZa2CaPq8DjbIFLZlkwaO97z4acHqp9cM1TIJRy6GYyvnC1EBXom6ICDM3d4JRe mFruhRrUPu1k4+2s44TgzKZkvcvTxXrOBQXwTtTIMa4ZHw7Q2GQvkto692u8SFY3UttQ Py7Q== X-Gm-Message-State: AOAM530/y3ELfGeLz3khJ/merXDI07nk82ISrQ4QFrPX4LRmr5/0U/5W 7/3d7bwzHR9tMhIPoCqSiuKBwEbiYQAO X-Google-Smtp-Source: ABdhPJyMIB+6RXZ4fgulTItYs0MJRIuoDNybHTF5irVS16tYmpzKDDP+9Nut1QNjJ9zINgchGiHA954cHJ4D X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:3af1:caef:2937:5d2b]) (user=irogers job=sendgmr) by 2002:a25:9b45:: with SMTP id u5mr24170194ybo.76.1641363354738; Tue, 04 Jan 2022 22:15:54 -0800 (PST) Date: Tue, 4 Jan 2022 22:13:50 -0800 In-Reply-To: <20220105061351.120843-1-irogers@google.com> Message-Id: <20220105061351.120843-48-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 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-20220104_221556_627849_81261402 X-CRM114-Status: GOOD ( 14.01 ) 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 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); } } -- 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