Skip to content

Add new Trace Recording + Analysis functionality#59

Merged
AvdLee merged 7 commits into
AvdLee:mainfrom
polpielladev:swiftui-performance-improvements
Apr 22, 2026
Merged

Add new Trace Recording + Analysis functionality#59
AvdLee merged 7 commits into
AvdLee:mainfrom
polpielladev:swiftui-performance-improvements

Conversation

@polpielladev
Copy link
Copy Markdown
Contributor

@polpielladev polpielladev commented Apr 20, 2026

Add a new trace recording and analysis functionality to the skill. This will let users:

  • Record instruments sessions
  • Analyze traces
  • Come up with plans to improve and fix performance

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py to wrap xctrace record with 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.md routing/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__/

Comment thread swiftui-expert-skill/scripts/record_trace.py Outdated
Comment thread swiftui-expert-skill/scripts/record_trace.py
Comment thread swiftui-expert-skill/scripts/record_trace.py Outdated
Comment thread swiftui-expert-skill/scripts/instruments_parser/xml_utils.py Outdated
Comment thread swiftui-expert-skill/scripts/instruments_parser/xml_utils.py Outdated
Comment thread swiftui-expert-skill/scripts/instruments_parser/summary.py
Comment thread swiftui-expert-skill/scripts/analyze_trace.py
@polpielladev polpielladev marked this pull request as ready for review April 22, 2026 12:40
@AvdLee AvdLee requested a review from EngOmarElsayed April 22, 2026 13:16
Copy link
Copy Markdown
Owner

@AvdLee AvdLee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@polpielladev
Copy link
Copy Markdown
Contributor Author

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 swiftui-performance.md is already covered by the trace-analysis.md and trace-recording.md if people want to do a deep dive into it. I wouldn't add a separate md file for performance, I think this should be enough imo and reduces things to maintain.

@polpielladev polpielladev requested a review from AvdLee April 22, 2026 13:42
@AvdLee AvdLee merged commit bd0d8ba into AvdLee:main Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants