instruments

Profile macOS applications with Instruments traces to analyze CPU, GPU, shader, and memory behavior.

20|2|Updated Mar 25, 2026
One-click install
npx skills add https://github.com/Kr1sso/xtrace-skill --skill instruments-kr1sso
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: instruments
Source: https://github.com/Kr1sso/xtrace-skill
Command: npx skills add https://github.com/Kr1sso/xtrace-skill --skill instruments-kr1sso

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Apple's Instruments is GUI-only and xctrace is raw and hard to use, leaving no simple path from a compiled binary to actionable CPU hotspots, GPU utilization, or memory leak reports from the terminal. ## Core Features & Use Cases - CPU Profiling: Record Time Profiler traces with xtrace, then analyze flat summaries, timelines, call trees, and before/after diffs with trace-analyze.py. - GPU & Shader Analysis: Capture Metal System Trace recordings, inspect GPU state residency, command buffers, shader hotspots, and generate shader flamegraphs or speedscope views. - Memory Analysis: Detect leaks, track memory growth over time, and inspect heap allocations with trace-memory.py. - Use Case: A developer builds a Metal app, runs xtrace --gpu --shader-timeline ./my_app, and immediately gets GPU utilization summaries plus interactive shader stack exploration in speedscope. ## Quick Start Profile my application by running xtrace on the built binary and show me the top CPU hotspots and a flamegraph.

Frequently Asked Questions about instruments

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I profile CPU usage of a macOS app from the command line?▼

Prefix any command with xtrace, for example `xtrace -d 10 ./my_app`, to record a Time Profiler trace and print a CPU summary. Then run trace-analyze.py summary, timeline, or calltree on the trace for deeper analysis.

How to generate a flamegraph from an Instruments trace?▼

Run trace-flamegraph.sh on the .trace file to produce an SVG flamegraph, or pipe the trace into trace-speedscope.sh for interactive analysis. It uses inferno or flamegraph.pl when installed, with a built-in SVG fallback.

Can xctrace record Metal GPU and shader profiling data?▼

Yes, use `xtrace --gpu` for Metal System Trace or add `--shader-timeline` to enable shader-profiler rows. Then trace-gpu.py reports GPU state and command buffers, while trace-shader.py extracts shader hotspots and callsites.

Does xtrace work on Intel Macs or only Apple Silicon?▼

xtrace works on both Apple Silicon and Intel Macs for standard templates like Time Profiler and Metal System Trace. Only the Processor Trace template requires Apple Silicon with Developer Tools enabled in System Settings.

Why does my Instruments trace show hex addresses instead of function names?▼

Missing function names mean the binary lacks debug symbols. Rebuild with symbols: `-g -O2` for C/C++, `swift build -c release -Xswiftc -g` for Swift, or `CARGO_PROFILE_RELEASE_DEBUG=true` for Rust.

Can I create a .gputrace file from the command line with xctrace?▼

No, xctrace and Instruments CLI only record .trace files. A .gputrace bundle requires host-app code calling MTLCaptureManager or capture via the Xcode Metal Debugger; trace-gputrace.py can then inspect the bundle.