Derived directly from xprobe v0.7.0 CLI definitions (xprobe/cli/src/args.rs) and error mappings (xprobe/protocol/src/error.rs, xprobe/cli/src/failure.rs).
Synopsis & Global Rules
xprobe [--human] <COMMAND> [OPTIONS]
xprobe --version | --help
| Subcommand | Purpose | Output Schema |
|---|
doctor | Inspect kernel, eBPF/perf, ptrace, NVIDIA driver, CUDA/CUPTI, and namespaces | 2.0 (capability.schema.json) |
discover | List NVML-confirmed CUDA context holders under a process-tree root (read-only) | 2.0 (discover.schema.json) |
validate | Read-only check of selectors, symbols, correlation policy, and requirements | 2.0 / 3.0 |
measure | Run live captures, inventories, triage snapshots, ring triggers, or offline --input analysis | 2.0 / 3.0 |
Global & Common Output Options
| Option | Scope | Type | Default | Behavior |
|---|
--human | Global | bool | false | Print human-readable text even when stdout is not a terminal; conflicts with --json |
--json | Subcommands | bool | true when non-TTY | Force a single versioned JSON document on stdout; conflicts with --human |
--no-color | Subcommands | bool | false | Accepted for scripting compatibility (xprobe never emits ANSI color) |
--non-interactive | Subcommands | bool | false | Accepted for scripting compatibility (xprobe never prompts) |
- stdout vs. stderr: structured JSON results (including JSON errors) always go to
stdout; diagnostics, CUPTI injection warnings, and non-JSON error text go to stderr.
- Auto-JSON rule: whenever
stdout is not a terminal and --human is not passed, JSON mode is enabled automatically.
xprobe doctor
xprobe doctor [--json | --human] [--no-color] [--non-interactive]
Reports kernel/OS identity, BTF, BPF/perf permissions, lockdown, ptrace policy, NVIDIA driver, CUDA toolkit/driver, installed CUPTI majors and resolved paths, namespaces, and capability booleans.
- Privilege checks read
CapEff (effective capability bitmask), not UID.
ok: true means diagnostics completed; inspect capabilities and checks for individual collector availability.
- Output fields: JSON Interfaces —
doctor.
xprobe discover
xprobe discover --pid <PID> [--limit <N>] [--json | --human]
| Option | Type | Required | Default | Description |
|---|
--pid | u32 | ✅ | — | Process-tree root PID (queried via NVML and filtered by ancestry) |
--limit | usize | — | 200 | Maximum CUDA worker candidates to return (must be > 0) |
- Read-only; does not attach and does not cover non-CUDA CPU/Python processes.
- On shared GPUs across containers, PIDs invisible in the caller's PID namespace emit
NVML_PROCESS_UNAVAILABLE (with nvml_pids); if none are visible, NVML_PID_NAMESPACE_MISMATCH is emitted.
- Output fields: JSON Interfaces —
discover.
xprobe validate
# Single-edge pair
xprobe validate --pid <PID> --from <SELECTOR> --to <SELECTOR> --match <POLICY>
# CPU sampling / Syscall aggregation
xprobe validate --pid <PID> --cpu-sample
xprobe validate --pid <PID> --syscall-aggregate
# Measurement graph (target PID comes from the spec)
xprobe validate --spec <GRAPH_JSON>
| Option | Type | Default | Requires / Conflicts | Description |
|---|
--pid | u32 | — | Required unless --spec; conflicts with --spec | Target process ID |
--spec | PathBuf | — | Conflicts with --pid, --from, --to, --match, --cpu-sample, --syscall-aggregate | Validate a Measurement Graph JSON (schema_version: "3.0") |
--from | String | — | Conflicts with --spec, --cpu-sample, --syscall-aggregate | Start event selector |
--to | String | — | Conflicts with --spec, --cpu-sample, --syscall-aggregate | End event selector |
--match | String | — | Conflicts with --spec, --cpu-sample, --syscall-aggregate | Correlation policy: exact, stack-nested, stream-order, first-after, nearest |
--cpu-sample | bool | false | Conflicts with --spec, --from, --to, --match, --syscall-aggregate | Validate PID-scoped CPU perf sampling and Python perf-map status |
--syscall-aggregate | bool | false | Conflicts with --spec, --from, --to, --match, --cpu-sample | Validate eBPF syscall aggregate path |
- Strictly read-only; never injects CUPTI.
requirements.agent_activation is not_required, already_loaded, injection_required (warns TARGET_PROCESS_WILL_BE_MODIFIED), or startup_required (NVTX without preloaded Agent → valid: false).
xprobe measure
Each measure invocation runs in exactly one of 9 modes, using exactly one source (--pid, one or more --input, or --spec).
Mode Compatibility Matrix
| Mode | Source | Required Bounds | Artifact File | Output Schema |
|---|
| 1. Live single-edge | --pid | --samples or --duration-ms | Event JSONL + manifest | 3.0 (measurement-result) |
| 2. Offline re-correlate | --input (repeatable) | Optional (all events if omitted) | None | 3.0 (measurement-result) |
| 3. Spec / Graph | --spec | Defined inside spec | Event JSONL + manifest | 3.0 / 2.0 |
4. GPU aggregate (--aggregate) | --pid + --from/--to/--match | --duration-ms | None (inline only) | 3.0 (aggregate-inventory-result) |
5. CPU sample (--cpu-sample) | --pid | --duration-ms | None (inline only) | 2.0 (cpu-sample-inventory-result) |
6. Python sample (--python-sample) | --pid | --duration-ms | Python Sample JSONL | 3.0 (python-sample-result) |
7. Syscall aggregate (--syscall-aggregate) | --pid | --duration-ms | None (inline only) | 2.0 (syscall-aggregate-result) |
8. Triage snapshot (--triage) | --pid | --duration-ms | Per-source artifacts | 3.0 (triage-result) |
9. Ring trigger (--trigger-*) | --pid | --timeout-ms + --max-events | window-N.events.jsonl + manifest in --events-out dir | 3.0 (trigger-result) |
Source, Output & Common Bound Options
| Option | Type | Default | Requires / Conflicts | Description |
|---|
--pid | u32 | — | Conflicts with --spec | Live target process ID |
--input | PathBuf (repeatable) | — | Conflicts with --spec, inventory modes, --python-sample, --triage, --trigger-* | Completed CUPTI binary, host-capture JSON, or Event JSONL; merged after target/dedup checks |
--spec | PathBuf | — | Conflicts with most CLI capture flags | Versioned JSON spec (single-edge, graph, CPU sampling, or syscall aggregate) |
--agent | PathBuf | Auto-resolved | Conflicts with --cpu-sample, --python-sample, --syscall-aggregate | Explicit libxprobe-cupti.so path for online injection |
--events-out | PathBuf | Private 0700 temp path | Conflicts with --cpu-sample, --syscall-aggregate, --aggregate, --triage | File path (mode 0600) for live event/Python captures, or directory for --trigger-* windows |
--format | jsonl | chrome | jsonl | Conflicts with inventory modes, --python-sample, --triage, --trigger-* | Artifact export format |
--evidence | summary | full | summary | Conflicts with --cpu-sample, --syscall-aggregate, --aggregate, --triage | summary keeps min/p50/p90/p95/p99/max exemplars; full inlines every matched pair |
--name | String | — | Conflicts with --spec | Optional measurement name |
--samples | usize | — | Conflicts with inventory modes, --python-sample, --triage, --trigger-*, --spec | Stop after N matched pairs |
--duration-ms | u64 | — | Conflicts with --spec, --trigger-* | Capture window duration in ms (required for inventory modes, --python-sample, --triage) |
--timeout-ms | u64 | 30000 | Conflicts with --spec | Maximum foreground wait + cleanup timeout in ms |
--max-events | usize | 100000 | Conflicts with --spec | Event capacity cap (fails with EVENT_RATE_TOO_HIGH in duration mode; ring capacity in --trigger-*) |
Pair & GPU Aggregate Options
| Option | Type | Default | Requires / Conflicts | Description |
|---|
--from | String | — | Conflicts with --spec, --cpu-sample, --python-sample, --syscall-aggregate, --triage | Start event selector |
--to | String | — | Same as above | End event selector |
--match | String | — | Same as above | Correlation policy: exact, stack-nested, stream-order, first-after, nearest |
--aggregate | bool | false | Conflicts with --input, --samples, --events-out, --format, other modes | Agent-side hash aggregation for GPU kernel/memcpy/memset |
--max-groups | usize | --aggregate: 4096
--cpu-sample: 256
--syscall-aggregate: 256 | Conflicts with --spec | Distinct group limit (fails explicitly on saturation) |
CPU Sampling Options (--cpu-sample)
| Option | Type | Default | Requires | Description |
|---|
--cpu-sample | bool | false | --pid, --duration-ms | PID-scoped userspace perf callchain sampling |
--frequency-hz | u64 | 99 | --cpu-sample | Target sampling frequency (Hz) |
--max-samples | u64 | 10000 | --cpu-sample | Maximum observed sample records |
--stack-depth | u32 | 64 | --cpu-sample | Maximum userspace callchain depth |
--max-threads | u32 | 1024 | --cpu-sample | Maximum attached target threads |
External CPython Sampling Options (--python-sample)
| Option | Type | Default | Requires | Description |
|---|
--python-sample | bool | false | --pid, --duration-ms | Read CPython 3.9–3.14 memory via process_vm_readv (needs ptrace; no -X perf, eBPF, or injection) |
--python-hz | u32 | 2000 | --python-sample | Samples/sec of the GIL holder (0 = all-thread sweeps only) |
--python-threads-hz | u32 | 100 | --python-sample | Sweeps/sec over all Python threads (plus native wait syscall for blocked threads) |
Syscall Aggregate & Triage Options
| Option | Type | Default | Requires | Description |
|---|
--syscall-aggregate | bool | false | --pid, --duration-ms | Aggregate syscall lifecycles in BPF maps (no pointer dereference) |
--max-inflight | u64 | 1024 | --syscall-aggregate | Max concurrent in-flight syscall starts in BPF LRU map |
--triage | bool | false | --pid, --duration-ms | Concurrent snapshot of thread times, cgroup throttling, CPU/Python samples, syscalls, NVML, and CUDA kernels |
Triggered Ring Capture Options (--trigger-*)
The four --trigger-* flags are mutually exclusive, require --pid, and conflict with --spec, --input, --samples, --duration-ms, --triage, --cpu-sample, --syscall-aggregate, --aggregate, and --format:
| Option | Type | Default | Requires | Description |
|---|
--trigger-idle-ms | f64 | — | --pid | Fire when the target runs no GPU activity on any stream on a device for ≥ N ms |
--trigger-gap-ms | f64 | — | --pid | Fire when a same-stream gap between GPU activities is ≥ N ms |
--trigger-duration-ms | f64 | — | --pid | Fire when a single kernel, copy, or memset lasts ≥ N ms |
--trigger-latency-ms | f64 | — | --pid, --from, --to, --match | Fire when a CUDA --from/--to edge under --match lasts ≥ N ms |
--pre-ms | f64 | 50.0 | Any --trigger-* | Context kept before the firing span starts (ms) |
--post-ms | f64 | 50.0 | Any --trigger-* | Context kept after the firing span ends (ms) |
--windows | u32 | 1 | Any --trigger-* | Non-overlapping firing windows to write before stopping |
Environment Variables
| Variable | Reader | Description |
|---|
XPROBE_CUPTI_AGENT_PATH | xprobe CLI | Override CUPTI Agent .so path (checked after --agent, before ../lib/xprobe/cuda12|cuda13) |
NVTX_INJECTION64_PATH | Target CUDA process | Must point to the matching libxprobe-cupti.so before the target's first NVTX call |
XPROBE_CUPTI_SOCKET | Preloaded libxprobe-cupti.so | Control Unix socket path for preloaded Agent startup |
XPROBE_CUPTI_OUTPUT | Preloaded libxprobe-cupti.so | Raw CUPTI binary output path for preloaded offline export |
XPROBE_CUPTI_MAX_RECORDS | Preloaded libxprobe-cupti.so | Record capacity for preloaded offline export |
Exit Codes & All 24 Error Codes
Process Exit Codes
| Exit Code | Meaning |
|---|
0 | Success |
1 | General runtime, validation, collection, decode, export, or cleanup error |
2 | Invalid CLI syntax or option conflicts (Clap) |
3 | TARGET_NOT_FOUND, TARGET_EXITED, TARGET_REUSED |
4 | PERMISSION_DENIED |
Complete ErrorCode Reference
All runtime errors serialize as schemas/error.schema.json (schema_version: "2.0", ok: false):
error.code | Exit | Trigger Condition | Key details Fields |
|---|
PERMISSION_DENIED | 4 | Missing CAP_BPF/CAP_PERFMON/CAP_SYS_PTRACE, Yama ptrace restriction, or /proc/<pid> denied | — |
TARGET_NOT_FOUND | 3 | Target PID does not exist | — |
TARGET_EXITED | 3 | Target exited during inspection, attach, or collection | — |
TARGET_REUSED | 3 | /proc/<pid>/stat start_time changed (PID reused) | — |
AMBIGUOUS_TARGET | 1 | Symbol or target matched multiple candidates | — |
SYMBOL_NOT_FOUND | 1 | Symbol or demangled C++ signature not found in ELF | — |
BINARY_NOT_MAPPED | 1 | Binary or shared library not mapped in /proc/<pid>/maps | — |
INVALID_EVENT_SELECTOR | 1 | Malformed selector, unsupported syscall/tracepoint, or non-pushdown NVTX regex | start_selector, end_selector |
INVALID_CORRELATION_POLICY | 1 | --match incompatible with --from/--to endpoints | match_policy |
CUPTI_NOT_AVAILABLE | 1 | CUPTI/NVML unavailable, remote injection trap, or CUPTI init failure | — |
CUPTI_AGENT_NOT_LOADED | 1 | Feature requiring preloaded Agent (e.g., NVTX) requested without startup load | — |
CUDA_CONTEXT_NOT_FOUND | 1 | Target has no active CUDA context | — |
UNSUPPORTED_CUDA_VERSION | 1 | CUDA major outside 12/13, conflicting majors, or unsupported injection platform | — |
UNSUPPORTED_PYTHON_VERSION | 1 | --python-sample target outside CPython 3.9–3.14 or free-threaded build | — |
EVENT_RATE_TOO_HIGH | 1 | Capture exceeded --max-events or aggregate table saturated | observed_events, max_events |
SESSION_LIMIT_EXCEEDED | 1 | Invalid limit, graph endpoint/edge count or slot limit exceeded, or limit timeout | edge (graph mode) |
NO_MATCHED_SAMPLES | 1 | Collection finished with zero matched pairs | captured_events, host_events, cuda_events |
HIGH_UNMATCHED_RATE | 1 | Unmatched event ratio exceeded limit | — |
EVENTS_DROPPED | 1 | BPF/CUPTI drops, or all trigger windows overlapped overwritten/dropped records | dropped_events |
TRIGGER_NOT_OBSERVED | 1 | --trigger-* timed out with zero written windows | longest_ns |
CLOCK_ALIGNMENT_FAILED | 1 | Cross-domain subtraction attempted between unaligned clocks (e.g., host_monotonic vs raw cupti) | start_clock, end_clock |
TRACE_EXPORT_FAILED | 1 | Failed to write Event JSONL, Chrome trace, or manifest (preserves original error) | original error details |
CLEANUP_FAILED | 1 | Failed to disable all CUPTI callbacks/activities on STOP (stop reason 5) or cleanup failed | — |
INTERNAL | 1 | Decode error, unsupported ELF, malformed NVML output, or internal error | — |
When post-collection errors occur (correlation, clock, drops, or capacity), xprobe still writes the artifact whenever possible and includes its path in error.details.