Skip to main content

CLI Reference

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
SubcommandPurposeOutput Schema
doctorInspect kernel, eBPF/perf, ptrace, NVIDIA driver, CUDA/CUPTI, and namespaces2.0 (capability.schema.json)
discoverList NVML-confirmed CUDA context holders under a process-tree root (read-only)2.0 (discover.schema.json)
validateRead-only check of selectors, symbols, correlation policy, and requirements2.0 / 3.0
measureRun live captures, inventories, triage snapshots, ring triggers, or offline --input analysis2.0 / 3.0

Global & Common Output Options​

OptionScopeTypeDefaultBehavior
--humanGlobalboolfalsePrint human-readable text even when stdout is not a terminal; conflicts with --json
--jsonSubcommandsbooltrue when non-TTYForce a single versioned JSON document on stdout; conflicts with --human
--no-colorSubcommandsboolfalseAccepted for scripting compatibility (xprobe never emits ANSI color)
--non-interactiveSubcommandsboolfalseAccepted 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]
OptionTypeRequiredDefaultDescription
--pidu32✅—Process-tree root PID (queried via NVML and filtered by ancestry)
--limitusize—200Maximum 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>
OptionTypeDefaultRequires / ConflictsDescription
--pidu32—Required unless --spec; conflicts with --specTarget process ID
--specPathBuf—Conflicts with --pid, --from, --to, --match, --cpu-sample, --syscall-aggregateValidate a Measurement Graph JSON (schema_version: "3.0")
--fromString—Conflicts with --spec, --cpu-sample, --syscall-aggregateStart event selector
--toString—Conflicts with --spec, --cpu-sample, --syscall-aggregateEnd event selector
--matchString—Conflicts with --spec, --cpu-sample, --syscall-aggregateCorrelation policy: exact, stack-nested, stream-order, first-after, nearest
--cpu-sampleboolfalseConflicts with --spec, --from, --to, --match, --syscall-aggregateValidate PID-scoped CPU perf sampling and Python perf-map status
--syscall-aggregateboolfalseConflicts with --spec, --from, --to, --match, --cpu-sampleValidate 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​

ModeSourceRequired BoundsArtifact FileOutput Schema
1. Live single-edge--pid--samples or --duration-msEvent JSONL + manifest3.0 (measurement-result)
2. Offline re-correlate--input (repeatable)Optional (all events if omitted)None3.0 (measurement-result)
3. Spec / Graph--specDefined inside specEvent JSONL + manifest3.0 / 2.0
4. GPU aggregate (--aggregate)--pid + --from/--to/--match--duration-msNone (inline only)3.0 (aggregate-inventory-result)
5. CPU sample (--cpu-sample)--pid--duration-msNone (inline only)2.0 (cpu-sample-inventory-result)
6. Python sample (--python-sample)--pid--duration-msPython Sample JSONL3.0 (python-sample-result)
7. Syscall aggregate (--syscall-aggregate)--pid--duration-msNone (inline only)2.0 (syscall-aggregate-result)
8. Triage snapshot (--triage)--pid--duration-msPer-source artifacts3.0 (triage-result)
9. Ring trigger (--trigger-*)--pid--timeout-ms + --max-eventswindow-N.events.jsonl + manifest in --events-out dir3.0 (trigger-result)

Source, Output & Common Bound Options​

