Measure Wine and macOS programs' GPU use on Apple silicon with Metal System Trace, from the shell or an MCP client
pip install metal-gpu-trace Copy PIP instructions
Measure how a Wine or macOS program uses the GPU on an Apple silicon Mac, from the command line or through an AI coding agent: GPU time per frame, frame pacing, FPS and memory, recorded with Instruments' Metal System Trace; whether a translation layer (DXMT, Mullion, MoltenVK) splits the work into too many short encoders; Metal .gputrace captures read without Xcode; and Apple's published facts on each GPU family to read the numbers against. Python 3.9+ standard library, zsh, and Xcode (for xctrace). MIT license. Español.
PERF_OUT=~/perf-runs zsh perf_record.sh game-d3d12 30 /path/to/wine ~/.wine /path/to/game game.exe PERF_OUT=~/perf-runs zsh perf_record.sh app-metal 30 native - /path/to/app ./app Arguments: label, seconds, a Wine directory holding bin/wine (or native), the Wine prefix, the working directory, the program and its arguments. Without PERF_OUT, runs go to ./perf-runs. Reading the trace afterwards takes about a minute on an M1 Pro (87 s for a 10 s recording); through the MCP server the whole call times out after 10 s per recorded second plus 120 s, and an overrun recording leaves no files behind. One recording runs at a time; keep other GPU work off the Mac while it records.
Under Wine, give it 30 s: Wine's start-up takes part of the recording. A recording with under 100 frames is too short to compare.
Each recording keeps a JSON summary and three CSVs, about 2 MB for 10 s (most of it the Metal memory samples). The .trace (tens to hundreds of MB) is deleted unless KEEP_TRACE=1. KEEP_RUNS=N keeps only the newest N recordings.
The server runs with uvx from PyPI, with nothing to clone (brew install uv installs it). Recording also needs Xcode installed (xcrun xctrace version prints a version).
uvx metal-gpu-trace This is the command each client below runs. Desktop apps do not see Homebrew's PATH: give them the full path that which uvx prints (/opt/homebrew/bin/uvx on Apple silicon). uvx keeps the version it first downloaded; run the command once with --refresh after uvx to get the latest. uvx metal-gpu-trace@0.4.0 pins a version.
The server reads these environment variables:
claude mcp add --scope user metal-trace -e METAL_TRACE_OUT=$HOME/perf-runs -e METAL_TRACE_WINE=/path/to/wine \ -- uvx metal-gpu-trace claude mcp list claude mcp list shows metal-trace as connected. --scope user makes it available in every project; leave it out to add it to the current project only.
These apps do not expand ~ or $HOME: write absolute paths.
{ "mcpServers": { "metal-trace": { "command": "/opt/homebrew/bin/uvx", "args": ["metal-gpu-trace"], "env": { "METAL_TRACE_OUT": "/absolute/path/to/perf-runs", "METAL_TRACE_WINE": "/absolute/path/to/wine" } } } } Client File Claude Desktop ~/Library/Application Support/Claude/claude_desktop_config.json (Settings, Developer, Edit Config); restart the app Cursor ~/.cursor/mcp.json VS Code .vscode/mcp.json in the project; the top key is servers instead of mcpServers, and the server adds "type": "stdio" Codex CLI In ~/.codex/config.toml:
The same facts are MCP resources: metal-trace://gpu-families (all) and metal-trace://gpu-families/apple7 to apple10. They restate Apple's Metal Feature Set Tables of 21 May 2026, MTLGPUFamily and the M3 tech talk; check a device with supportsFamily.
How it follows the MCP specification and Claude Code's limits:
apple-silicon gpu instruments mcp mcp-server metal profiling wine xctrace
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.




