From: Athira Rajeev <atrajeev@linux.ibm.com>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Jiri Olsa <jolsa@kernel.org>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Ian Rogers <irogers@google.com>,
Namhyung Kim <namhyung@kernel.org>,
"open list:PERFORMANCE EVENTS SUBSYSTEM"
<linux-perf-users@vger.kernel.org>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
Aboorva Devarajan <aboorvad@linux.ibm.com>,
Shrikanth Hegde <sshegde@linux.ibm.com>,
hbathini@linux.vnet.ibm.com,
Aditya Bodkhe <Aditya.Bodkhe1@ibm.com>,
Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Subject: Re: [PATCH V2 6/6] tools/perf: Enable perf script to present the DTL entries
Date: Tue, 16 Sep 2025 10:08:11 +0530 [thread overview]
Message-ID: <A25D4BF6-6929-4522-A1DB-AE927AAF2735@linux.ibm.com> (raw)
In-Reply-To: <744d4dcd-c8dd-4335-8e3a-a81adda36b57@intel.com>
> On 15 Sep 2025, at 8:39 PM, Adrian Hunter <adrian.hunter@intel.com> wrote:
>
> On 15/09/2025 10:27, Athira Rajeev wrote:
>> 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. Introduce perf_sample__fprintf_synth_vpadtl()
>> and invoke this for PERF_SYNTH_POWERPC_VPA_DTL
>>
>> Sample output:
>>
>> ./perf record -a -e sched:*,vpa_dtl/dtl_all/ -c 1000000000 sleep 1
>> [ perf record: Woken up 1 times to write data ]
>> [ perf record: Captured and wrote 0.300 MB perf.data ]
>>
>> ./perf script
>> perf 13322 [002] 233.835807: sched:sched_switch: perf:13322 [120] R ==> migration/2:27 [0]
>> migration/2 27 [002] 233.835811: sched:sched_migrate_task: comm=perf pid=13322 prio=120 orig_cpu=2 dest_cpu=3
>> migration/2 27 [002] 233.835818: sched:sched_stat_runtime: comm=migration/2 pid=27 runtime=9214 [ns]
>> migration/2 27 [002] 233.835819: sched:sched_switch: migration/2:27 [0] S ==> swapper/2:0 [120]
>> swapper 0 [002] 233.835822: vpa-dtl: timebase: 338954486062657 dispatch_reason:decrementer_interrupt, preempt_reason:H_CEDE, enqueue_to_dispatch_time:435, ready_to_enqueue_time:0, waiting_to_ready_time:34775058, processor_id: 202 c0000000000f8094 plpar_hcall_norets_notrace+0x18 ([kernel.kallsyms])
>> swapper 0 [001] 233.835886: vpa-dtl: timebase: 338954486095398 dispatch_reason:priv_doorbell, preempt_reason:H_CEDE, enqueue_to_dispatch_time:542, ready_to_enqueue_time:0, waiting_to_ready_time:1245360, processor_id: 201 c0000000000f8094 plpar_hcall_norets_notrace+0x18 ([kernel.kallsyms])
>>
>> Signed-off-by: Athira Rajeev <atrajeev@linux.ibm.com>
>> ---
>> Changelog:
>> Addressed review comments from Adrian
>> - Removed default callback and used perf_sample__fprintf_synth_vpadtl
>> - fix build failure when using NO_AUXTRACE=1 by
>> adding code around HAVE_AUXTRACE_SUPPORT
>>
>> tools/perf/builtin-script.c | 27 +++++++++++++++++++++++++++
>> tools/perf/util/event.h | 3 +++
>> 2 files changed, 30 insertions(+)
>>
>> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
>> index d9fbdcf72f25..8a03fdbfce5e 100644
>> --- a/tools/perf/builtin-script.c
>> +++ b/tools/perf/builtin-script.c
>> @@ -43,6 +43,7 @@
>> #include <linux/stringify.h>
>> #include <linux/time64.h>
>> #include <linux/zalloc.h>
>> +#include <linux/unaligned.h>
>> #include <sys/utsname.h>
>> #include "asm/bug.h"
>> #include "util/mem-events.h"
>> @@ -2003,6 +2004,30 @@ static int perf_sample__fprintf_synth_iflag_chg(struct perf_sample *sample, FILE
>> return len + perf_sample__fprintf_pt_spacing(len, fp);
>> }
>>
>> +#ifdef HAVE_AUXTRACE_SUPPORT
>> +static int perf_sample__fprintf_synth_vpadtl(struct perf_sample *data, FILE *fp)
>> +{
>> + struct powerpc_vpadtl_entry *dtl = (struct powerpc_vpadtl_entry *)data->raw_data;
>> +
>> + fprintf(fp, "timebase: %" PRIu64 " dispatch_reason:%s, preempt_reason:%s,\n"
>> + "enqueue_to_dispatch_time:%d, ready_to_enqueue_time:%d, waiting_to_ready_time:%d, processor_id: %d",\
>
> Unnecessary line continuation, also line length exceeds 100 columns
>
>> + get_unaligned_be64(&dtl->timebase),
>> + dispatch_reasons[dtl->dispatch_reason],
>> + preempt_reasons[dtl->preempt_reason],
>> + be32_to_cpu(dtl->enqueue_to_dispatch_time),
>> + be32_to_cpu(dtl->ready_to_enqueue_time),
>> + be32_to_cpu(dtl->waiting_to_ready_time),
>> + be16_to_cpu(dtl->processor_id));
>> +
>> + return 1;
>
> Other __fprintf_*() are returning the number of char printed.
Will send a V3 with this change
Thanks
Athira
>
>> +}
>> +#else
>> +static int perf_sample__fprintf_synth_vpadtl(struct perf_sample *data __maybe_unused, FILE *fp __maybe_unused)
>> +{
>> + return 0;
>> +}
>> +#endif
>> +
>> static int perf_sample__fprintf_synth(struct perf_sample *sample,
>> struct evsel *evsel, FILE *fp)
>> {
>> @@ -2025,6 +2050,8 @@ static int perf_sample__fprintf_synth(struct perf_sample *sample,
>> return perf_sample__fprintf_synth_evt(sample, fp);
>> case PERF_SYNTH_INTEL_IFLAG_CHG:
>> return perf_sample__fprintf_synth_iflag_chg(sample, fp);
>> + case PERF_SYNTH_POWERPC_VPA_DTL:
>> + return perf_sample__fprintf_synth_vpadtl(sample, fp);
>> default:
>> break;
>> }
>> diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
>> index 7e0e58979e9c..64c63b59d617 100644
>> --- a/tools/perf/util/event.h
>> +++ b/tools/perf/util/event.h
>> @@ -271,6 +271,9 @@ struct powerpc_vpadtl_entry {
>> u64 srr1;
>> };
>>
>> +extern const char *dispatch_reasons[11];
>> +extern const char *preempt_reasons[10];
>> +
>> static inline void *perf_synth__raw_data(void *p)
>> {
>> return p + 4;
next prev parent reply other threads:[~2025-09-16 4:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-15 7:27 [PATCH V2 0/6] perf/tools: Add interface to expose vpa dtl counters via Athira Rajeev
2025-09-15 7:27 ` [PATCH V2 1/6] tools/perf: Add basic CONFIG_AUXTRACE support for VPA pmu on powerpc Athira Rajeev
2025-09-15 15:07 ` Adrian Hunter
2025-09-16 4:37 ` Athira Rajeev
2025-09-15 7:27 ` [PATCH V2 2/6] tools/perf: process auxtrace events and display in perf report -D Athira Rajeev
2025-09-15 15:08 ` Adrian Hunter
2025-09-16 4:37 ` Athira Rajeev
2025-09-15 7:27 ` [PATCH V2 3/6] tools/perf: Add event name as vpa-dtl of PERF_TYPE_SYNTH type to present DTL samples Athira Rajeev
2025-09-15 7:27 ` [PATCH V2 4/6] tools/perf: Allocate and setup aux buffer queue to help co-relate with other events across CPU's Athira Rajeev
2025-09-15 15:08 ` Adrian Hunter
2025-09-16 4:37 ` Athira Rajeev
2025-09-15 7:27 ` [PATCH V2 5/6] tools/perf: Process the DTL entries in queue and deliver samples Athira Rajeev
2025-09-15 15:08 ` Adrian Hunter
2025-09-15 7:27 ` [PATCH V2 6/6] tools/perf: Enable perf script to present the DTL entries Athira Rajeev
2025-09-15 15:09 ` Adrian Hunter
2025-09-16 4:38 ` Athira Rajeev [this message]
2025-09-15 16:07 ` [PATCH V2 0/6] perf/tools: Add interface to expose vpa dtl counters via Venkat
2025-09-18 6:31 ` Athira Rajeev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=A25D4BF6-6929-4522-A1DB-AE927AAF2735@linux.ibm.com \
--to=atrajeev@linux.ibm.com \
--cc=Aditya.Bodkhe1@ibm.com \
--cc=aboorvad@linux.ibm.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=hbathini@linux.vnet.ibm.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=namhyung@kernel.org \
--cc=sshegde@linux.ibm.com \
--cc=venkat88@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).