Failed to display ftrace slice in perfetto UI

13 views
Skip to first unread message

史思远

unread,
Sep 19, 2025, 4:33:35 AMSep 19
to Perfetto Development - www.perfetto.dev
Hi, 

I tried to do as the guide 'Part C: Simple slice/counter visualisations without modifying perfetto code (kernel track events) - Thread-scoped slice tracks' said. But it doesn't show as expected. why?

史思远

unread,
Sep 19, 2025, 4:34:10 AMSep 19
to Perfetto Development - www.perfetto.dev
1. Android kernel(v5.4) modify
include/trace/events/kmem.h

TRACE_EVENT(page_fault_begin,

        TP_PROTO(
                bool speculative_fault,
                char track_event_type,
                const char *slice_name

        ),

        TP_ARGS(speculative_fault, track_event_type, slice_name),

        TP_STRUCT__entry(
                __field(        bool,   speculative_fault       )
                __field(        pid_t,  pid                     )
                __array(        char,   comm,   TASK_COMM_LEN   )  
                __field(char, track_event_type)
                __string(slice_name, slice_name)

        ),

        TP_fast_assign(
                __entry->speculative_fault = speculative_fault,
                __entry->pid    = current->pid;
                memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
                __entry->track_event_type = track_event_type;
                __assign_str(slice_name, slice_name);

        ),

        TP_printk("pid=%d comm=%s sp=%d type=%c slice_name=%s",
                __entry->pid, __entry->comm, __entry->speculative_fault,
                __entry->track_event_type, __get_str(slice_name))
);

+       trace_page_fault_begin(1 , 'B', "page_fault");
        fault = handle_speculative_fault(mm, addr, mm_flags, &vma);
+       trace_page_fault_begin(1 , 'E', "");

史思远

unread,
Sep 19, 2025, 4:34:30 AMSep 19
to Perfetto Development - www.perfetto.dev
2. perfetto config

data_sources: {
    config {
        name: "linux.ftrace"
        ftrace_config {
            symbolize_ksyms: true
            denser_generic_event_encoding: true
            disable_generic_events: false

            ...
            ftrace_events: "kmem/page_fault_begin"
            ...

史思远

unread,
Sep 19, 2025, 4:34:46 AMSep 19
to Perfetto Development - www.perfetto.dev
3. Use perfetto(latest v52) to trace.
Get pefetto file and its systrace file.

systrace snipet
 car.createagent-7804  ( 7804) [004] .... 3165.392915: page_fault_begin: comm=car.createagent pid=7804 speculative_fault=0 track_event_type=66 slice_name=page_fault
...
 car.createagent-7804  ( 7804) [004] .... 3165.392919: page_fault_begin: comm=car.createagent pid=7804 speculative_fault=0 track_event_type=69 slice_name=

史思远

unread,
Sep 19, 2025, 4:36:06 AMSep 19
to Perfetto Development - www.perfetto.dev
4. Open perfetto file in perfetto UI
I can't see the slice shown in thread scope(set ftrace filter only for thread car.createagent-7804), why?

史思远

unread,
Sep 19, 2025, 4:38:12 AMSep 19
to Perfetto Development - www.perfetto.dev


Screenshot from 2025-09-19 16-37-45.png

Lalit Maganti

unread,
Sep 19, 2025, 7:18:07 AMSep 19
to 史思远, Perfetto Development - www.perfetto.dev
Please link the trace which you're opening. It's quite hard for us to debug without that.

On Fri, 19 Sept 2025 at 09:38, 史思远 <shisiyua...@gmail.com> wrote:


Screenshot from 2025-09-19 16-37-45.png

--
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 visit https://groups.google.com/d/msgid/perfetto-dev/5e2a1389-5aab-4a18-92ba-73bdc1d52599n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages