Re: [PATCH v4 2/5] perf header: Parse non-cpu pmu capabilities

From: Ravi Bangoria
Date: Mon May 23 2022 - 09:45:04 EST


On 23-May-22 2:34 PM, Jiri Olsa wrote:
> On Mon, May 23, 2022 at 09:09:42AM +0530, Ravi Bangoria wrote:
>
> SNIP
>
>> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
>> index a27132e5a5ef..b4505dbb9f4a 100644
>> --- a/tools/perf/util/header.c
>> +++ b/tools/perf/util/header.c
>> @@ -1580,6 +1580,67 @@ static int write_hybrid_cpu_pmu_caps(struct feat_fd *ff,
>> return 0;
>> }
>>
>> +/*
>> + * File format:
>> + *
>> + * struct {
>> + * u32 nr_pmus;
>> + * struct {
>> + * char pmu_name[];
>> + * u32 nr_caps;
>> + * struct {
>> + * char name[];
>> + * char value[];
>> + * } [nr_caps];
>> + * } [nr_pmus];
>> + * };
>> + */
>> +static int write_pmu_caps(struct feat_fd *ff, struct evlist *evlist __maybe_unused)
>> +{
>> + struct perf_pmu_caps *caps = NULL;
>> + struct perf_pmu *pmu = NULL;
>> + u32 nr_pmus = 0;
>> + int ret;
>> +
>> + while ((pmu = perf_pmu__scan(pmu))) {
>> + if (!pmu->name || !strncmp(pmu->name, "cpu", 3) ||
>
> should we check for the hybrid names as well?
> there's a helper perf_pmu__is_hybrid,
> aybe you can use that

Yup. Will include those.

Thanks,
Ravi