QCOM kgsl/gpu_frequency ftrace events

467 views
Skip to first unread message

yan eric

unread,
Feb 15, 2022, 9:44:56 PM2/15/22
to Perfetto Development - www.perfetto.dev
Hi everyone,
    On latest Android 12 QCOM8350 platform, there seems to be no power/gpu_frequency event under /sys/kernel/tracing/events/, only kgsl/gpu_frequency, the format of this ftrace event is as follows.

# cat /sys/kernel/tracing/events/kgsl/gpu_frequency/format
name: gpu_frequency
ID: 655
format:
        field:unsigned short common_type;       offset:0;       size:2; signed:0;
        field:unsigned char common_flags;       offset:2;       size:1; signed:0;
        field:unsigned char common_preempt_count;       offset:3;       size:1; signed:0;
        field:int common_pid;   offset:4;       size:4; signed:1;

        field:unsigned int gpu_freq;    offset:8;       size:4; signed:0;
        field:unsigned int gpu_id;      offset:12;      size:4; signed:0;

print fmt: "gpu_freq=%luKhz gpu_id=%lu", (unsigned long)REC->gpu_freq, (unsigned long)REC->gpu_id
---------------------------------------
tracing events:
 pe...@2.2-servic-1300    [005] .... 80250.715072: gpu_frequency: gpu_freq=540000Khz gpu_id=0
   kworker/X26:1-25555   [000] .N.. 80250.776064: gpu_frequency: gpu_freq=491000Khz gpu_id=0

How can we simply add this gpu freq event support without changing on-device binaries (traced/traced_probes/perfetto) ?

Lalit Maganti

unread,
Feb 16, 2022, 8:32:04 AM2/16/22
to yan eric, Perfetto Development - www.perfetto.dev
Hi Yan,


Unfortunately, generic events are only not really ingested in trace processor at the moment (they're only used to allow conversion back to systrace) and we have no plans to add support for this ourselves.

However, if this is a usecase which is important to you, I'd suggest sending a couple of patches:
1. Add the above format file to allow Perfetto to collect these events natively in future Android versions (generic events are very inefficient so I'd strongly recommend doing this if you can) and add parsing support for this.
2. Add parsing for gpu_frequency encoded as generic events (which will allow ingesting these events without changing binaries on device)

The process for contributing can be found on our documentation website: https://perfetto.dev/docs/contributing/getting-started

Thanks,
Lalit

--
You received this message because you are subscribed to the Google Groups "Perfetto Development - www.perfetto.dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to perfetto-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/perfetto-dev/ffdbec60-49bc-41bd-b887-aca889419288n%40googlegroups.com.

Primiano Tucci

unread,
Feb 16, 2022, 9:01:54 AM2/16/22
to yan eric, Perfetto Development - www.perfetto.dev

Hi.

> How can we simply add this gpu freq event support without changing on-device binaries (traced/traced_probes/perfetto) ?

TBH changing on-device binaries would be the easy route. It's not hard,  see https://perfetto.dev/docs/contributing/common-tasks#add-a-new-ftrace-event

Perfetto has also a way to record events that are not known at compile time via "generic events" (this proto) but they are more expensive in terms of trace bandwidth, as the key names are recorded every time.
Also they are likely to work only on userdebug images (you'll need a vendor-side sepolicy change to allow them on user builds).

For using generic events, you can send a patch to trace_processor (the off-device trace engine used in the UI) and parse those events in the same way we do for power/gpu_frequency.

Primiano

On Wed, 16 Feb 2022 at 02:45, 'yan eric' via Perfetto Development - www.perfetto.dev <perfet...@googlegroups.com> wrote:
--
You received this message because you are subscribed to the Google Groups "Perfetto Development - www.perfetto.dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to perfetto-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/perfetto-dev/ffdbec60-49bc-41bd-b887-aca889419288n%40googlegroups.com.


--
Primiano Tucci
Software Engineer
Google UK Limited

yan eric

unread,
Feb 17, 2022, 3:06:10 AM2/17/22
to Perfetto Development - www.perfetto.dev
Thanks a lot for your quick and detailed response.
Reply all
Reply to author
Forward
0 new messages