OptionTypeDefaultRequires / ConflictsDescription
--pidu32—Conflicts with --specLive target process ID
--inputPathBuf (repeatable)—Conflicts with --spec, inventory modes, --python-sample, --triage, --trigger-*Completed CUPTI binary, host-capture JSON, or Event JSONL; merged after target/dedup checks
--specPathBuf—Conflicts with most CLI capture flagsVersioned JSON spec (single-edge, graph, CPU sampling, or syscall aggregate)
--agentPathBufAuto-resolvedConflicts with --cpu-sample, --python-sample, --syscall-aggregateExplicit libxprobe-cupti.so path for online injection
--events-outPathBufPrivate 0700 temp pathConflicts with --cpu-sample, --syscall-aggregate, --aggregate, --triageFile path (mode 0600) for live event/Python captures, or directory for --trigger-* windows
--formatjsonl | chromejsonlConflicts with inventory modes, --python-sample, --triage, --trigger-*Artifact export format
--evidencesummary | fullsummaryConflicts with --cpu-sample, --syscall-aggregate, --aggregate, --triagesummary keeps min/p50/p90/p95/p99/max exemplars; full inlines every matched pair
--nameString—Conflicts with --specOptional measurement name
--samplesusize—Conflicts with inventory modes, --python-sample, --triage, --trigger-*, --specStop after N matched pairs
--duration-msu64—Conflicts with --spec, --trigger-*Capture window duration in ms (required for inventory modes, --python-sample, --triage)
--timeout-msu6430000Conflicts with --specMaximum foreground wait + cleanup timeout in ms
--max-eventsusize100000Conflicts with --specEvent capacity cap (fails with EVENT_RATE_TOO_HIGH in duration mode; ring capacity in --trigger-*)

Pair & GPU Aggregate Options​

OptionTypeDefaultRequires / ConflictsDescription
--fromString—Conflicts with --spec, --cpu-sample, --python-sample, --syscall-aggregate, --triageStart event selector
--toString—Same as aboveEnd event selector
--matchString—Same as aboveCorrelation policy: exact, stack-nested, stream-order, first-after, nearest
--aggregateboolfalseConflicts with --input, --samples, --events-out, --format, other modesAgent-side hash aggregation for GPU kernel/memcpy/memset
--max-groupsusize--aggregate: 4096
--cpu-sample: 256
--syscall-aggregate: 256
Conflicts with --specDistinct group limit (fails explicitly on saturation)

CPU Sampling Options (--cpu-sample)​

OptionTypeDefaultRequiresDescription
--cpu-sampleboolfalse--pid, --duration-msPID-scoped userspace perf callchain sampling
--frequency-hzu6499--cpu-sampleTarget sampling frequency (Hz)
--max-samplesu6410000--cpu-sampleMaximum observed sample records
--stack-depthu3264--cpu-sampleMaximum userspace callchain depth
--max-threadsu321024--cpu-sampleMaximum attached target threads

External CPython Sampling Options (--python-sample)​

OptionTypeDefaultRequiresDescription
--python-sampleboolfalse--pid, --duration-msRead CPython 3.9–3.14 memory via process_vm_readv (needs ptrace; no -X perf, eBPF, or injection)
--python-hzu322000--python-sampleSamples/sec of the GIL holder (0 = all-thread sweeps only)
--python-threads-hzu32100--python-sampleSweeps/sec over all Python threads (plus native wait syscall for blocked threads)

Syscall Aggregate & Triage Options​

OptionTypeDefaultRequiresDescription
--syscall-aggregateboolfalse--pid, --duration-msAggregate syscall lifecycles in BPF maps (no pointer dereference)
--max-inflightu641024--syscall-aggregateMax concurrent in-flight syscall starts in BPF LRU map
--triageboolfalse--pid, --duration-msConcurrent 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:

OptionTypeDefaultRequiresDescription
--trigger-idle-msf64—--pidFire when the target runs no GPU activity on any stream on a device for ≥ N ms
--trigger-gap-msf64—--pidFire when a same-stream gap between GPU activities is ≥ N ms
--trigger-duration-msf64—--pidFire when a single kernel, copy, or memset lasts ≥ N ms
--trigger-latency-msf64—--pid, --from, --to, --matchFire when a CUDA --from/--to edge under --match lasts ≥ N ms
--pre-msf6450.0Any --trigger-*Context kept before the firing span starts (ms)
--post-msf6450.0Any --trigger-*Context kept after the firing span ends (ms)
--windowsu321Any --trigger-*Non-overlapping firing windows to write before stopping

Environment Variables​

