Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
837c27a
🐛 fix: keep a second session from taking over a running CUPTI capture
itdevwu Dec 1, 2026
94ddda7
🔧 chore: install CPU benchmark packages from the Azure mirror
itdevwu Dec 1, 2026
d603f42
📝 docs: clarify Skill usage, tuning limits, and CLI behavior
itdevwu Dec 2, 2026
9e40607
✨ feat: pair any CUDA API exactly with the GPU work it issued
itdevwu Dec 2, 2026
b668045
✨ feat: record each copy's source and destination memory kind
itdevwu Dec 2, 2026
04368c0
✨ feat: report quality on GPU aggregates
itdevwu Dec 2, 2026
b7b065c
✨ feat: keep every Python sample and report time per stack
itdevwu Dec 2, 2026
9fe65d7
✨ feat: keep every CPU sample with its time and on-CPU duration
itdevwu Dec 2, 2026
ff0c08d
🐛 fix: reuse a loaded Agent after its file is deleted
itdevwu Dec 2, 2026
5428259
✨ feat: list procfs CUDA hints when NVML's PIDs are not visible
itdevwu Dec 2, 2026
087ffec
🐛 fix: measure triage thread and cgroup time over the requested window
itdevwu Dec 2, 2026
8ac61b8
✨ feat: show what the CLI can do in its help and on stderr
itdevwu Dec 2, 2026
d8ad82b
🐛 fix: count /dev/nvidia0 and other NVIDIA devices in discover hints
itdevwu Dec 2, 2026
298f4cf
🐛 fix: claim the Agent before restarting it and subscribe for activity
itdevwu Dec 2, 2026
fa1bae9
🐛 fix: pair CUDA API and GPU activity without requiring the same context
itdevwu Dec 2, 2026
29dd341
🐛 fix: weight each Python sweep sample by its own sweep's interval
itdevwu Dec 2, 2026
5939621
⚡ perf: write each CPU frame once and stream samples in the analyzer
itdevwu Dec 2, 2026
efa574e
🐛 fix: read a loaded Agent's start function from its file when it exists
itdevwu Dec 2, 2026
a254341
🐛 fix: time triage thread counters from the middle of each snapshot
itdevwu Dec 2, 2026
7dc5296
📝 docs: say --aggregate leaves out activity still running at stop
itdevwu Dec 2, 2026
a60933f
📝 docs: trim README details and refine Skill wording
itdevwu Dec 2, 2026
3c02a2d
🔖 chore: prepare 0.7.1
itdevwu Dec 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.20)

project(xprobe VERSION 0.7.0 LANGUAGES C)
project(xprobe VERSION 0.7.1 LANGUAGES C)

include(CTest)

