linux-stable/tools/lib/perf
K Prateek Nayak 995ed074b8 perf stat: Setup the foundation to allow aggregation based on cache topology
Processors based on chiplet architecture, such as AMD EPYC and Hygon do
not expose the chiplet details in the sysfs CPU topology information.
However, this information can be derived from the per CPU cache level
information from the sysfs.

'perf stat' has already supported aggregation based on topology
information using core ID, socket ID, etc. It'll be useful to aggregate
based on the cache topology to detect problems like imbalance and
cache-to-cache sharing at various cache levels.

This patch lays the foundation for aggregating data in 'perf stat' based
on the processor's cache topology. The cmdline option to aggregate data
based on the cache topology is added in Patch 4 of the series while this
patch sets up all the necessary functions and variables required to
support the new aggregation option.

The patch also adds support to display per-cache aggregation, or save it
as a JSON or CSV, as splitting it into a separate patch would break
builds when compiling with "-Werror=switch-enum" where the compiler will
complain about the lack of handling for the AGGR_CACHE case in the
output functions.

Committer notes:

Don't use perf_stat_config in tools/perf/util/cpumap.c, this would make
code that is in util/, thus not really specific to a single builtin, use
a specific builtin config structure.

Move the functions introduced in this patch from
tools/perf/util/cpumap.c since it needs access to builtin specific
and is not strictly needed to live in the util/ directory.

With this 'perf test python' is back building.

Suggested-by: Gautham Shenoy <gautham.shenoy@amd.com>
Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ananth Narayan <ananth.narayan@amd.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Sandipan Das <sandipan.das@amd.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wen Pu <puwen@hygon.cn>
Link: https://lore.kernel.org/r/20230517172745.5833-3-kprateek.nayak@amd.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2023-05-23 16:08:08 -03:00
..
Documentation libperf: Add API for allocating new thread map array 2022-02-23 14:40:23 -03:00
include perf stat: Setup the foundation to allow aggregation based on cache topology 2023-05-23 16:08:08 -03:00
tests libperf: Add a test case for read formats 2022-08-19 15:56:44 -03:00
Build libperf: Change tests to single static and shared binaries 2021-07-07 11:41:58 -03:00
core.c
cpumap.c perf cpumap: Add reference count checking 2023-04-17 16:50:02 -03:00
evlist.c perf evlist: Remove nr_groups 2023-03-13 17:42:27 -03:00
evsel.c perf tools: Remove special handling of system-wide evsel 2022-10-06 08:03:53 -03:00
internal.h
lib.c libperf: Add preadn() 2022-05-23 10:11:12 -03:00
libperf.map libperf: Add API for allocating new thread map array 2022-02-23 14:40:23 -03:00
libperf.pc.template
Makefile perf cpumap: Add reference count checking 2023-04-17 16:50:02 -03:00
mmap.c libperf: Add arm64 support to perf_mmap__read_self() 2022-02-06 09:14:27 -03:00
threadmap.c libperf: Add API for allocating new thread map array 2022-02-23 14:40:23 -03:00
xyarray.c