Skip to content
Back to skills

Xprobe Perf Profiling

ASecurity

Profile live Linux CPU, CPython (stacks & GIL), syscall, and NVIDIA CUDA/PyTorch/vLLM workloads with xprobe. Use to find GPU idle bubbles, slow kernels, memory copy bottlenecks, Python GIL contention, CPU hotspots, syscall stalls, tail latency spikes, or multi-GPU/multi-process stragglers; to write one-off Python/jq analysis scripts over xprobe JSON/JSONL traces; or to embed profiling into automated performance optimization and RSI loops.

  • 13 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
ai-agentspythonrustapiperformance

Works with

  • api
  • mcp

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 7 files and shows the line behind each finding

Scanned December 3, 2026

npx -y skills add itdevwu/xprobe --skill xprobe-perf-profiling --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Xprobe Perf Profiling?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Xprobe Perf Profiling
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/itdevwu-xprobe-perf-profiling/badge)](https://www.skillsdirectory.com/skills/itdevwu-xprobe-perf-profiling)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: xprobe-perf-profiling
description: Profile live Linux CPU, CPython (stacks & GIL), syscall, and NVIDIA CUDA/PyTorch/vLLM workloads with xprobe. Use to find GPU idle bubbles, slow kernels, memory copy bottlenecks, Python GIL contention, CPU hotspots, syscall stalls, tail latency spikes, or multi-GPU/multi-process stragglers; to write one-off Python/jq analysis scripts over xprobe JSON/JSONL traces; or to embed profiling into automated performance optimization and RSI loops.
---

# Profile Linux & ML workloads with xprobe

`xprobe` profiles live Linux CPU, Python, syscall, and CUDA processes (or re-analyzes saved traces). If `xprobe` is not installed yet, install it with `pip install xprobe` (Linux x86_64, glibc ≥ 2.34). When stdout is piped, every command writes one JSON document to stdout alongside raw JSONL artifacts. Run `xprobe <command> --help` for full flags.

## Pick a mode

| Need | Command | Notes |
| --- | --- | --- |
| Check host/container permissions | `xprobe doctor` | Read-only; run first when eBPF, perf, ptrace, or CUPTI access is unknown |
| List CUDA PIDs under a root | `xprobe discover --pid "$ROOT"` | Uses NVML; inside containers (`NVML_PID_NAMESPACE_MISMATCH`) see `procfs_hints`: processes that loaded `libcuda` or opened `/dev/nvidia*` |
| Check selectors or CUPTI Agent status | `xprobe validate --pid "$PID" --from A --to B --match exact` | Read-only; reports `requirements.agent_activation` (`already_loaded` vs `injection_required`) |
| Python stacks, GIL & native waits | `xprobe measure --pid "$PID" --python-sample --duration-ms 2000` | CPython 3.9–3.14; ptrace only (no eBPF/perf/injection); sweeps of every thread slow down on processes with many threads |
| Native CPU callchain hotspots | `xprobe measure --pid "$PID" --cpu-sample --duration-ms 2000 --events-out cpu.jsonl` | Needs perf events; 999 Hz; every sample timestamped in the JSONL |
| Syscall count & duration totals | `xprobe measure --pid "$PID" --syscall-aggregate --duration-ms 2000` | Needs eBPF |
| GPU kernel totals | `xprobe measure --pid "$PID" --from cuda:kernel_start --to cuda:kernel_end --match exact --aggregate --duration-ms 2000` | Aggregates **one** activity kind per run |
| GPU memcpy totals (pageable vs pinned) | `xprobe measure --pid "$PID" --from cuda:memcpy_start --to cuda:memcpy_end --match exact --aggregate --duration-ms 2000` | Groups by `src_memory`/`dst_memory` (`pageable` vs `pinned`), which every copy event also carries; use `cuda:memset_*` for memset |
| Exact A → B latency + Event JSONL | `xprobe measure --pid "$PID" --from cuda:launch_api:exit --to cuda:kernel_start --match exact --samples 200` | `exact` pairs any CUDA API with the kernel, copy, or memset it issued, an API's entry/exit, or an activity's start/end (see [selectors.md](references/selectors.md)) |
| Full GPU timeline / stream gaps / idle | `xprobe measure --pid "$PID" --from cuda:kernel_end --to cuda:kernel_start --match stream-order --duration-ms 2000 --events-out trace.jsonl` | Captures all GPU activity (`all_gpu_activity: true`) |
| Up to 8 edges in one capture | `xprobe measure --spec graph.json` | Shares one capture and 8 CUPTI filters |
| Wait for rare GPU bubble / gap / spike | `xprobe measure --pid "$PID" --trigger-idle-ms 10 --pre-ms 50 --post-ms 50 --events-out spikes` | In-Agent ring; writes `window-N.events.jsonl` |
| Re-correlate saved Event JSONL offline | `xprobe measure --input trace.jsonl --from A --to B --match exact` | No live attach needed |
| Same-window cgroup / thread / NVML snapshot | `xprobe measure --pid "$PID" --triage --duration-ms 2000` | Read the raw inventories; `findings` are rule-based leads to check |

## Analyze outputs & build scripts

- **Standard GPU analysis**: run `scripts/analyze_trace.py trace.jsonl` for per-GPU busy/idle/compute/comm budgets, top idle and stream gaps, vertical slices (`--slice-gap`, `--slice-outlier`, `--around`, `--python-samples`, `--cpu-samples`), and multi-rank comparison (`scripts/analyze_trace.py rank0.jsonl rank1.jsonl ...`).
- **One-off scripts & RSI loops**: read [data-format.md](references/data-format.md) for stdout keys, artifact paths, JSONL shapes, CPU/Python sample formats, `analyze_trace.py` output fields, API-to-Python-caller joins, cross-process alignment, and quality codes.
- **Selectors, policies, tuning & graphs**: read [selectors.md](references/selectors.md) and `examples/` (`request-path-graph.json`, `kernel-duration.json`).

## Runtime limits & validity checks

- **Scope & CUDA collector**: profile only the user-specified target PID; never alter system services, kernel settings, or host permissions (report `xprobe doctor` output instead). Check `xprobe validate` first (`requirements.agent_activation`); live CUDA `measure` loads `libxprobe-cupti.so` into the target process, disables CUPTI callbacks on stop, and leaves the mapped library and its last capture's buffers (200 bytes per `--max-events` record) ready for reuse (`CUPTI_AGENT_ALREADY_LOADED`), even if its file on disk was removed.
- **One CUDA session per PID**: running two CUDA `measure` commands on the same PID fails with `CUPTI_AGENT_BUSY`; combine edges in a graph instead. `--python-sample` can run concurrently with CUDA `measure`.
- **Containers & NVTX**: run `xprobe` in the target's PID and mount namespaces. NVTX ranges are available only when the target was launched with `NVTX_INJECTION64_PATH`.
- **Duration & sample bounds**: live `measure` requires `--samples` or `--duration-ms`. Inventory modes (`--aggregate`, `--cpu-sample`, `--python-sample`, `--syscall-aggregate`, `--triage`) accept `--duration-ms` only.
- **Cross-process & clocks**: run concurrent `measure --pid` captures across processes or ranks. On one host, `host_monotonic`, `cupti_normalized_to_host_monotonic`, `--python-sample`, and `--cpu-sample` share `CLOCK_MONOTONIC`. Never mix PIDs in `measure --input` or subtract raw `cupti` timestamps from host timestamps.
- **Check completeness before trusting numbers**: `status == "completed"` can still hide truncation or drops. Verify:
  - `warnings` is empty (or explicitly understood)
  - `--cpu-sample`: `collection.lost_samples == 0` and `collection.completeness == "complete"`
  - Exact / graph / trigger: `dropped == 0`, check `quality.verdict`, and require `all_gpu_activity == true` when reporting GPU idle time
  - `--aggregate`: `quality.verdict` and `quality.issues` (`NAME_TRUNCATED` merges kernels that share a cut name)

Files in this skill

  • SKILL.md6.3 KB
  • agents/openai.yaml283 B
  • examples/kernel-duration.json355 B
  • examples/request-path-graph.json807 B
  • references/data-format.md19.9 KB
  • references/selectors.md6.3 KB
  • scripts/analyze_trace.py50.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.