Skip to main content

xprobe

Minimizing friction on the path to RSI.

Live Linux CPU, Python, syscall, and CUDA profiling for AI agents — eBPF, perf, and CUPTI to JSON/JSONL.

CI status Latest release Apache-2.0 license CUDA 12.x and 13.x

Live xprobe captures align a GPU idle bubble with Python GIL stacks on CLOCK_MONOTONIC, feed JSONL into an agent script, and verify an RSI optimization loop

Illustrative RSI loop: live GPU bubble + Python GIL capture aligned on CLOCK_MONOTONIC, sliced in JSONL, patched, and re-verified.

⚡ Why xprobe?

Traditional profilers are built for human eyes and GUIs: bulky traces, slow exports, heavy overhead, and noise that burns an agent's context window. Recursive self-improvement (RSI) needs the opposite — a live, low-friction sensor that emits compact, script-ready data on one shared timeline and turns profiling into a fast, honest feedback loop.

Capability xprobe perf / uprobe py-spy nsys torch.profiler
Live attach to running processes (no launch wrapper) ✅1 ✅ ✅ ⚠️ ❌
CPU + CPython GIL + syscall + CUDA on one CLOCK_MONOTONIC ✅ ❌ ❌ ⚠️ ⚠️
Wait & trigger on rare GPU idle bubbles / stream gaps / spikes ✅ ❌ ❌ ❌ ❌
Direct JSON / JSONL output for one-off scripts & RSI loops ✅ ❌ ⚠️ ❌ ⚠️
Multi-process & multi-GPU timeline alignment / rank budgets ✅ ⚠️ ❌ ✅ ⚠️
Visual GUI / kernel roofline & hardware counters ❌2 ❌ ❌ ✅ ✅

1. CPU, CPython stacks/GIL, syscalls, uprobes, and CUDA kernels/copies/APIs attach live; NVTX ranges require NVTX_INJECTION64_PATH before the first NVTX call.
2. Once a bottleneck is isolated inside a single GPU kernel or needs GUI inspection, hand off to ncu or nsys.

📦 Install

CLI (Linux x86_64, glibc ≥ 2.34)

pip install xprobe

Or install the standalone release archive to ~/.local (no Python required):

curl --proto '=https' --tlsv1.2 -fsSL \
  https://raw.githubusercontent.com/itdevwu/xprobe/v0.7.0/install.sh | sh

Both ship the CLI plus CUDA 12 and CUDA 13 CUPTI Agents. See Installation for SHA-256 checksums, SPDX SBOMs, and GitHub build attestations.

AI Agent Skill (Claude Code, Codex, Cursor)

npx skills add itdevwu/xprobe

Installs the xprobe-perf-profiling skill from skills.sh with exact JSON/JSONL artifact layouts, one-off scripting recipes, RSI comparison patterns, and the bundled analyze_trace.py analyzer. To pin the Skill to a release, see Installation.

🚀 Quick examples

# 1. Sample CPython 3.9–3.14 stacks & GIL holder from outside the process (no -X perf)
xprobe measure --pid 4242 --python-sample --duration-ms 2000

# 2. Aggregate GPU kernels or memcpy (including pageable vs pinned transfers)
xprobe measure --pid 4242 --from cuda:kernel_start --to cuda:kernel_end \
  --match exact --aggregate --duration-ms 2000

# 3. Measure exact launch-to-kernel latency (or up to 8 edges via --spec graph.json)
xprobe measure --pid 4242 --from cuda:launch_api:exit \
  --to 'cuda:kernel_start:name~flash.*' --match exact --samples 200

# 4. Wait for a rare ≥10 ms GPU idle bubble and keep ±50 ms of context around it
xprobe measure --pid 4242 --trigger-idle-ms 10 --pre-ms 50 --post-ms 50 \
  --timeout-ms 300000 --events-out spikes

Pipe into one-off scripts & RSI loops

When stdout is piped, every command emits one strict JSON object alongside raw JSONL traces and a .manifest.json (CLOCK_MONOTONIC window, UTC wall_clock anchors, and cuda_devices GPU UUIDs):

