[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <66df2821-80a4-4ec2-b326-d0edda8fcde2@linux.intel.com>
Date: Fri, 13 Dec 2024 13:34:07 -0500
From: "Liang, Kan" <kan.liang@...ux.intel.com>
To: Ravi Bangoria <ravi.bangoria@....com>,
Thomas Falcon <thomas.falcon@...el.com>
Cc: linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
namhyung@...nel.org, mark.rutland@....com,
alexander.shishkin@...ux.intel.com, jolsa@...nel.org, irogers@...gle.com,
adrian.hunter@...el.com
Subject: Re: [PATCH] perf script: Fix output type for dynamically allocated
core PMU's
On 2024-12-13 2:07 a.m., Ravi Bangoria wrote:
> Hi Thomas,
>
>> @@ -386,6 +386,8 @@ static int evsel_script__fprintf(struct evsel_script *es, FILE *fp)
>>
>> static inline int output_type(unsigned int type)
>> {
>> + struct perf_pmu *pmu;
>> +
>> switch (type) {
>> case PERF_TYPE_SYNTH:
>> return OUTPUT_TYPE_SYNTH;
>> @@ -394,6 +396,10 @@ static inline int output_type(unsigned int type)
>> return type;
>> }
>>
>> + pmu = perf_pmus__find_by_type(type);
>> + if (pmu && pmu->is_core)
>> + return PERF_TYPE_RAW;
>
> Minor nit ...
>
> output_type() seems to be getting called a lot. For ex, for a perf.data
> with 4530 samples, output_type() was called 181246 times when I ran
> "perf script". IIUC, this pmu lookup is unnecessary for homogeneous
> platforms? If so, can we make it conditional?
>
Agreed. I think the search should only be applied for the
perf_pmus__num_core_pmus() > 1 case.
We should just need to search the core_pmus when comparing the type.
Thanks,
Kan
Powered by blists - more mailing lists