# google/pprof architecture

> Architecture diagram of the GitHub repository google/pprof, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/google/pprof
- Repository: https://github.com/google/pprof

## Overview

pprof accepts local or HTTP profiling data, optionally combines profiles and symbolizes addresses, then analyzes samples into text or graphical reports. The main command also offers interactive terminal and HTTP interfaces for refining and viewing results. The graph preserves documented capabilities whose implementations were not sampled; links for those are limited to relationships established by the README or sampled code.

Main entry points: [`internal/driver/driver.go`](https://github.com/google/pprof/blob/main/internal/driver/driver.go) (Command driver), [`internal/report/report.go`](https://github.com/google/pprof/blob/main/internal/report/report.go) (Report analysis), [`internal/driver/fetch.go`](https://github.com/google/pprof/blob/main/internal/driver/fetch.go) (Profile fetch), [`internal/driver/webui.go`](https://github.com/google/pprof/blob/main/internal/driver/webui.go) (HTTP web interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Profile ingestion"]
  node_fetch["Profile fetch<br/>[fetch.go]"]
  node_format["Profile decoding<br/>[proto.go]"]
  node_profile["Profile model<br/>[profile.go]"]
  node_merge["Profile merge<br/>[merge.go]"]
end

subgraph group_analysis["Profile analysis"]
  node_measurement["Unit scaling<br/>[measurement.go]"]
  node_filter["Profile refinement<br/>[filter.go]"]
  node_prune["Profile pruning<br/>[prune.go]"]
  node_report["Report analysis<br/>[report.go]"]
  node_graph["Call graph<br/>[graph.go]"]
end

subgraph group_symbolization["Symbolization"]
  node_symbolizer["Symbolization<br/>[symbolizer.go]"]
  node_binutils["Native binary tools<br/>[binutils.go]"]
end

subgraph group_interfaces["User interfaces"]
  node_main["pprof command<br/>[pprof.go]"]
  node_driver["Command driver<br/>[driver.go]"]
  node_text["Text reports<br/>[report.go]"]
  node_svg["Graph rendering<br/>[svg.go]"]
  node_dot["Graphviz output<br/>[dotgraph.go]"]
  node_interactive["Terminal interface<br/>[interactive.go]"]
  node_web["HTTP web interface<br/>[webui.go]"]
  node_webhtml["Web reports<br/>[webhtml.go]"]
end

node_user(("Engineer"))
node_server(("Profile server"))
node_binary(("Program binary"))

node_user -->|"invokes"| node_main
node_main -->|"starts"| node_driver
node_driver -->|"fetches profiles"| node_fetch
node_server -->|"serves profile"| node_fetch
node_fetch -->|"decodes data"| node_format
node_format -->|"creates profile"| node_profile
node_fetch -->|"combines profiles"| node_merge
node_merge -->|"merges data"| node_profile
node_driver -->|"symbolizes profile"| node_symbolizer
node_binary -.->|"provides symbols"| node_binutils
node_symbolizer -->|"inspects binaries"| node_binutils
node_driver -->|"scales samples"| node_measurement
node_driver -->|"refines profile"| node_filter
node_driver -->|"prunes profile"| node_prune
node_driver -->|"builds reports"| node_report
node_report -->|"summarizes samples"| node_graph
node_report -->|"formats text"| node_text
node_driver -->|"renders graph"| node_svg
node_svg -->|"generates visualization"| node_dot
node_driver -->|"starts terminal mode"| node_interactive
node_driver -->|"starts HTTP mode"| node_web
node_web -->|"serves report views"| node_webhtml
node_interactive -->|"requests reports"| node_report
node_web -->|"requests reports"| node_report
node_user -->|"enters commands"| node_interactive
node_user -->|"uses browser"| node_web

click node_main "https://github.com/google/pprof/blob/main/pprof.go"
click node_driver "https://github.com/google/pprof/blob/main/internal/driver/driver.go"
click node_fetch "https://github.com/google/pprof/blob/main/internal/driver/fetch.go"
click node_format "https://github.com/google/pprof/blob/main/profile/proto.go"
click node_profile "https://github.com/google/pprof/blob/main/profile/profile.go"
click node_merge "https://github.com/google/pprof/blob/main/profile/merge.go"
click node_measurement "https://github.com/google/pprof/blob/main/internal/measurement/measurement.go"
click node_filter "https://github.com/google/pprof/blob/main/profile/filter.go"
click node_prune "https://github.com/google/pprof/blob/main/profile/prune.go"
click node_symbolizer "https://github.com/google/pprof/blob/main/internal/symbolizer/symbolizer.go"
click node_binutils "https://github.com/google/pprof/blob/main/internal/binutils/binutils.go"
click node_report "https://github.com/google/pprof/blob/main/internal/report/report.go"
click node_graph "https://github.com/google/pprof/blob/main/internal/graph/graph.go"
click node_text "https://github.com/google/pprof/blob/main/internal/report/report.go"
click node_svg "https://github.com/google/pprof/blob/main/internal/driver/svg.go"
click node_dot "https://github.com/google/pprof/blob/main/internal/graph/dotgraph.go"
click node_interactive "https://github.com/google/pprof/blob/main/internal/driver/interactive.go"
click node_web "https://github.com/google/pprof/blob/main/internal/driver/webui.go"
click node_webhtml "https://github.com/google/pprof/blob/main/internal/driver/webhtml.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_fetch,node_format,node_profile,node_merge toneBlue
class node_measurement,node_filter,node_prune,node_report,node_graph toneAmber
class node_symbolizer,node_binutils,node_server toneMint
class node_main,node_driver,node_text,node_svg,node_dot,node_interactive,node_web,node_webhtml toneRose
class node_user,node_binary toneIndigo
```

## Components

### Profile ingestion

- [Profile fetch](https://github.com/google/pprof/blob/main/internal/driver/fetch.go): `internal/driver/fetch.go`
- [Profile decoding](https://github.com/google/pprof/blob/main/profile/proto.go): `profile/proto.go`
- [Profile model](https://github.com/google/pprof/blob/main/profile/profile.go): `profile/profile.go`
- [Profile merge](https://github.com/google/pprof/blob/main/profile/merge.go): `profile/merge.go`

### Profile analysis

- [Unit scaling](https://github.com/google/pprof/blob/main/internal/measurement/measurement.go): `internal/measurement/measurement.go`
- [Profile refinement](https://github.com/google/pprof/blob/main/profile/filter.go): `profile/filter.go`
- [Profile pruning](https://github.com/google/pprof/blob/main/profile/prune.go): `profile/prune.go`
- [Report analysis](https://github.com/google/pprof/blob/main/internal/report/report.go): `internal/report/report.go`
- [Call graph](https://github.com/google/pprof/blob/main/internal/graph/graph.go): `internal/graph/graph.go`

### Symbolization

- [Symbolization](https://github.com/google/pprof/blob/main/internal/symbolizer/symbolizer.go): `internal/symbolizer/symbolizer.go`
- [Native binary tools](https://github.com/google/pprof/blob/main/internal/binutils/binutils.go): `internal/binutils/binutils.go`

### User interfaces

- [pprof command](https://github.com/google/pprof/blob/main/pprof.go): `pprof.go`
- [Command driver](https://github.com/google/pprof/blob/main/internal/driver/driver.go): `internal/driver/driver.go`
- [Text reports](https://github.com/google/pprof/blob/main/internal/report/report.go): `internal/report/report.go`
- [Graph rendering](https://github.com/google/pprof/blob/main/internal/driver/svg.go): `internal/driver/svg.go`
- [Graphviz output](https://github.com/google/pprof/blob/main/internal/graph/dotgraph.go): `internal/graph/dotgraph.go`
- [Terminal interface](https://github.com/google/pprof/blob/main/internal/driver/interactive.go): `internal/driver/interactive.go`
- [HTTP web interface](https://github.com/google/pprof/blob/main/internal/driver/webui.go): `internal/driver/webui.go`
- [Web reports](https://github.com/google/pprof/blob/main/internal/driver/webhtml.go): `internal/driver/webhtml.go`

### Other components

- **Engineer**
- **Profile server**
- **Program binary**

## Connections

- Engineer → pprof command: invokes
- pprof command → Command driver: starts
- Command driver → Profile fetch: fetches profiles
- Profile server → Profile fetch: serves profile
- Profile fetch → Profile decoding: decodes data
- Profile decoding → Profile model: creates profile
- Profile fetch → Profile merge: combines profiles
- Profile merge → Profile model: merges data
- Command driver → Symbolization: symbolizes profile
- Program binary → Native binary tools: provides symbols
- Symbolization → Native binary tools: inspects binaries
- Command driver → Unit scaling: scales samples
- Command driver → Profile refinement: refines profile
- Command driver → Profile pruning: prunes profile
- Command driver → Report analysis: builds reports
- Report analysis → Call graph: summarizes samples
- Report analysis → Text reports: formats text
- Command driver → Graph rendering: renders graph
- Graph rendering → Graphviz output: generates visualization
- Command driver → Terminal interface: starts terminal mode
- Command driver → HTTP web interface: starts HTTP mode
- HTTP web interface → Web reports: serves report views
- Terminal interface → Report analysis: requests reports
- HTTP web interface → Report analysis: requests reports
- Engineer → Terminal interface: enters commands
- Engineer → HTTP web interface: uses browser
