KX

kr1sso/xtrace-skill

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

21 stars 品質 61 トレンド 23MIT

xtrace — コマンドラインCPU macOSをスキルとしてプロファイリングする.

概要

MacOSインスツルメンツ用のUnixスタイルのプロファイリングツール。 レコードトレース、CPUホットスポットの分析、GPU活用の検査、およびメモリ動作の調査 — 端末からすべて、パイプと互換性があります。 Appleのインスツルメンツは強力ですがGUIのみです。 xctraceは存在しますが、生と使用が困難です。 "私はバイナリを持っている"から1つのコマンドで "彼女のホットスポット"に行くための良い方法はありません。 - - — タイム - — レコード → 分析 → 1 つのパイプラインで視覚化 - — 端末/LLM、スクリプトの JSON、人間のための SVG のフレームグラフ、深層分析のためのスピードスコープ - — 平均値を見るのではなく、 CPU の使用量がスパークライン、自信の表示、および自動相検出で時間経過とともにどのように変化するかを参照してください - - 差分テキストの差分と赤/青の炎 - Python stdlib だけ。 最高の視覚化のための任意inferno/speedscope。 1. (~/.local/bin) — xtrace, trace-record, trace-analyze.py など 2 — Pi, Cursor, Claude コードはすべて同じ SKILL.md 形式を使用します.

概要(AI 翻訳)

MacOSインスツルメンツ用のUnixスタイルのプロファイリングツール。 レコードトレース、CPUホットスポットの分析、GPU活用の検査、およびメモリ動作の調査 — 端末からすべて、パイプと互換性があります。

なぜ

Appleのインスツルメンツは強力ですが、GUIのみです。 xctrace]は存在しますが、生と使用が困難です。 "私はバイナリを持っている"から1つのコマンドで "彼女のホットスポット"に行くための良い方法はありません。

xtrace はこのギャップを埋めます:

-[[xtrace] — [time]]のように、それをプロファイルするために任意のコマンドをプレフィックスします。 -すべてのツールは一緒に配管 — 1つのパイプラインでレコード→分析→視覚化 -複数の出力フォーマット — 端末/LLM、スクリプト用のJSON、人間のためのSVGのフレームグラフ、深層分析のためのスピードスコープ

  • Time-resolved Analysis — 平均ではなく、CPU使用率がスパークライン、自信インジケータ、および自動位相検出で時間をかけて変化する方法を参照してください。
  • 比較前/後 — 差分と赤/青のフレームグラフ -コア解析の外部依存性ゼロ — Python stdlibのみ。 最高の視覚化のための任意inferno/speedscope。

インストール

これは3つのことを行います。

  1. スクリプトをPATH** ([~/.local/bin]) — [[xtrace]], [trace-record]]], 「trace-analyze.

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

xtrace — Command-line CPU/GPU/Memory Profiling for macOS

Unix-style profiling tools for macOS Instruments. Record traces, analyze CPU hotspots, inspect GPU utilization, and investigate memory behavior — all from the terminal, all composable with pipes.

# Profile any command. Just prefix it.
xtrace ./my_app --benchmark

# Pipe to a flamegraph
xtrace ./my_app | trace-speedscope -

# Build → profile → interactive analysis
cmake --build . && xtrace ./my_app | trace-speedscope -

Why

Apple’s Instruments is powerful but GUI-only. xctrace exists but is raw and hard to use. There’s no good way to go from “I have a binary” to “here are my hotspots” in one command.

xtrace bridges this gap:

  • xtrace — prefix any command to profile it, like time
  • All tools pipe together — record → analyze → visualize in one pipeline
  • Multiple output formats — text summaries for terminals/LLMs, JSON for scripts, SVG flamegraphs for humans, speedscope for deep analysis
  • Time-resolved analysis — don’t just see averages, see how CPU usage changes over time with sparklines, confidence indicators, and automatic phase detection
  • Before/after comparison — differential text diffs and red/blue flamegraphs
  • Zero external dependencies for core analysis — Python stdlib only. Optional inferno/speedscope for best visualizations.

Install

git clone https://github.com/Kr1sso/xtrace-skill.git
cd xtrace-skill
./install.sh

This does three things:

  1. Symlinks scripts to PATH (~/.local/bin) — xtrace, trace-record, trace-analyze.py, etc.
  2. Installs as an AI agent skill — Pi, Cursor, and Claude Code all use the same SKILL.md format. The installer symlinks this repo into each agent’s skills directory.
  3. Prompts to install optional tools — inferno and speedscope for best visualizations.
Skills:
  ✓ Pi:         ~/.pi/agent/skills/instruments/
  ✓ Cursor:     ~/.cursor/skills/instruments/
  ✓ Claude Code: ~/.claude/skills/instruments/

All three agents read the same SKILL.md natively — one repo, one file, three symlinks.

cargo install inferno        # Best flamegraph SVGs (click-to-zoom, search, hover)
npm install -g speedscope    # Interactive web UI (sandwich view, time-ordered, zoom)

Verify

./scripts/trace-check.sh     # check environment
./test.sh                    # run end-to-end tests

Requirements

  • macOS with Xcode or Command Line Tools (xcode-select --install)
  • Python 3.8+ (ships with macOS)
  • Apple Silicon or Intel (Processor Trace requires Apple Silicon + Developer Tools enabled)

Quick Start

# CPU profiling (default Time Profiler)
xtrace -d 10 ./my_app

# GPU profiling (Metal System Trace)
xtrace --gpu -d 10 ./my_app

# Enable Shader Timeline for real shader hotspot / callsite tooling
xtrace --gpu --shader-timeline -d 10 ./my_shader_app
GitHub で README 全文を見る

推奨ツール

別のキーワードを試すか、フィルタを外してください。

インストール

npx skillfish add kr1sso/xtrace-skill
MCP 初心者?mcpskill.org のガイドから始めましょう →