[PATCH 12/14] tools/perf: Add support for printing synth event details via default callback
Athira Rajeev
atrajeev at linux.ibm.com
Fri Aug 15 18:34:05 AEST 2025
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.
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:
+ arch_perf_sample__fprintf_synth_evt(sample, fp, evsel->core.attr.config);
break;
}
--
2.47.1
More information about the Linuxppc-dev
mailing list