From patchwork Thu Dec 23 07:45:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 12698038 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 55AE5C433EF for ; Thu, 23 Dec 2021 08:27: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=lztyETCezpG77VGEW9uDAzK0vjWla/sousij6tsMCok=; b=ct7LFZCL6DHRzVRmcnH9vzpxF9 LCC9yOm9OmNZG1mo530wyGpEbiCcunqV5pK5QzCw4B/NjRRGkHlllFAOohpHp90lTwWjfs7FQOjoT T+SlHUrxmQd4jqdHLtqCBSG4N/T38PEqN/Ew1Jq6D3kPSV38g1G4NfISFqaiE05eoFLxziY7KCn/Z TGk/qX2kx4db9ePG44xVcLi+kDyx11xVHEm/PFk7Yg2/3X6NyF1zwHhtA74Q6JZZ1fJrrmHIm6k12 LkY6nAj0udXhClnaF+dL/ey5DPqEdS1iZFP+6RqFI6ZV4lkP6p/tYOD40fOnsPRD5kdbEV6/PZ00L taBLeoew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0JQ7-00CE6g-JY; Thu, 23 Dec 2021 08:25: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 1n0Ipd-00C0NY-Mu for linux-arm-kernel@lists.infradead.org; Thu, 23 Dec 2021 07:48:11 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id j204-20020a2523d5000000b005c21574c704so8600220ybj.13 for ; Wed, 22 Dec 2021 23:48:08 -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=cDaibtPTEVy/marM7k5BRfohlw9xTdSxUKumkjr4yhw=; b=LR0s9gyR8FdFtVpedgrPoQl0RipPyJFh0k9uDNnNWGWyGp41FS4MhvQkerVXScw40O 5Q3UgSXloAekM3enRkXD4/fIt1iveTUNFR0xdq3R6OFB9RC0H4mm7C5I+csb4PN4VXAD OM1S1z3/mX//nMtqRh1DDVuWQQLz4PaV3PkuyzaPSutZdqFk+nkgpusXJ1Vpw0h/w/Ph l/BwiN3gdX47cU0o3t3KRNEAahlbYreHh1/4QpHUMgyeVSF0BmDVPK37E76zHjbXRqAn 6vXc2tDWW8hi2lqSUOqLp8z8MMmAgzWAS9djaYyCpkhDylETPN22SZ2S/Iu4bT57KrOx ZDSg== 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=cDaibtPTEVy/marM7k5BRfohlw9xTdSxUKumkjr4yhw=; b=zKpO0gljdAxW5TDTrc8ZDsDV5UMv9RFEx3ZnJYjNUJrItx9QY+DSzaPvpYCrzF7rgv zrgiD/e7TZ7vO2+YPHylXzYFmu2pT97xac+dII50FhAoC1JxWCvLgF6vAJDOcdGulOvZ bhQdF/KrbwywwPVb+ayT4ps5mDumW+WEKkPucLeQ1sWLYaw0snFJDyJ8IDNB96pju61e 7T8aYIR4T6fQyQt3I6VQhf6KQCTONkDTCWZsZxM5EOoqzryKft+xgVVkVsCOPEjjuDpE NzPBD3O+q937shrAZm/P3X7eeulmnmcGOo9Q07oVnZ96kE+zqdthk8Kg4tnzXfLKFk/X mTwQ== X-Gm-Message-State: AOAM533eWdlKPt1ePMcVqa4NmNO2qA+tjQMaTPENuaiUVDso0f2+pz3X aBDMKRXIgghRonrbtW73/Wfp0DWFu62K X-Google-Smtp-Source: ABdhPJzDnNWgSN3KpORsveY6l3QnqXRD+G9oM9zhBV0+i5/UTFDThki+ZfSFVKKlRC0auWHdTdRytkGYHEup X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:4fef:90ff:589d:24ca]) (user=irogers job=sendgmr) by 2002:a25:3814:: with SMTP id f20mr1711353yba.117.1640245687520; Wed, 22 Dec 2021 23:48:07 -0800 (PST) Date: Wed, 22 Dec 2021 23:45:40 -0800 In-Reply-To: <20211223074541.3318938-1-irogers@google.com> Message-Id: <20211223074541.3318938-48-irogers@google.com> Mime-Version: 1.0 References: <20211223074541.3318938-1-irogers@google.com> X-Mailer: git-send-email 2.34.1.307.g9b7440fafd-goog Subject: [PATCH v2 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 Cc: eranian@google.com, Ian Rogers X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211222_234809_782194_69131EC3 X-CRM114-Status: GOOD ( 13.73 ) 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 9be74e907352..81a288a7ae46 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); } }