# Capture once, diff metrics across optimization iterations, or join traces in Python
before=$(xprobe measure --spec kernel.json | jq '.measurement.latency_ns.p95')
# ... apply kernel / runtime change ...
after=$(xprobe measure --spec kernel.json | jq '.measurement.latency_ns.p95')

# Slice a GPU bubble alongside concurrent Python GIL samples, or compare multi-GPU ranks
skills/xprobe-perf-profiling/scripts/analyze_trace.py trace.jsonl --slice-gap 1 --python-samples py.jsonl
skills/xprobe-perf-profiling/scripts/analyze_trace.py rank0.jsonl rank1.jsonl rank2.jsonl rank3.jsonl

Because concurrent captures on one host share CLOCK_MONOTONIC, you can also join traces across different processes (for example, an API/scheduler process and its GPU workers) in a few lines of Python, or re-correlate saved Event JSONL offline with xprobe measure --input.

🛠️ Commands & runtime notes

Command Purpose
doctor Check local eBPF, ptrace, NVIDIA driver, CUDA, and CUPTI availability
discover List NVML-confirmed CUDA context holders under a process-tree root
validate Dry-run selectors, policies, or graph specs without attaching
measure Capture latency pairs, measurement graphs, inventories, triggers, or offline --input traces
  • Live CUDA attach: measure --pid automatically loads the matching CUDA 12 or 13 CUPTI Agent via ptrace (requires same mount namespace and ptrace permission), reports the injection on stderr and in JSON, disables collection on stop, and leaves the .so mapped for safe reuse.
  • NVTX ranges: set NVTX_INJECTION64_PATH before the target's first NVTX call (CUDA's NVTX dispatch cannot be retrofitted after initialization).
  • Clock safety: GPU-only durations work on all supported CUDA majors; cross CPU/GPU subtraction enforces runtime clock alignment and returns CLOCK_ALIGNMENT_FAILED instead of silently mixing unaligned clocks.

📋 Support

Surface Support
Platform Linux x86_64, glibc 2.34+, CUDA/CUPTI 12.x & 13.x
Python External CPython 3.9–3.14 stacks, GIL holder, blocked native waits, and GC USDT
CPU & Linux PID-scoped perf callchains (ELF + perf-map), uprobes (symbol/C++/offset), syscalls, tracepoints
GPU & CUDA Runtime/Driver APIs (cuda:launch_api), kernels, memcpy (pageable/pinned), memset, ASCII NVTX
Modes Exact pairs, 8-edge measurement graphs, coarse aggregates, triggered ring capture, --triage snapshot
Correlation exact, stack-nested, stream-order, first-after, nearest

📚 Documentation

Implemented behavior is defined by code, tests, and schemas. Licensed under Apache-2.0. README visuals embed subsets of Maple Mono and Geist (SIL OFL-1.1).

Metadata

Release files for xprobe 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for xprobe 0.7.0
File Interpreter ABI Platform Actions
xprobe-0.7.0-py3-none-manylinux_2_34_x86_64.whl Python 3 none Linux glibc 2.34+ x86-64 Details for xprobe-0.7.0-py3-none-manylinux_2_34_x86_64.whl

Release files / xprobe-0.7.0-py3-none-manylinux_2_34_x86_64.whl

Download URL xprobe-0.7.0-py3-none-manylinux_2_34_x86_64.whl
Size 3.1 MB
Tags Linux glibc 2.34+ x86-64 Python 3
SHA-256 checksum
How to use checksums
ea811fe6953881a2b8197b86fbd3404baf70c68d1ae8c928ec74e8b3140b4d06
BLAKE2b-256 checksum
How to use checksums
4a6af468b1cfda061f73c2669e757111bec613ee5eea7543515a3f07104b2c07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

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 Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for xprobe 0.7.0

Provenance

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.

Full provenance

1 file in this release has been uploaded with provenance metadata.

Attestation for xprobe-0.7.0-py3-none-manylinux_2_34_x86_64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page