LinuxCommandLibrary

pprof

Visualize and analyze profiling data

TLDR

Start web interface

$ pprof -http=[localhost:8080] [profile.pb.gz]
copy
Show top functions
$ pprof -top [profile.pb.gz]
copy
Show call graph as text
$ pprof -text [profile.pb.gz]
copy
Show call graph as PDF
$ pprof -pdf [profile.pb.gz] > [profile.pdf]
copy
Profile from running server
$ pprof -http=[localhost:8080] [http://localhost:6060/debug/pprof/profile]
copy
Compare two profiles
$ pprof -base [baseline.pb.gz] [current.pb.gz]
copy
Focus on specific function
$ pprof -focus=[FunctionName] [profile.pb.gz]
copy

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

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community