pgo

package standard library
go1.26.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2026 License: BSD-3-Clause Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pgo contains the compiler-agnostic portions of PGO profile handling. Notably, parsing pprof profiles and serializing/deserializing from a custom intermediate representation.

Package pgo contains the compiler-agnostic portions of PGO profile handling. Notably, parsing pprof profiles and serializing/deserializing from a custom intermediate representation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSerialized

func IsSerialized(r *bufio.Reader) (bool, error)

IsSerialized returns true if r is a serialized Profile.

IsSerialized only peeks at r, so seeking back after calling is not necessary.

func WeightInPercentage

func WeightInPercentage(value int64, total int64) float64

WeightInPercentage converts profile weights to a percentage.

Types

type NamedCallEdge

type NamedCallEdge struct {
	CallerName     string
	CalleeName     string
	CallSiteOffset int // Line offset from function start line.
}

NamedCallEdge identifies a call edge by linker symbol names and call site offset.

type NamedEdgeMap

type NamedEdgeMap struct {
	Weight map[NamedCallEdge]int64

	// ByWeight lists all keys in Weight, sorted by edge weight from
	// highest to lowest.
	ByWeight []NamedCallEdge
}

NamedEdgeMap contains all unique call edges in the profile and their edge weight.

type Profile

type Profile struct {
	// TotalWeight is the aggregated edge weights across the profile. This
	// helps us determine the percentage threshold for hot/cold
	// partitioning.
	TotalWeight int64

	// NamedEdgeMap contains all unique call edges in the profile and their
	// edge weight.
	NamedEdgeMap NamedEdgeMap
}

Profile contains the processed data from the PGO profile.

func FromPProf

func FromPProf(r io.Reader) (*Profile, error)

FromPProf parses Profile from a pprof profile.

func FromSerialized

func FromSerialized(r io.Reader) (*Profile, error)

FromSerialized parses a profile from serialization output of Profile.WriteTo.

func (*Profile) WriteTo

func (d *Profile) WriteTo(w io.Writer) (int64, error)

WriteTo writes a serialized representation of Profile to w.

FromSerialized can parse the format back to Profile.

WriteTo implements io.WriterTo.Write.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL