Profiling Tools for AI Inference: What Each One Measures

Which profiling tools cover which layer of GPU inference, from DCGM and Nsight to PyTorch Profiler and request tracing, and why utilisation misleads.

Profiling Tools for AI Inference: What Each One Measures
Written by TechnoLynx Published on 12 Jun 2026

Each profiling tool for AI inference sees one layer of the serving path, and none of them tells you on its own where the time or the money goes. DCGM reports device counters for cluster telemetry, Nsight Systems puts CPU and GPU activity on one timeline, Nsight Compute takes apart individual kernels, the PyTorch Profiler connects framework operators to the kernels they launch, and OpenTelemetry traces follow one request across services. The GPU utilisation figure can mislead you: in one Jetson study it reached 100% while SMs and Tensor Cores ran at only 15% to 30%.

Treat these tools as instruments, not as a diagnosis. In an inference cost audit, their readings go onto a bottleneck map before anyone picks a fix.

What each inference profiler measures, and where its view stops

Tool Layer What it measures Where it stops Production use
nvidia-smi utilisation Device The share of time a process is running on the GPU SM and Tensor Core activity can sit at 15-30% while utilisation reaches 100% Not assessed in these sources
DCGM Fleet and device SM activity, tensor pipe activity, device memory, PCIe and NVLink traffic, as interval averages No kernel, source line or instruction attribution Continuous and low overhead, but conflicts with Nsight tools while they run
Nsight Systems Process timeline CUDA API calls, kernels, memory copies, NVTX ranges and OS runtime activity on one timeline No view of PyTorch Aten operators without annotation, no intra-kernel metrics Low overhead, best used for short, focused captures
Nsight Compute Single kernel Throughput against peak, occupancy, warp stall reasons, memory hierarchy, metrics correlated to source lines GPU only, so it misses CPU-to-GPU offload interactions Replays and serialises kernels, which changes the workload it measures
PyTorch Profiler Framework operators Operator time, input shapes, tensor memory, and CUDA kernels traced through CUPTI, exported as a Chrome trace Not intra-kernel. PyTorch points to Nsight Compute and similar tools for that Medium overhead, run in scheduled windows
OpenTelemetry tracing Request across services Spans from the gateway through scheduling to the model server under one trace ID Auto-instrumentation alone misses scheduler and cache decisions, which need first-party spans In llm-d, production traffic with ratio sampling, starting around 10%

NVIDIA’s documentation sets an order for the device and kernel tools. NVIDIA’s DCGM documentation says to start with DCGM to find an underused or imbalanced device, then switch to Nsight Systems or Nsight Compute once the investigation needs application-level attribution. The Nsight Compute triage guide adds a second step to that sequence: use Nsight Systems first if you don’t yet know which kernel matters. The detailed hand-off between the two Nsight tools is covered in our GPU profiler tools workflow.

Why nvidia-smi can read 99% while the SMs do a fraction of the work

GPU utilisation, the headline figure, measures the share of time a process is running on the GPU. It does not measure how much of the chip that process is actually using. A study of concurrent vision inference on NVIDIA Jetson devices found that GPU utilisation could reach 100% with specific optimisations, while SMs and Tensor Cores often ran at only 15% to 30%. In the same study, SM active utilisation climbed towards 100% as more processes were added, but issue-slot utilisation stayed around 25% on average. Even with 99% GPU utilisation and full Tensor Core utilisation, the authors found performance could still be limited by kernel operations and CPU-side scheduling.

DCGM’s SM activity metric has its own catch. DCGM counts an SM as active if at least one warp is active on it, including warps waiting on memory. NVIDIA describes a value of 0.8 or more as necessary but not sufficient for effective use, and a value below 0.5 as a likely sign of ineffective use. Nsight Compute’s SM throughput figure is the maximum of several sub-metrics, so a high top-line number can hide pipelines that are barely used.

The opposite reading misleads too. Large gaps between kernels often mean CPU overhead, especially at small batch sizes. The cost side of this is covered in the hidden cost of GPU underutilisation and in the illusion of idle GPUs.

What GPU profilers see that Python and C++ profilers cannot

NVIDIA says it directly: none of the Python profilers can profile code running on the GPU. PyTorch launches GPU kernels asynchronously, so the CPU keeps queuing kernels while earlier ones are still executing. A CPU-side timer therefore measures when work was queued, not when it ran, unless you add a synchronisation point before reading it.

CUPTI, NVIDIA’s profiling interface, provides the APIs for building GPU profiling and tracing tools. CUPTI separates two jobs. Tracing records timestamps for API calls, kernel launches and memory copies. Profiling collects per-kernel hardware metrics and may need to replay kernels to do it. The PyTorch Profiler traces on-device CUDA kernels through CUPTI.

CPU profiling still matters in inference, because a host that enqueues kernels too slowly leaves the GPU idle. Nsight Systems covers that side by sampling CPU instruction pointers and tracing when Python threads wait on the GIL. If you are still working out whether the Python layer is the problem, profiling a Python inference path before committing to a port covers that decision.

