filtering to trace a single process

27 views
Skip to first unread message

Jon Lui

unread,
Jan 13, 2025, 2:22:21 AMJan 13
to Perfetto Development - www.perfetto.dev
Hi all, 

Is it possible to trace a specific process from userspace till kernel space including CPU/GPU the entire shebang via the config file? I am a multithreaded application to encode 5 videos on 5 threads. The entire lifecycle takes around 20s to complete. If i enable enable_function_graph in ftrace, the log grows very big and I am OK to limit the collection to 1s. 

I am currently running on Linux on Intel platform. Please advice the configurations i need to apply in the config file. I understand there is already a scan_all_processes_on_start but i am hoping to limit it to a single process instead of a single trigger

Thanks.

Primiano Tucci

unread,
Jan 13, 2025, 7:55:22 AMJan 13
to Jon Lui, Perfetto Development - www.perfetto.dev
enable_function_graph is very expensive as you found out.
THere is no native way to filter it to a process. THe best you can do is to use function_filters or function_graph_roots to limit the funcgrph to some known functions.

I would really recommend to use long-tracing mode, like this

duration_ms: 20000
write_into_file: true
file_write_period_ms: 1000

This will read the buffers every 1s and write the contents into the file. Should allow you to get 20s of data.

The other thing you can do is to put the funcgraph in another buffer, by doing something like this

1. Create two buffer sections:

buffers {
  size_kb: 65536
}
buffers {
  # This is for ftrace/funcgraph
  size_kb: 65536
}

And then in the "linux.ftrace" data source say target_buffer:1 (They are 0-indexed, so 1 is the 2nd)

data_sources {
  config {
    name: "linux.ftrace"
    target_buffer: 1
    ftrace_config {
      enable_function_graph: true
    }
  }
}


--
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/997e97e8-2428-4455-8634-e3c12f0bfe44n%40googlegroups.com.


--
Primiano Tucci
Software Engineer
Google UK Limited

Reply all
Reply to author
Forward
0 new messages