native-app-performance
Native macOS/iOS app performance profiling via xctrace and CLI-based hotspot analysis without opening the Instruments UI.
Introduction
This skill provides a streamlined, command-line interface for performance profiling of native macOS and iOS applications. It is designed for engineers who need to capture performance data and identify performance bottlenecks or hotspots without the overhead of the graphical Instruments application. By utilizing Apple's xctrace utility, the agent can programmatically attach to running processes or launch applications to record Time Profiler data, which is then parsed and analyzed using custom Python scripts to provide actionable insights into application execution patterns.
-
Capture high-fidelity Time Profiler traces using xcrun xctrace to monitor CPU usage and thread activity.
-
Support for both direct process launching and attaching to existing process IDs (PIDs) for flexible profiling scenarios.
-
Automated extraction and conversion of binary .trace files into human-readable XML time samples.
-
Symbolication and ranking of hotspots using load address extraction via vmmap, allowing developers to correlate samples with specific source code functions.
-
Integration with CLI tools to maintain a purely terminal-based workflow, ideal for CI/CD environments, remote debugging, or automated performance regression testing.
-
Ensure that binary paths provided to the tool match the exact version of the application being profiled to avoid symbolication mismatches.
-
Always account for Address Space Layout Randomization (ASLR) by obtaining the runtime __TEXT segment load address using vmmap during the active trace session.
-
Focus capture periods on specific user interactions like UI transitions, menu events, or data processing cycles to avoid noise from idle application states.
-
Verify that the target binary contains appropriate debug symbols; use standard dSYM files if necessary to enhance the accuracy of the top_hotspots.py script output.
-
Typical outputs include ranked lists of method calls and function stacks, enabling rapid identification of heavy computation or blocking operations within the native codebase.
Repository Stats
- Stars
- 312
- Forks
- 46
- Open Issues
- 1
- Language
- Vim Script
- Default Branch
- main
- Sync Status
- Idle
- Last Synced
- Apr 29, 2026, 06:53 AM