Where the PyTorch Profiler fits next to Nsight Systems and Nsight Compute

The PyTorch Profiler works at the operator level. It shows which model operators cost the most, their input shapes and stack traces, and device kernel activity. That is the layer Nsight Systems lacks visibility into. A 2025 study of LLM inference on CPU-GPU coupled systems notes that Nsight Systems lacks visibility into PyTorch Aten operators, while Nsight Compute is limited to GPU-side profiling. The gap can be closed from the Nsight side: --pytorch=functions-trace annotates PyTorch operations automatically, and NVTX ranges are projected onto the GPU timeline so each kernel lines up with the CPU range that launched it.

Nsight Compute comes after both. For framework-generated kernels such as cuBLAS or cuDNN variants, the kernel name does not tell you the call site, so NVIDIA’s triage guide recommends NVTX ranges plus Python call-stack collection to trace kernels back to source. For vLLM specifically, the project’s own guidance is Nsight Systems for low-overhead profiling and the PyTorch Profiler when you need richer debugging information such as stacks, memory and shapes. With torch.compile, graph breaks appear as nested “Torch-Compiled Region” events in the trace. The method for going deeper on a single kernel is in how to profile GPU kernels to find the real bottleneck.

Reading a trace in Perfetto: lanes, gaps and idle time

The PyTorch Profiler exports its trace as Chrome JSON, which the Perfetto UI opens directly. Perfetto supports multi-GPU CUDA tracing and can link host API calls such as cudaLaunchKernel to the GPU work they produced. The profiler also gives you an operator table, and the two answer different questions. The table answers “what takes the most time”. The trace answers “when and why it happened”.

In the trace, bar width is duration, vertical nesting is the call hierarchy, the CPU lane shows host events, the GPU lane shows kernel execution, and empty space is waiting or idle time. Flow arrows link each CPU event to the kernel it launched, which you need because most launches are asynchronous. These are the patterns worth checking first:

  • Gaps between kernels in the GPU lane: usually the CPU is not launching work fast enough, which is more common at small batch sizes and often helped by CUDA graphs.
  • A long synchronisation call covering very little GPU work: in a Hugging Face walkthrough, a 1.78 ms cudaDeviceSynchronize wrapped 26 µs of real GPU work, which is the textbook sign of an overhead-bound workload.
  • Idle time by cause: PyTorch’s Holistic Trace Analysis splits GPU idle time into host wait (fixed with batch size or operator fusion), kernel wait (reduced with CUDA graphs) and other wait.
  • Launch delay and queue depth: HTA uses correlation IDs to measure the gap between a CPU launch and the kernel starting. At a stream queue length of 1024 the CPU stalls.

GPU timing traps that corrupt a reading before any tool is wrong

Check these five before trusting any number:

  1. Asynchronous launches. Timing without synchronisation measures queuing rather than execution.
  2. No warm-up. JIT fusion passes, cudnn.benchmark kernel selection, lazy kernel loading and caching-allocator growth all happen in the first iterations.
  3. Clock variation. GPU clocks change with temperature and power limits. Locking them improves reproducibility, though the GPU can still throttle. In the Hugging Face walkthrough, one matmul kernel usually ran in about 580 µs, but the five-run mean came out at 1084 µs because of a few slow outliers.
  4. Cache state. Repeated runs can hit warm caches and report lower latency than production would see.
  5. Comparing Nsight Compute with Nsight Systems. Nsight Compute locks clocks, flushes caches between replay passes and serialises launches by default. Nsight Systems does none of these. NVIDIA’s triage guide says a divergence of more than about 2× deserves investigation, and host-side timers cannot recover a true duration while Nsight Compute is attached.

How much overhead does profiling add on a production inference server?

DCGM metrics and sampled request traces are both documented for production use. Developer profilers belong in staging. The vLLM documentation is blunt about it: profiling is meant for vLLM developers, and end users should never turn it on, because it significantly slows inference.

Overhead differs by tool:

Tool Overhead profile Where it is safe
DCGM Continuous, low overhead, supported in production since DCGM 1.7 Production, but pause it with dcgmi profile --pause while Nsight tools run
Nsight Systems CUDA hardware trace has lower overhead than the legacy software trace. Memory tracking, tracing all CUDA APIs and per-node CUDA graph tracing add significant overhead Short captures limited by NVTX or capture ranges. The tool generally does not support runs longer than 5 minutes
Nsight Compute Replays kernels when counters cannot be collected in one pass. Larger section sets cost more Isolated kernel analysis
PyTorch Profiler record_shapes holds tensor references and can add copies. Stack tracing adds overhead Scheduled windows over a few steps
OpenTelemetry tracing Retention and cardinality costs rise quickly with QPS Production at parent-based ratio sampling, starting around 10%

NVTX annotations are a cheap exception. NVIDIA says the calls can stay in production code because their overhead is very low when no profiler is attached, but wrapping code that runs in under a microsecond needs care. The Jetson study authors describe the same trade-off: capture throughput and power first with minimal intrusion, then accept more intrusion to get deeper data.