Expand Down
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ members = [
resolver = "2"

[workspace.package]
version = "0.7.0"
version = "0.7.1"
edition = "2024"
license = "Apache-2.0"
repository = "https://github.com/itdevwu/xprobe"
Expand Down
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div align="center">
<h1>xprobe</h1>
<p><strong>Minimizing friction on the path to RSI.</strong></p>
<p>Live Linux CPU, Python, syscall, and CUDA profiling for AI agents — eBPF, perf, and CUPTI to JSON/JSONL.</p>
<p>Live Linux CPU, Python, syscall, and CUDA profiler for AI agents and engineers.</p>
<p>
<a href="https://github.com/itdevwu/xprobe/actions/workflows/ci.yml"><img alt="CI status" src="https://img.shields.io/github/actions/workflow/status/itdevwu/xprobe/ci.yml?branch=master&amp;style=for-the-badge&amp;label=CI"></a>
<a href="https://github.com/itdevwu/xprobe/releases"><img alt="Latest release" src="https://img.shields.io/github/v/release/itdevwu/xprobe?style=for-the-badge&amp;sort=semver"></a>
Expand Down Expand Up @@ -46,50 +46,53 @@ Or install the standalone release archive to `~/.local` (no Python required):

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

Both ship the CLI plus CUDA 12 and CUDA 13 CUPTI Agents. See [Installation](docs/installation.md) for SHA-256 checksums, SPDX SBOMs, and GitHub build attestations.
Both ship the CLI plus CUDA 12 and CUDA 13 CUPTI Agents. See [Installation](docs/installation.md) for custom prefixes, upgrades, and verification.

### AI Agent Skill (Claude Code, Codex, Cursor)

```bash
npx skills add itdevwu/xprobe
```

Installs the [`xprobe-perf-profiling`](skills/xprobe-perf-profiling/SKILL.md) skill from [skills.sh](https://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](docs/installation.md#ai-agent-skill).
Installs the [`xprobe-perf-profiling`](skills/xprobe-perf-profiling/SKILL.md) skill from [skills.sh](https://skills.sh) with artifact layouts, scripting recipes, and the bundled `analyze_trace.py` analyzer. To pin a release, see [Installation](docs/installation.md#ai-agent-skill).

## 🚀 Quick examples

```bash
# 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)
# 2. Aggregate GPU kernels or memcpy (memcpy splits by pageable vs pinned)
xprobe measure --pid 4242 --from cuda:kernel_start --to cuda:kernel_end \
--match exact --aggregate --duration-ms 2000
xprobe measure --pid 4242 --from cuda:memcpy_start --to cuda:memcpy_end \
--match exact --aggregate --duration-ms 2000

# 3. Measure exact launch-to-kernel latency (or up to 8 edges via --spec graph.json)
# 3. Measure exact latency from a CUDA API call to the GPU work it issued
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
# 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):
When stdout is piped, every command emits one JSON object alongside raw trace files and a `.manifest.json` (`CLOCK_MONOTONIC` window, UTC `wall_clock` anchors, and `cuda_devices` GPU UUIDs):

```bash
# Capture once, diff metrics across optimization iterations, or join traces in Python
# Capture once, diff metrics across iterations, or join traces in Python
before=$(xprobe measure --spec kernel.json | jq '.measurement.latency_ns.p95')
# ... apply kernel / runtime change ...
# ... apply 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
# Slice a GPU bubble alongside concurrent Python & CPU samples, or compare multi-GPU ranks
skills/xprobe-perf-profiling/scripts/analyze_trace.py trace.jsonl \
--slice-gap 1 --python-samples py.jsonl --cpu-samples cpu.jsonl
skills/xprobe-perf-profiling/scripts/analyze_trace.py rank0.jsonl rank1.jsonl rank2.jsonl rank3.jsonl
```

Expand Down
6 changes: 6 additions & 0 deletions benchmarks/cpu-inventory/run-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
set -euo pipefail

export DEBIAN_FRONTEND=noninteractive
# Canonical's archive has had outages; install from the Azure mirror.
for sources in /etc/apt/sources.list /etc/apt/sources.list.d/ubuntu.sources; do
if [[ -f ${sources} ]]; then
sed -i -E 's#http://(archive|security)\.ubuntu\.com#http://azure.archive.ubuntu.com#' "${sources}"
fi
done
apt-get update
apt-get install -y --no-install-recommends \
linux-tools-common linux-tools-generic python3 python3-pip
Expand Down
5 changes: 1 addition & 4 deletions benchmarks/cpu-inventory/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,6 @@ def cpu_sample_command(xprobe: pathlib.Path, seconds: int) -> list[str]:
str(seconds * 1000),
"--frequency-hz",
str(FREQUENCY_HZ),
"--max-samples",
str(seconds * FREQUENCY_HZ * 4),
"--max-groups",
"512",
"--json",
Expand Down Expand Up @@ -440,9 +438,8 @@ def cpu_quality(result: dict) -> dict:
"observed_samples": observed,
"grouped_samples": collection["grouped_samples"],
"lost_samples": collection["lost_samples"],
"sample_capacity": collection["sample_capacity"],
"group_capacity": collection["group_capacity"],
"groups": collection["groups"],
"cpu_time_ns": collection["cpu_time_ns"],
"stack_coverage": collection["grouped_samples"] / observed if observed else 0.0,
"symbol_coverage": resolved / total_frames if total_frames else 0.0,
"python_status": symbols["python_status"],
Expand Down
15 changes: 13 additions & 2 deletions cupti/include/xprobe/cupti_agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ enum xprobe_cupti_feature {
XPROBE_CUPTI_FEATURE_TRANSFER_RECORDS = 1U << 1,
XPROBE_CUPTI_FEATURE_AGGREGATE_RECORDS = 1U << 2,
XPROBE_CUPTI_FEATURE_NVTX_RECORDS = 1U << 3,
/* Copies report their source and destination CUpti_ActivityMemoryKind:
* in an exact record's block_x and block_y, in an aggregate record's
* src_memory_kind and dst_memory_kind. */
XPROBE_CUPTI_FEATURE_MEMORY_KINDS = 1U << 4,
/* Peer-to-peer copies (CUPTI MEMCPY2) are captured with other copies. */
XPROBE_CUPTI_FEATURE_PEER_MEMCPY = 1U << 5,
Expand All @@ -45,7 +48,9 @@ enum xprobe_cupti_agent_status {
XPROBE_CUPTI_AGENT_READY = 0,
XPROBE_CUPTI_AGENT_UNAVAILABLE = 1,
XPROBE_CUPTI_AGENT_CUPTI_ERROR = 2,
XPROBE_CUPTI_AGENT_OUTPUT_ERROR = 3
XPROBE_CUPTI_AGENT_OUTPUT_ERROR = 3,
/* Another xprobe session owns the capture and is still running. */
XPROBE_CUPTI_AGENT_BUSY = 4
};

enum xprobe_cupti_capture_state {
Expand All @@ -64,7 +69,13 @@ enum xprobe_cupti_stop_reason {
XPROBE_CUPTI_STOP_OUTPUT_ERROR = 4,
/* STOP could not disable every callback or activity kind; the Agent
* keeps serving so CLOSE can retry. */
XPROBE_CUPTI_STOP_CLEANUP_ERROR = 5
XPROBE_CUPTI_STOP_CLEANUP_ERROR = 5,
/* Reply to a command from a session that does not own the capture: the
* Agent did nothing and sends a header without records. */
XPROBE_CUPTI_STOP_SESSION_BUSY = 6,
/* Another CUPTI client, such as torch.profiler, Nsight Systems, Nsight
* Compute, or cuda-gdb, holds the process's CUPTI subscriber. */
XPROBE_CUPTI_STOP_SUBSCRIBER_CONFLICT = 7
};

enum xprobe_cupti_control_command {
Expand Down
Loading