Re: [PATCH v2 1/3] perf header: Support HYBRID_TOPOLOGY feature

From: Jiri Olsa
Date: Mon May 10 2021 - 09:15:24 EST


On Fri, May 07, 2021 at 11:52:28AM +0800, Jin Yao wrote:
> It would be useful to let user know the hybrid topology.
> Adding HYBRID_TOPOLOGY feature in header to indicate the
> core cpus and the atom cpus.
>
> With this patch,
>
> For the perf.data generated on hybrid platform,
> reports the hybrid cpu list.
>
> root@otcpl-adl-s-2:~# perf report --header-only -I
> ...
> # hybrid cpu system:
> # cpu_core cpu list : 0-15
> # cpu_atom cpu list : 16-23
>
> For the perf.data generated on non-hybrid platform,
> reports the message that HYBRID_TOPOLOGY is missing.
>
> root@kbl-ppc:~# perf report --header-only -I
> ...
> # missing features: TRACING_DATA BRANCH_STACK GROUP_DESC AUXTRACE STAT CLOCKID DIR_FORMAT COMPRESSED CLOCK_DATA HYBRID_TOPOLOGY
>
> Signed-off-by: Jin Yao <yao.jin@xxxxxxxxxxxxxxx>
> ---
> .../Documentation/perf.data-file-format.txt | 14 +++
> tools/perf/util/cputopo.c | 80 +++++++++++++++++
> tools/perf/util/cputopo.h | 13 +++
> tools/perf/util/env.c | 6 ++
> tools/perf/util/env.h | 7 ++
> tools/perf/util/header.c | 87 +++++++++++++++++++
> tools/perf/util/header.h | 1 +
> tools/perf/util/pmu-hybrid.h | 11 +++
> 8 files changed, 219 insertions(+)
>
> diff --git a/tools/perf/Documentation/perf.data-file-format.txt b/tools/perf/Documentation/perf.data-file-format.txt
> index 9ee96640744e..d9d82ca8aeb7 100644
> --- a/tools/perf/Documentation/perf.data-file-format.txt
> +++ b/tools/perf/Documentation/perf.data-file-format.txt
> @@ -402,6 +402,20 @@ struct {
> u64 clockid_time_ns;
> };
>
> + HEADER_HYBRID_TOPOLOGY = 30,
> +
> +Indicate the hybrid CPUs. The format of data is as below.
> +
> +struct {
> + char *pmu_name;
> + char *cpus;
> +};

this is missing the nr count, should be like:

struct {
u32 nr;
struct {
char *pmu_name;
char *cpus;
} [nr]
}

jirka