How do you trace a single inference request from the gateway to the GPU?

Start a root span at the gateway, propagate W3C Trace Context on every hop, and export spans over OTLP so one collector assembles them into a single tree. The W3C Trace Context standard exists because each tracing vendor used to propagate context its own way, so traces could not be correlated across vendor boundaries. The traceparent header carries version, trace ID, parent span ID and flags. Each downstream service creates a child span under the caller’s span. The llm-d project describes the result: one trace ID shows gateway time, scheduling time, prefill, decode and engine spans as parent and child, even across pods.

vLLM supports OpenTelemetry tracing through --otlp-traces-endpoint and --collect-detailed-traces. Detailed traces add model forward and model execute times per request. Auto-instrumentation agents are not enough on their own: they produce HTTP and gRPC spans, but they cannot record a scheduler’s routing decision or a KV-cache hit ratio, so those need first-party spans. Read the attributes carefully. In llm-d’s example, a proxy-measured time to first token of 50 ms and an engine-reported 0.343 s were both correct, because they measured different things.

The link down to the GPU goes through Nsight Systems, whose vLLM annotations carry correlated request IDs, so individual requests can be tracked through the inference pipeline inside a profiler capture. Metrics and traces divide the work: metrics give an aggregate view over time, and traces follow individual requests. In llm-d’s phrasing, metrics detect and traces explain. How general APM products handle this layer is in APM tools for AI inference, and reading per-stage numbers once you have them is covered in profiling AI inference.

Attributing inference cost to requests, not just to the cloud bill

Cloud billing tags, such as Bedrock’s, show which application spent money on which day. They do not show per-request cost. AWS documents that Amazon Bedrock application inference profiles carry cost allocation tags into Cost Explorer and the Cost and Usage Reports, but the finest grain is per usage type per day, with no per-request cost. Those tags can take up to 24 hours to appear and do not apply retroactively.

Request traces fill that gap. llm-d lists token counts and cache effectiveness per request as a tracing design goal, because in distributed LLM inference the prefill and decode split, prompt length and cache hit rate can change the cost of a request by orders of magnitude. Billing gives you the total, traces give you the distribution, and a cost model joins the two. The method for building that join is in per-request cost attribution. This is engineering attribution, not cloud-bill negotiation.

Catching SLA risk before users notice, on the observability stack you already run

To spot latency SLA risk early, alert on leading indicators per stage (queueing delay, tail-latency drift and utilisation saturation) and don’t wait for the breach itself. vLLM already exposes the raw signals: time to first token, end-to-end latency, prefill and decode histograms, and a queue interval measured from when a request enters the scheduler queue to when it is scheduled. TechnoLynx can define the SLA metric and leading indicators for the serving path, add tracing spans and queue and GPU exporters to the serving stack, and confirm in staging that the alerts fire before real breaches, before rolling dashboards out across the fleet. This kind of observability work is part of how we support AI infrastructure and production SaaS teams running inference at scale.

vLLM’s documentation describes request-level histograms as the metrics an SRE usually tracks as SLOs, and server-level gauges and counters as the metrics that explain them. Queueing models support designing autoscaling controllers against SLOs. The same signals can drive an SLO-aware autoscaler rather than only a pager.

An existing Prometheus stack can ingest both GPU and serving metrics. NVIDIA’s dcgm-exporter exposes GPU metrics on a /metrics endpoint for Prometheus, takes a CSV of metrics to collect, and adds pod information to each metric in Kubernetes. vLLM labels every metric with the model name.

There are limits. On edge devices, deeper data collection comes with more profiler intrusion. DCGM multiplexes metrics that cannot be read together, and high collection frequencies can return zeros. Monitoring whether thresholds stay valid after deployment is not covered here. None of this makes the model or the hardware faster. It only gives operators, or an autoscaler, time to act.

From a profiler reading to a fix you can defend

A profiler reading interpreted in isolation invites the wrong fix. Once a layer has the latency or cost correctly assigned to it, the useful levers to improve GPU performance often turn out to be batching, caching, runtime choice or kernel work below the model, which is why production cost and latency can often improve without replacing the model. That does not rule out a model swap, the most expensive lever. It means the profile should show it is the answer before you pay for it.

The Inference Cost-Cut Pack is where TechnoLynx applies these instruments to a deployed serving path, so that the bottleneck map and the before-and-after baseline rest on readings like the ones above. The question to settle first is which layer your current dashboard can actually see, and which layers it can’t.

FAQ

How can I see what is using GPU memory during inference?

The PyTorch Profiler reports memory allocated and released by each operator when profile_memory is enabled. Nsight Systems can graph CUDA-allocated memory over time, at the cost of extra overhead.

How do I check GPU usage on an NVIDIA inference server?

dcgmi dmon -e streams GPU activity, Tensor Core activity and memory utilisation, with NVIDIA’s example sampling at 1 Hz. dcgm-exporter exposes DCGM telemetry on an HTTP endpoint for Prometheus to pull.

Back See Blogs
arrow icon