@@ -13,7 +13,7 @@ tracebox -t 10s -o trace.pftrace sched freq
1313tracebox ctl stop
1414
1515# Self-contained mode (legacy)
16- tracebox --autodaemonize -t 10s -o trace.pftrace sched
16+ tracebox --legacy -t 10s -o trace.pftrace sched
1717
1818# Invoke bundled applets
1919tracebox [applet_name] [args ...]
@@ -25,9 +25,15 @@ tracebox [applet_name] [args ...]
2525(` traced_probes ` ), and the ` perfetto ` command-line client into a single binary.
2626
2727** Behavior change (2025):** ` tracebox ` now requires daemons to be running before
28- capturing traces. Use ` tracebox ctl ` to manage daemons, or ` --autodaemonize ` for
28+ capturing traces. Use ` tracebox ctl ` to manage daemons, or ` --legacy ` for
2929the legacy self-contained mode.
3030
31+ If you are a user of ` tracebox ` in its default mode (i.e., you don't use
32+ ` --legacy ` ), you should read the migration guide below. The new default
33+ behavior provides a more robust and predictable experience, especially for
34+ processes instrumented with the Perfetto SDK, but it requires a small change to
35+ your workflow.
36+
3137## DAEMON MANAGEMENT
3238
3339### tracebox ctl start [ --log]
@@ -68,18 +74,29 @@ If systemd service files are detected:
6874- As root: ` ctl start ` uses ` systemctl start traced traced-probes `
6975- As user: Instructs to use ` sudo systemctl start traced traced-probes `
7076
71- ## SELF-CONTAINED MODE
77+ ## LEGACY SELF-CONTAINED MODE
78+
79+ The ` --legacy ` flag preserves the legacy behavior of ` tracebox ` where it
80+ spawns temporary daemons for the duration of a single trace session. This mode
81+ uses private, temporary sockets and is fully self-contained.
7282
73- The ` --autodaemonize ` flag spawns temporary daemons for a single trace session.
83+ ** When to use:**
84+ - For quick one-off traces where you don't want to manage daemons.
85+ - If you cannot or do not want to run persistent background daemons.
86+ - For scripts that rely on the old behavior and haven't been migrated yet.
7487
7588** Limitations:**
76- - SDK-instrumented apps won't connect (uses private sockets)
77- - Inefficient for multiple traces
78- - Not recommended for regular use
89+ - ** SDK Incompatibility:** Processes instrumented with the Perfetto SDK (e.g.
90+ using ` track_event ` ) will generally fail to connect to these temporary daemons
91+ because they listen on private, unpredictable socket addresses.
92+ - ** Inefficiency:** Spawns and kills daemons for every trace, which is slower
93+ for repeated tracing.
94+ - ** Concurrency:** Running multiple instances of ` tracebox --legacy `
95+ concurrently can lead to resource conflicts (e.g. with ftrace).
7996
8097** Example:**
8198``` bash
82- tracebox --autodaemonize -t 10s -o trace.pftrace sched freq
99+ tracebox --legacy -t 10s -o trace.pftrace sched freq
83100```
84101
85102## APPLET MODE
@@ -113,7 +130,7 @@ tracebox ctl status # Check daemon status
113130
114131If daemons aren't running:
115132- Use ` tracebox ctl start ` to start them
116- - Or use ` --autodaemonize ` for self-contained mode
133+ - Or use ` --legacy ` for self-contained mode
117134
118135### Permission denied
119136
@@ -141,23 +158,56 @@ sudo systemctl stop traced traced-probes
141158tracebox ctl start
142159```
143160
144- ## MIGRATION
145-
146- ** Old (before 2025):**
147- ``` bash
148- tracebox -t 10s -o trace.pftrace sched
149- ```
150-
151- ** New (recommended):**
152- ``` bash
153- tracebox ctl start
154- tracebox -t 10s -o trace.pftrace sched
155- ```
156-
157- ** New (backward compatible):**
158- ``` bash
159- tracebox --autodaemonize -t 10s -o trace.pftrace sched
160- ```
161+ ## MIGRATION GUIDE (2025)
162+
163+ The default behavior of ` tracebox ` has changed to require explicit daemon
164+ management. This change resolves long-standing issues with SDK connectivity and
165+ provides a more consistent experience.
166+
167+ ### Why the change?
168+ In the old model, ` tracebox ` would silently spawn "ephemeral" daemons on private
169+ sockets. This often confused users because apps instrumented with the Perfetto
170+ SDK (e.g., Chrome, or your own apps) would fail to connect to these hidden
171+ daemons, resulting in traces missing all userspace data. The new model ensures
172+ daemons run on standard system sockets where SDK apps can find them.
173+
174+ ### Migration Steps
175+
176+ ** Scenario 1: You run interactive traces manually**
177+
178+ * ** Old way:**
179+ ``` bash
180+ tracebox -t 10s -o trace.pftrace sched
181+ ```
182+ * ** New way (Recommended):**
183+ Run this once per boot (or when needed):
184+ ` ` ` bash
185+ tracebox ctl start
186+ ` ` `
187+ Then run your traces as usual:
188+ ` ` ` bash
189+ tracebox -t 10s -o trace.pftrace sched
190+ ` ` `
191+ When done (optional):
192+ ` ` ` bash
193+ tracebox ctl stop
194+ ` ` `
195+
196+ ** Scenario 2: You have scripts that wrap tracebox**
197+
198+ * ** Option A (Better):** Update your scripts to ensure daemons are running
199+ using ` tracebox ctl start` before tracing.
200+ * ** Option B (Faster fix):** Update your scripts to use the ` --legacy`
201+ flag to restore the old behavior.
202+ ` ` ` bash
203+ tracebox --legacy -t 10s -o trace.pftrace sched
204+ ` ` `
205+
206+ ** Scenario 3: You are tracing SDK-instrumented apps**
207+
208+ You ** must** use the new explicit daemon mode. The legacy ` --legacy` mode
209+ will likely not work because your app won' t be able to discover the temporary
210+ sockets.
161211
162212## SEE ALSO
163213
0 commit comments