-
Notifications
You must be signed in to change notification settings - Fork 63
[support bundle] Add perfetto tracing to bundle collection #9482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
hawkw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nice, this rocks!
| json!({ | ||
| "name": step.name, | ||
| "cat": "bundle_collection", | ||
| "ph": "X", // Complete event (has duration) | ||
| "ts": start_us, | ||
| "dur": duration_us, | ||
| "pid": 1, | ||
| "tid": step_id, | ||
| "args": { | ||
| "status": step.status.to_string(), | ||
| } | ||
| }) | ||
| }) | ||
| .collect(); | ||
|
|
||
| let trace_json = json!({ | ||
| "traceEvents": trace_events, | ||
| "displayTimeUnit": "ms", | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a blocker but: i wonder if we might at some point want a struct deriving serde::Serialize for this, perhaps not in the support bundle collector module, so that we can emit similar Perfetto traces for other operations...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started with pulling this into a sub-module that's local to support bundles in 4714a78 - but happy to pull this out more broadly as a follow-up?
(I'm gonna probably break up this support bundle code into some smaller modules in a follow-up PR)
This is the last step of bundle collection: turn all bundle collection steps into a perfetto-formatted trace file, and stash it in "meta/trace.json".
The cost here is small, and this allows us to easily inspect bundle collection time.
Example output, visualized at ui.perfetto.dev: