Skip to content
C++

C++ Profilers

perf, VTune, Tracy, Callgrind, and Orbit — sampling vs. instrumentation, overhead trade-offs, and which to use when.

Quick pick

perf — Linux system/app profiling, hardware counters.
Tracy — games, real-time apps, frame analysis.
VTune — Intel CPU microarchitecture deep-dive.
Callgrind — algorithmic analysis, exact call counts.

Comparison matrix

PropertyperfVTuneTracyCallgrindOrbit
MethodSamplingSampling + InstrumentationInstrumentation (nanosecond)Instrumentation (full)Sampling + Instrumentation
Overhead~1-3%~5-15%~1-5% when connected~50-100×~2-5%
GUIKCachegrind / hotspotBuilt-inBuilt-in (live + offline)KCachegrindBuilt-in
Linux
macOSLimited
Windows
LicenseFree / GPLFree (oneAPI)Free / BSDFree / GPLFree / BSD
perf
Linux perf_events
Sampling · ~1-3% overhead

The Linux profiling Swiss-army knife. Hardware counter access, call graphs, cache miss analysis, branch mispredictions.

  • Lowest overhead of any Linux profiler
  • Hardware PMU counters (cache misses, branch mispredictions, IPC)
  • perf stat for quick system-wide stats
  • perf record / report for flame graphs
  • No instrumentation — works on any binary
  • Hotspot GUI for visual flame graphs
Full guide
VTune
Intel VTune Profiler
Sampling + Instrumentation · ~5-15% overhead

Best deep analysis on Intel CPUs. Memory latency, NUMA effects, vectorization efficiency, threading.

  • Microarchitecture analysis — frontend/backend bound
  • Memory access pattern analysis
  • NUMA, UMA, threading hotspots
  • Vectorization advisor
  • Free via Intel oneAPI
  • Excellent GUI with annotated source
Full guide
Tracy
Tracy Profiler
Instrumentation (nanosecond) · ~1-5% when connected overhead

Sub-microsecond frame profiler for games and real-time apps. The standard in the game dev industry.

  • Nanosecond-precision instrumented zones
  • Frame timeline view — perfect for game loop analysis
  • Memory allocation tracking
  • Lock / mutex contention visualization
  • GPU zones (Vulkan, D3D12, OpenGL)
  • Zero overhead when not connected
Full guide
Callgrind
Valgrind Callgrind + KCachegrind
Instrumentation (full) · ~50-100× overhead

Instruction-accurate profiling. Catches every function call. Slow but deterministic — great for algorithmic analysis.

  • Instruction-accurate — finds every call, no sampling error
  • Call graph with exact counts
  • Cache simulation (L1, LL cache misses)
  • KCachegrind GUI for visual call tree
  • Good for algorithmic complexity analysis
Full guide
Orbit
Google Orbit
Sampling + Instrumentation · ~2-5% overhead

Google's open-source production profiler. Sampling with function-level instrumentation on demand.

  • Live profiling of running processes
  • Sampling baseline + targeted instrumentation
  • Can instrument specific functions at runtime
  • Good for production systems
Full guide

Flame graph workflow with perf

# Record with call graphs (frame pointers or DWARF)
sudo perf record -F 99 -g -- ./myapp

# Generate flame graph (requires FlameGraph scripts)
sudo perf script | stackcollapse-perf.pl | flamegraph.pl > flamegraph.svg

# Or use the Hotspot GUI (recommended)
# Install: apt install hotspot
hotspot perf.data

Deep-dive guides