Add new Trace Recording + Analysis functionality#59
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a bundled workflow for recording Xcode Instruments traces and performing multi-lane trace analysis (Time Profiler, Hangs, Animation Hitches, SwiftUI updates) with optional cross-lane correlations, plus skill/docs updates so the agent can trigger on .trace files and recording requests.
Changes:
- Add
record_trace.pyto wrapxctrace recordwith stop mechanisms and JSON discovery for devices/templates. - Add
analyze_trace.py+scripts/instruments_parser/*to export/parse trace schemas, compute lane summaries, and correlate hangs/hitches with main-thread samples and SwiftUI updates. - Add trace recording/analysis references and update
SKILL.mdrouting/trigger guidance; ignore Python__pycache__/.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| swiftui-expert-skill/scripts/record_trace.py | New CLI wrapper for xctrace record, device/template listing, stop-file + time-limit support |
| swiftui-expert-skill/scripts/analyze_trace.py | New CLI for trace analysis, discovery modes (logs/signposts), windowing, JSON/MD output |
| swiftui-expert-skill/scripts/instruments_parser/xml_utils.py | Streaming XML utilities + extraction helpers for row-oriented schema parsing |
| swiftui-expert-skill/scripts/instruments_parser/xctrace.py | Wrapper around xctrace export / TOC parsing |
| swiftui-expert-skill/scripts/instruments_parser/time_profiler.py | Time Profiler lane aggregation + per-sample retention for correlation |
| swiftui-expert-skill/scripts/instruments_parser/swiftui.py | SwiftUI lane parsing + per-view aggregation + severity breakdown |
| swiftui-expert-skill/scripts/instruments_parser/hangs.py | Hangs lane parsing + severity bucket metrics |
| swiftui-expert-skill/scripts/instruments_parser/hitches.py | Animation hitches lane parsing + narrative attribution metrics |
| swiftui-expert-skill/scripts/instruments_parser/events.py | Discovery helpers for os_log and os_signpost (for building analysis windows) |
| swiftui-expert-skill/scripts/instruments_parser/correlate.py | Cross-lane correlation logic (hangs/hitches ↔ main-thread samples ↔ SwiftUI overlaps) |
| swiftui-expert-skill/scripts/instruments_parser/summary.py | Markdown renderer for combined analysis output |
| swiftui-expert-skill/scripts/instruments_parser/init.py | Package marker/docstring |
| swiftui-expert-skill/references/trace-recording.md | New reference doc for trace recording workflows and template selection |
| swiftui-expert-skill/references/trace-analysis.md | New reference doc for analysis modes, JSON shape, and interpretation |
| swiftui-expert-skill/SKILL.md | Updates triggers/workflows to include trace recording + trace-driven improvement routing |
| .gitignore | Ignore Python __pycache__/ |
AvdLee
left a comment
There was a problem hiding this comment.
Looks pretty good to me! How about adding a README section to explain this specific part of the skill? Since it's kind of more unique to the other reference files, I think it would be beneficial on having a more detailed explanation.
Could also be a short README section and a more detailed DOCS/swiftui-performance.md file or something?
@AvdLee Good point! I have updated the README now, I think the |
Add a new trace recording and analysis functionality to the skill. This will let users: