instruments-profiling
Use when profiling native macOS or iOS apps with Instruments/xctrace. Covers correct binary selection, CLI arguments, exports, and common gotchas.
Security Assessment
About instruments-profiling
The 'instruments-profiling' skill is designed for profiling native macOS and iOS applications using Instruments and the xctrace command-line interface (CLI). It provides a streamlined approach for developers to analyze the performance of their apps, focusing on critical aspects like time profiling, capturing trace data, and ensuring the correct binary is selected for profiling. This skill helps identify bottlenecks in app performance, monitor resource consumption, and offer insights into stack analysis, aiding in optimization efforts. It is an essential tool for debugging and improving performance during development and testing.
FAQ
How do I record a Time Profiler trace with xctrace?
You can record a Time Profiler trace by running the following command: `xcrun xctrace record --template 'Time Profiler' --time-limit 60s --output /tmp/App.trace --launch -- /path/To/App.app`. This will launch the app and record its performance for 60 seconds.
How do I ensure the correct app is being profiled?
To ensure the correct app is being profiled, it's important to specify the direct binary path when using the `--launch` option. For example: `xcrun xctrace record --launch -- /path/App.app/Contents/MacOS/App`. Also, verify the process path using `ps -p <pid> -o comm= -o command=`.
What are common issues when using xctrace for profiling?
Common issues include profiling the wrong app due to LaunchServices resolving a different bundle, having no samples due to the app exiting too quickly, and running into privacy prompts requiring Developer Tools permissions. Each of these can be addressed with the suggested fixes in the documentation.
Install instruments-profiling
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
steipete/agent-scripts