VariableReaderDescription
XPROBE_CUPTI_AGENT_PATHxprobe CLIOverride CUPTI Agent .so path (checked after --agent, before ../lib/xprobe/cuda12|cuda13)
NVTX_INJECTION64_PATHTarget CUDA processMust point to the matching libxprobe-cupti.so before the target's first NVTX call
XPROBE_CUPTI_SOCKETPreloaded libxprobe-cupti.soControl Unix socket path for preloaded Agent startup
XPROBE_CUPTI_OUTPUTPreloaded libxprobe-cupti.soRaw CUPTI binary output path for preloaded offline export
XPROBE_CUPTI_MAX_RECORDSPreloaded libxprobe-cupti.soRecord capacity for preloaded offline export

Exit Codes & All 24 Error Codes​

Process Exit Codes​

Exit CodeMeaning
0Success
1General runtime, validation, collection, decode, export, or cleanup error
2Invalid CLI syntax or option conflicts (Clap)
3TARGET_NOT_FOUND, TARGET_EXITED, TARGET_REUSED
4PERMISSION_DENIED

Complete ErrorCode Reference​

All runtime errors serialize as schemas/error.schema.json (schema_version: "2.0", ok: false):

error.codeExitTrigger ConditionKey details Fields
PERMISSION_DENIED4Missing CAP_BPF/CAP_PERFMON/CAP_SYS_PTRACE, Yama ptrace restriction, or /proc/<pid> denied—
TARGET_NOT_FOUND3Target PID does not exist—
TARGET_EXITED3Target exited during inspection, attach, or collection—
TARGET_REUSED3/proc/<pid>/stat start_time changed (PID reused)—
AMBIGUOUS_TARGET1Symbol or target matched multiple candidates—
SYMBOL_NOT_FOUND1Symbol or demangled C++ signature not found in ELF—
BINARY_NOT_MAPPED1Binary or shared library not mapped in /proc/<pid>/maps—
INVALID_EVENT_SELECTOR1Malformed selector, unsupported syscall/tracepoint, or non-pushdown NVTX regexstart_selector, end_selector
INVALID_CORRELATION_POLICY1--match incompatible with --from/--to endpointsmatch_policy
CUPTI_NOT_AVAILABLE1CUPTI/NVML unavailable, remote injection trap, or CUPTI init failure—
CUPTI_AGENT_NOT_LOADED1Feature requiring preloaded Agent (e.g., NVTX) requested without startup load—
CUDA_CONTEXT_NOT_FOUND1Target has no active CUDA context—
UNSUPPORTED_CUDA_VERSION1CUDA major outside 12/13, conflicting majors, or unsupported injection platform—
UNSUPPORTED_PYTHON_VERSION1--python-sample target outside CPython 3.9–3.14 or free-threaded build—
EVENT_RATE_TOO_HIGH1Capture exceeded --max-events or aggregate table saturatedobserved_events, max_events
SESSION_LIMIT_EXCEEDED1Invalid limit, graph endpoint/edge count or slot limit exceeded, or limit timeoutedge (graph mode)
NO_MATCHED_SAMPLES1Collection finished with zero matched pairscaptured_events, host_events, cuda_events
HIGH_UNMATCHED_RATE1Unmatched event ratio exceeded limit—
EVENTS_DROPPED1BPF/CUPTI drops, or all trigger windows overlapped overwritten/dropped recordsdropped_events
TRIGGER_NOT_OBSERVED1--trigger-* timed out with zero written windowslongest_ns
CLOCK_ALIGNMENT_FAILED1Cross-domain subtraction attempted between unaligned clocks (e.g., host_monotonic vs raw cupti)start_clock, end_clock
TRACE_EXPORT_FAILED1Failed to write Event JSONL, Chrome trace, or manifest (preserves original error)original error details
CLEANUP_FAILED1Failed to disable all CUPTI callbacks/activities on STOP (stop reason 5) or cleanup failed—
INTERNAL1Decode 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.