Message ID | 20220328232648.2127340-7-irogers@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> 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 DE783C433F5 for <linux-arm-kernel@archiver.kernel.org>; Mon, 28 Mar 2022 23:29: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=aIW2MmVEBDD0HiJNWr/voiyiH+U3GnpaevBeUSxYLxs=; b=XSdQiuCyg6ev8Q66KAARk/8a3x jmG3T/CVRM9ycgK/h2QQoNdTSmGyq05Hm4siOKaoU/6fjgox9UxiElDxwtBqgA3f0MgLHP2Jg82P5 ty+pamcB3/SaCxr60znx+f65+bkff0ev92M4M9MqlsfAcs8biGC8T2WjxRVKskDRU2igOjJ70IzNF np5YbZUKJrZLaAXuLzJfs5phcaW91R49j0q98qCd7yu3s7pVS2O7HhWvnicSnT1fCb0mgUaSNTCK9 CK+gD2Vdq6iZ/KtksvHpOMD66EeDkPc1f9wvZlcRIqdGtIudFHX3kdQuXpKrE2fMj9GzdmtAqfaqh /k+CK/Uw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nYymZ-00ARpW-48; Mon, 28 Mar 2022 23:28:19 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nYylQ-00ARIu-Ko for linux-arm-kernel@lists.infradead.org; Mon, 28 Mar 2022 23:27:10 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-2e61c5a0eb7so130130817b3.22 for <linux-arm-kernel@lists.infradead.org>; Mon, 28 Mar 2022 16:27:07 -0700 (PDT) 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=62T0/TU1Sa4Wqe+eN5txv4UBeKWrByFVFuAcfl2TJUY=; b=WuFWAPyS7pgyWDgjtlzsKpFPsxxPd9tgW0nM0IULEGbEsaEs5zE0BwR/iV0yiRyiUr C9LzDD7OQikFacW2EZ3HgTOERW8ioeMdDmGtbxjGjdAvIgFqPAGlWSKO/Fo07kxOusQj xXQTuUoN7COi2/I3yvyXPwYeetZ2hVDiAs6t36XmpeIj0N0pXu41bgEpHgFvTMqjwxGS YkJ0glvboVcb8xY9ZZdbAAgSHoReMnojd0N4VWMYdi2aBcDvyxepEb8RTHF4ZzMUgt9m qUiIro8106ztVL4WbMUEwnsQ0Z0mF/k9xEPBZD0X3XV3XPniYpCSNqCpBNG82OklWGGW su1A== 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=62T0/TU1Sa4Wqe+eN5txv4UBeKWrByFVFuAcfl2TJUY=; b=MsUn2Bxxdm6lEW4JZDWvjZdP9yZFEvlp+x4dfKEurwluoGjDFIluRZMGikdlyl5yv2 c2R/tsewG74jNhG8g3BgYo+dqqfj/6pcgMuBrDf/1oHc3iEtzpJR/GfQ4H/EIoMFsPNb fw2SktVisK0MixlkJQpjVSvnpZqnYYtTFuejcPL26W8RajT4+rSEQuOSPUCLDMVc7+kg LeLdAfuEchF/MCYQXvT/ufLGGRlKmXlln5/ZIjHMJy8F86gpg4a7C/p4My303+xnpbWe f4Opx7VkJ3q7px8cXA7X2eK7lY7uCtwv4I/IppwVUggrZWsUGtImbkaBhJDAafUnYlPv SLLQ== X-Gm-Message-State: AOAM530w03qWhg50YfGopFwa3VWtko4dzpBFIAGtRJh78bGZYjzeAIkf uOBpI+OLcA0MH4KUounuFGnVA0dGC5Gq X-Google-Smtp-Source: ABdhPJyGiiWxc4ARHStwB+ZXo/aW9HRYLxvc/de+ZQtJa8gJqpvKLIH6JBfkA9BFTOaLI3PuawSjmI+3PmmF X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:9d6a:527d:cf46:71e2]) (user=irogers job=sendgmr) by 2002:a25:ba04:0:b0:623:ed7a:701d with SMTP id t4-20020a25ba04000000b00623ed7a701dmr25269976ybg.209.1648510026853; Mon, 28 Mar 2022 16:27:06 -0700 (PDT) Date: Mon, 28 Mar 2022 16:26:48 -0700 In-Reply-To: <20220328232648.2127340-1-irogers@google.com> Message-Id: <20220328232648.2127340-7-irogers@google.com> Mime-Version: 1.0 References: <20220328232648.2127340-1-irogers@google.com> X-Mailer: git-send-email 2.35.1.1021.g381101b075-goog Subject: [PATCH v2 6/6] perf evlist: Respect all_cpus when setting user_requested_cpus From: Ian Rogers <irogers@google.com> To: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Mathieu Poirier <mathieu.poirier@linaro.org>, Suzuki K Poulose <suzuki.poulose@arm.com>, Mike Leach <mike.leach@linaro.org>, Leo Yan <leo.yan@linaro.org>, John Garry <john.garry@huawei.com>, Will Deacon <will@kernel.org>, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Andrii Nakryiko <andrii@kernel.org>, Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>, John Fastabend <john.fastabend@gmail.com>, KP Singh <kpsingh@kernel.org>, Kajol Jain <kjain@linux.ibm.com>, James Clark <james.clark@arm.com>, German Gomez <german.gomez@arm.com>, Adrian Hunter <adrian.hunter@intel.com>, Riccardo Mancini <rickyman7@gmail.com>, Andi Kleen <ak@linux.intel.com>, Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>, Alexander Antonov <alexander.antonov@linux.intel.com>, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, bpf@vger.kernel.org Cc: Stephane Eranian <eranian@google.com>, Ian Rogers <irogers@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220328_162708_733076_BE70DF9F X-CRM114-Status: GOOD ( 15.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
Make evlist CPUs more accurate
|
expand
|
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index cb2cf4463c08..1a3308ec35f1 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -1036,6 +1036,8 @@ int evlist__create_maps(struct evlist *evlist, struct target *target) if (!cpus) goto out_delete_threads; + if (evlist->core.all_cpus) + cpus = perf_cpu_map__intersect(cpus, evlist->core.all_cpus); evlist->core.has_user_cpus = !!target->cpu_list && !target->hybrid; perf_evlist__set_maps(&evlist->core, cpus, threads);
If all_cpus is calculated it represents the merge/union of all evsel cpu maps. By default user_requested_cpus is computed to be the online CPUs. For uncore events, it is often the case currently that all_cpus is a subset of user_requested_cpus. Metrics printed without aggregation and with metric-only, in print_no_aggr_metric, iterate over user_requested_cpus assuming every CPU has a metric to print. For each CPU the prefix is printed, but then if the evsel's cpus doesn't contain anything you get an empty line like the following on a 2 socket 36 core SkylakeX: ``` $ perf stat -A -M DRAM_BW_Use -a --metric-only -I 1000 1.000453137 CPU0 0.00 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 CPU18 0.00 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 1.000453137 2.003717143 CPU0 0.00 ... ``` While it is possible to be lazier in printing the prefix and trailing newline, having user_requested_cpus not be a subset of all_cpus is preferential so that wasted work isn't done elsewhere user_requested_cpus is used. The change modifies user_requested_cpus to be the intersection of user specified CPUs, or default all online CPUs, with the CPUs computed through the merge of all evsel cpu maps. New behavior: ``` $ perf stat -A -M DRAM_BW_Use -a --metric-only -I 1000 1.001086325 CPU0 0.00 1.001086325 CPU18 0.00 2.003671291 CPU0 0.00 2.003671291 CPU18 0.00 ... ``` Signed-off-by: Ian Rogers <irogers@google.com> --- tools/perf/util/evlist.c | 2 ++ 1 file changed, 2 insertions(+)