liveBook · Manning

Pprof format

As explained in Cloud Observability in Action

A profiler data format is a representation specification for storing or exchanging execution-profile data.

The pprof format represents execution profiles for storage or exchange. Based on a Protocol Buffers schema defined in profile.proto, it is the closest available standard for profile data on the wire or at rest, although no industry-wide standard exists. section 9.1.2 section 9.4

A Profile message can organize:

  • Sample types and samples, which represent measured profile data. section 9.1.2
  • Mappings, locations, lines, functions, and a string table for describing profiled code. section 9.1.2
  • Timing metadata such as collection time and duration. section 9.1.2

Inspecting a compressed profile

Copy and decompress a pprof profile, then use protoc to decode its Function messages and grep for a function such as main.slowTask. This is practical for debugging, but less convenient than filtering JSON with command-line tools. section 9.1.2

message Profile {
  repeated ValueType sample_type = 1;    #1
  repeated Sample sample = 2;            #2
  repeated Mapping mapping = 3;          #3
  repeated Location location = 4;        #4
  repeated Function function = 5;        #5
  repeated string string_table = 6;      #6
  int64 time_nanos = 9;                  #7
  int64 duration_nanos = 10;             #8
  repeated int64 comment = 13;           #9
}

Inspect the main Profile fields and their relationships in the protobuf schema. section 9.1.2

How Cloud Observability in Action covers it

How deep it goes
Defines the protobuf representation and major Profile fields, while leaving detailed schema treatment to profile.proto.
Examples
Uses Profile schema fields, compressed profile files, protoc decoding, and a Go flame-graph example.
What it assumes
Assumes familiarity with profiling data and protobuf tooling, while introducing the format’s principal message structure.
What you can do after
Diagnose profile contents with protoc and use compatible tools to analyze or visualize profiling data.
How it connects
Connects Protocol Buffers with Go profiling, continuous profiling, flame graphs, and profile-analysis tools.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Cloud Observability in Action. The section links point to the parts of the book it draws on.