[PATCH 12/14] tools/perf: Add support for printing synth event details via default callback

Athira Rajeev atrajeev at linux.ibm.com
Fri Aug 29 18:35:17 AEST 2025



> On 27 Aug 2025, at 10:59 PM, Adrian Hunter <adrian.hunter at intel.com> wrote:
> 
> On 15/08/2025 11:34, Athira Rajeev wrote:
>> Introduce arch_perf_sample__fprintf_synth_evt to add support for
>> printing arch specific synth event details. The process_event()
>> function in "builtin-script.c" invokes perf_sample__fprintf_synth() for
>> displaying PERF_TYPE_SYNTH type events.
>> 
>>   if (attr->type == PERF_TYPE_SYNTH && PRINT_FIELD(SYNTH))
>>    perf_sample__fprintf_synth(sample, evsel, fp);
>> 
>> perf_sample__fprintf_synth() process the sample depending on the value
>> in evsel->core.attr.config . Currently all the arch specific callbacks
>> perf_sample__fprintf_synth* are part of "builtin-script.c" itself.
>> Example: perf_sample__fprintf_synth_ptwrite,
>> perf_sample__fprintf_synth_mwait etc. This will need adding arch
>> specific details in builtin-script.c for any new perf_synth_id events.
>> 
>> Introduce arch_perf_sample__fprintf_synth_evt() and invoke this as
>> default callback for perf_sample__fprintf_synth(). This way, arch
>> specific code can handle processing the details.
> 
> A default callback is not needed.
> 
>> 
>> Signed-off-by: Athira Rajeev <atrajeev at linux.ibm.com>
>> ---
>> tools/perf/builtin-script.c | 7 +++++++
>> 1 file changed, 7 insertions(+)
>> 
>> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
>> index d9fbdcf72f25..eff584735980 100644
>> --- a/tools/perf/builtin-script.c
>> +++ b/tools/perf/builtin-script.c
>> @@ -2003,6 +2003,12 @@ static int perf_sample__fprintf_synth_iflag_chg(struct perf_sample *sample, FILE
>> return len + perf_sample__fprintf_pt_spacing(len, fp);
>> }
>> 
>> +static void arch_perf_sample__fprintf_synth_evt(struct perf_sample *data __maybe_unused,
>> +  FILE *fp __maybe_unused, u64 config __maybe_unused)
>> +{
>> + return;
>> +}
>> +
>> static int perf_sample__fprintf_synth(struct perf_sample *sample,
>>       struct evsel *evsel, FILE *fp)
>> {
>> @@ -2026,6 +2032,7 @@ static int perf_sample__fprintf_synth(struct perf_sample *sample,
>> case PERF_SYNTH_INTEL_IFLAG_CHG:
>> return perf_sample__fprintf_synth_iflag_chg(sample, fp);
>> default:
> 
> Should just add something like:
> 
> case PERF_SYNTH_POWERPC_VPA_DTL:
> return perf_sample__fprintf_synth_vpadtl(sample, fp);

Ok Adrian

Will directly call perf_sample__fprintf_synth_vpadtl instead of having default call back

Thanks for all comments, I will post a V2 addressing the changes

Thanks
Athira
> 
>> + arch_perf_sample__fprintf_synth_evt(sample, fp, evsel->core.attr.config);
>> break;
>> }




More information about the Linuxppc-dev mailing list