View and analyze Apple Instruments .trace files using xctrace. Use when asked to inspect trace contents, export profiling data, extract Time Profiler samples, Allocations, SwiftUI metrics, or any Instruments-recorded data to XML format.
42:Ta92,
xctrace export --input /path/to/recording.trace --toc
The TOC XML reveals available runs, schema names, and processes.
Extract tables using schema names from the TOC:
xctrace export --input recording.trace \
--xpath '/trace-toc/run[@number="1"]/data/table[@schema="time-sample"]' \
--output samples.xml
Common schemas: time-sample, allocation, leak, os-signpost, http-transaction
When stack traces show addresses instead of function names:
xctrace symbolicate --input recording.trace --dsym /path/to/MyApp.dSYM
dSYM locations: ~/Library/Developer/Xcode/Archives/, DerivedData/<project>/Build/Products/
| Command | Purpose |
|---|---|
xctrace export --input <file> --toc | List all tables and schemas |
xctrace export --input <file> --xpath '<expr>' | Extract specific data |
xctrace export --input <file> --har --output <file>.har | Export network data as HAR |
xctrace symbolicate --input <file> --dsym <path> | Add symbol names to traces |
<trace-toc>
<run number="1">
<data>
<table schema="time-sample" />
<table schema="allocation" />
</data>
<processes>
<process name="MyApp" pid="12345">
<binary name="MyApp" UUID="..." />
</process>
</processes>
</run>
</trace-toc>
# All data from a table
--xpath '/trace-toc/run[@number="1"]/data/table[@schema="<schema>"]'
# Process binaries
--xpath '/trace-toc/run[@number="1"]/processes/process[@name="MyApp"]/binary'
# All runs
--xpath '/trace-toc/run/data/table[@schema="time-sample"]'
Consult these for detailed XPath patterns and output interpretation:
references/time-profiler.mdreferences/allocations.mdreferences/leaks.mdreferences/swiftui.mdreferences/app-launch.mdreferences/network.mdreferences/file-activity.mdreferences/metal-system-trace.mdreferences/cpu-counters.mdreferences/signposts-poi.mddwarfdump --uuid MyApp.dSYM