Esta página se muestra en inglés. Una traducción al español está en curso.
ConfigsMay 27, 2026·3 min de lectura

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.

Listo para agents

Instalación lista para agent

Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
pprof
Comando de instalación directa
npx -y tokrepo@latest install 0908f023-59a6-11f1-9bc6-00163e2b0d79 --target codex

Ejecutar después de confirmar el plan con dry-run.

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

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados