pprof
Visualize and analyze profiling data
TLDR
Start web interface
SYNOPSIS
pprof [-http addr] [-top] [-text] [-pdf] [-focus pattern] [options] source
DESCRIPTION
pprof analyzes and visualizes performance profiles from Go programs and other sources. It shows where programs spend time and memory.
The web interface provides interactive exploration. Flame graphs show call hierarchies. Graph views display caller/callee relationships.
Profiles capture CPU usage, memory allocations, goroutine counts, and custom metrics. Go's runtime/pprof package generates these profiles.
Live profiling connects to running servers through HTTP endpoints. The standard /debug/pprof/ path provides various profile types.
Comparison mode highlights changes between profiles. This identifies performance regressions or improvements after code changes.
Focus and ignore filters narrow analysis to specific areas. Regular expressions match function names for targeted investigation.
PARAMETERS
-http ADDR
Start web server.-top
Show top functions.-text
Text report.-pdf
PDF output.-svg
SVG output.-png
PNG output.-web
Open in browser.-focus REGEX
Focus on matching functions.-ignore REGEX
Ignore matching functions.-base PROFILE
Compare against baseline.-seconds N
Profile duration.-sample_index IDX
Sample type (cpu, alloc, etc.).-lines
Show line-level info.
CAVEATS
Requires graphviz for graph generation. CPU profiles need sufficient sample time. Memory profiles may need multiple collections. Profile size grows with sampling.
HISTORY
pprof was developed at Google for profiling production systems. The Go version is maintained as part of the Go project. It originated from Google's internal profiling tools and gperftools.
SEE ALSO
go-tool-pprof(1), perf(1), flamegraph(1)
