ConfigsMay 27, 2026·3 min read

pprof — Visualization and Analysis Tool for Profiling Data

An open-source tool by Google for visualizing and analyzing profiling data from Go, C++, Java, and other runtimes, generating interactive flame graphs, call graphs, and source annotations.

Agent ready

Ready-to-run agent install

This asset can be installed after the agent chooses its runtime, checks the plan, and runs the matching command.

Native · 98/100Policy: allow
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Single
Trust
Trust: Established
Entrypoint
pprof
Direct install command
npx -y tokrepo@latest install 0908f023-59a6-11f1-9bc6-00163e2b0d79 --target codex

Run after dry-run confirms the install plan.

Introduction

pprof is an open-source profiling visualization tool developed by Google. It reads profiling data in the protocol buffer-based pprof format and renders it as interactive flame graphs, directed call graphs, top function tables, and source-level annotations. Originally built for Go's runtime profiler, pprof now supports any profiler that emits the pprof protobuf format, including C++ (gperftools), Java (async-profiler), and Node.js.

What pprof Does

  • Reads CPU, memory, goroutine, mutex, and block profiles in the pprof protobuf format
  • Renders interactive flame graphs and call graphs in a local web UI
  • Generates SVG, PDF, and text reports for sharing and documentation
  • Annotates source code and disassembly with per-line profiling data
  • Compares two profiles to show regressions or improvements between versions

Architecture Overview

pprof parses a profile protobuf file that contains samples, each sample associating a set of call stack frames with numeric values (CPU time, allocation bytes, etc.). It builds a weighted call graph from these samples and applies user-specified filters (focus, ignore, hide) to narrow the view. The web UI mode starts a local HTTP server that serves an interactive flame graph, a graph visualization (rendered via Graphviz), top tables, and per-line source annotations. The same engine can export static SVG, PDF, or plain text via command-line flags.

Self-Hosting & Configuration

  • Install with Go: go install github.com/google/pprof@latest
  • Go programs expose profiles at /debug/pprof/ when importing net/http/pprof
  • Open interactive web UI: pprof -http=:8080 profile.pb.gz
  • Fetch a live profile from a Go server: pprof http://server:port/debug/pprof/profile
  • Compare two profiles: pprof -diff_base=old.prof new.prof

Key Features

  • Interactive web UI with flame graph, graph view, top table, and source annotation
  • Profile diffing to visualize performance changes between two versions
  • Supports remote profile fetching from running Go servers over HTTP
  • Filtering by function name regex to focus on specific code paths
  • Works with any profiler that outputs the pprof protobuf format

Comparison with Similar Tools

  • go tool trace — shows goroutine scheduling and system events as a timeline; pprof aggregates CPU and memory samples into call graphs
  • Speedscope — web-based flame graph viewer; pprof adds call graph rendering, source annotation, and profile diffing
  • FlameGraph (Brendan Gregg) — generates SVG flame graphs from folded stacks; pprof provides an interactive web UI and multiple visualization modes
  • py-spy — sampling profiler for Python; pprof is a visualization tool that reads profiles from any runtime that emits pprof format
  • Pyroscope / Grafana Pyroscope — continuous profiling platform with storage and querying; pprof is a standalone CLI tool for ad-hoc analysis

FAQ

Q: Is pprof only for Go programs? A: No. Any profiler that outputs the pprof protobuf format works. This includes gperftools (C++), async-profiler (Java), and perf (Linux) with conversion tools.

Q: Do I need Graphviz installed? A: Graphviz is needed for the directed call graph view. Flame graphs and top tables work without it. Install Graphviz with your package manager if you want graph output.

Q: Can I profile a production Go service? A: Yes. Import net/http/pprof in your server, then fetch profiles remotely with pprof http://host:port/debug/pprof/profile?seconds=30.

Q: How do I compare performance between two releases? A: Use pprof -diff_base=baseline.prof current.prof to see a call graph highlighting the delta.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets