Is that possible to profile a Linux-kernel base OS boot time with Perfetto?

9 views
Skip to first unread message

simowce go

unread,
Jul 31, 2025, 4:05:50 AMJul 31
to Perfetto Development - www.perfetto.dev
Hi all:

Currently I'm working on a Linux-kernel base OS (not Android), and it starts up very slowly. I want to profile it.

I found that perfetto can trace Android device boot, so I wonder Is that possible to profile a Linux-kernel base OS boot time with Perfetto?

Thanks.

Primiano Tucci

unread,
Jul 31, 2025, 7:37:40 AMJul 31
to simowce go, Perfetto Development - www.perfetto.dev
depends on your definition of "boot".
Boot as in from when the kernel starts, to when userspace is ready: 
- use the kernel cmdline to setup ftrace (https://docs.kernel.org/trace/boottime-trace.html)
- write a matching perfetto config and start it later on when userspace is ready (you need to enable the same categories you passed to trace_event on the kernel cmdline)
- Set the preserve_ftrace_buffer: true in the trace config, which will read the existing trace buffer

This will allow you to do kernel-only tracing before boot.
If you want other forms of userspace tracing, you'll have to figure out ways to start perfetto early enough, maybe by starting in initird or something similar.

BUt for your stated purposes, the kernel-only tracing might work
Primiano

--
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/8f05139f-a457-4f42-9a98-67c078790f41n%40googlegroups.com.


--
Primiano Tucci
Software Engineer
Google UK Limited

Reply all
Reply to author
Forward
0 new messages