Instruments profiling

From mouadja02/skills · View interactive version

Instruments profiling is an AI agent skill from the GitHub repository mouadja02/skills. Profiles macOS and iOS apps with Instruments and xctrace: choosing templates such as Time Profiler, launching binaries with arguments, recording traces, and exporting results. Use when a Mac or iOS app needs CPU, memory, or responsiveness profiling.

How to use this skill

Skill file

Instruments Profiling (macOS/iOS)

Attribution: Sourced from steipete/agent-scripts by Peter Steinberger.

Use this skill when the user wants performance profiling or stack analysis for native apps.

Focus: Time Profiler, xctrace CLI, and picking the correct binary/app instance.

Related skill: For CLI-only hotspot analysis without opening Instruments, see native-app-performance.

When to Use

# List templates
xcrun xctrace list templates

# Record Time Profiler (launch)
xcrun xctrace record --template 'Time Profiler' --time-limit 60s --output /tmp/App.trace --launch -- /path/To/App.app

# Record Time Profiler (attach)
xcrun xctrace record --template 'Time Profiler' --time-limit 60s --output /tmp/App.trace --attach <pid>

# Open trace in Instruments
open -a Instruments /tmp/App.trace

Note: xcrun xctrace --help is not a valid subcommand. Use xcrun xctrace help record.

Picking the Correct Binary (Critical)

Gotcha: Instruments may profile the wrong app (e.g., one in /Applications) if LaunchServices resolves a different bundle.

Command Arguments

Exporting Stacks (CLI)

# Inspect trace tables
xcrun xctrace export --input /tmp/App.trace --toc

# Export raw time-profile samples
xcrun xctrace export --input /tmp/App.trace \
  --xpath '/trace-toc/run[@number="1"]/data/table[@schema="time-profile"]' \
  --output /tmp/time-profile.xml

Instruments UI Workflow

Gotchas & Fixes

iOS Specific Notes

Verification Checklist

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.