@@ -12,8 +12,8 @@ tracebox ctl start
1212tracebox -t 10s -o trace.pftrace sched freq
1313tracebox ctl stop
1414
15- # Self-contained mode (legacy )
16- tracebox --legacy -t 10s -o trace.pftrace sched
15+ # Autodaemonize mode (self-contained )
16+ tracebox --autodaemonize -t 10s -o trace.pftrace sched
1717
1818# Invoke bundled applets
1919tracebox [applet_name] [args ...]
@@ -24,15 +24,9 @@ tracebox [applet_name] [args ...]
2424` tracebox ` bundles the Perfetto tracing service (` traced ` ), system probes
2525(` traced_probes ` ), and the ` perfetto ` command-line client into a single binary.
2626
27- ** Behavior change (2025):** ` tracebox ` now requires daemons to be running before
28- capturing traces. Use ` tracebox ctl ` to manage daemons, or ` --legacy ` for
29- the legacy self-contained mode.
30-
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.
27+ ** Update (2025):** ` tracebox ` now prefers daemons to be managed explicitly via
28+ ` tracebox ctl ` for better SDK compatibility and performance. The classic
29+ self-contained behavior is still available via the ` --autodaemonize ` flag.
3630
3731## DAEMON MANAGEMENT
3832
@@ -74,29 +68,24 @@ If systemd service files are detected:
7468- As root: ` ctl start ` uses ` systemctl start traced traced-probes `
7569- As user: Instructs to use ` sudo systemctl start traced traced-probes `
7670
77- ## LEGACY SELF-CONTAINED MODE
71+ ## AUTODAEMONIZE MODE
7872
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.
73+ The ` --autodaemonize ` flag (formerly default behavior) spawns temporary daemons for the
74+ duration of a single trace session. This mode uses private, temporary sockets
75+ and is fully self-contained.
8276
8377** When to use:**
84- - For quick one-off traces where you don't want to manage daemons .
78+ - For quick one-off traces where setup simplicity is prioritized over performance .
8579- 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 .
80+ - For existing scripts or workflows that expect self-contained execution .
8781
88- ** Limitations:**
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).
82+ ** Note:** SDK-instrumented apps (using ` track_event ` ) may fail to connect to
83+ these temporary daemons due to private socket usage. For SDK tracing, the
84+ ` tracebox ctl ` workflow is strongly recommended.
9685
9786** Example:**
9887``` bash
99- tracebox --legacy -t 10s -o trace.pftrace sched freq
88+ tracebox --autodaemonize -t 10s -o trace.pftrace sched freq
10089```
10190
10291## APPLET MODE
@@ -130,7 +119,7 @@ tracebox ctl status # Check daemon status
130119
131120If daemons aren't running:
132121- Use ` tracebox ctl start ` to start them
133- - Or use ` --legacy ` for self-contained mode
122+ - Or use ` --autodaemonize ` for self-contained mode
134123
135124### Permission denied
136125
@@ -158,56 +147,24 @@ sudo systemctl stop traced traced-probes
158147tracebox ctl start
159148```
160149
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.
150+ ## CHOOSING A WORKFLOW
151+
152+ ` tracebox ` supports two main workflows. Choose the one that best fits your needs.
153+
154+ ### Option A: Persistent Daemons (Recommended)
155+ Best for: SDK tracing, repeated tracing, system-wide analysis.
156+
157+ 1 . Start daemons once: ` tracebox ctl start `
158+ 2 . Record traces: ` tracebox -t 10s ... `
159+ 3 . Stop (optional): ` tracebox ctl stop `
160+
161+ ### Option B: Autodaemonize Mode
162+ Best for: Quick ftrace-only debugging, scripts requiring self-contained binaries.
163+
164+ 1 . Record trace: ` tracebox --autodaemonize -t 10s ... `
165+
166+ This mode behaves like older ` tracebox ` versions, spawning temporary daemons
167+ for the duration of the command.
211168
212169## SEE ALSO
213170
0 commit comments