profile

package standard library
go1.23.3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package profile represents a pprof profile as a directed graph.

This package is a simplified fork of github.com/google/pprof/internal/graph.

Package profile provides a representation of github.com/google/pprof/proto/profile.proto and methods to encode/decode/merge profiles in this format.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoData = fmt.Errorf("empty input file")

Functions

This section is empty.

Types

type Demangler

type Demangler func(name []string) (map[string]string, error)

Demangler maps symbol names to a human-readable form. This may include C++ demangling and additional simplification. Names that are not demangled may be missing from the resulting map.

type Edge added in go1.23.0

type Edge struct {
	Src, Dest *Node
	// The summary weight of the edge
	Weight, WeightDiv int64

	// residual edges connect nodes that were connected through a
	// separate node, which has been removed from the report.
	Residual bool
	// An inline edge represents a call that was inlined into the caller.
	Inline bool
}

Edge contains any attributes to be represented about edges in a graph.

func (*Edge) WeightValue added in go1.23.0

func (e *Edge) WeightValue() int64

WeightValue returns the weight value for this edge, normalizing if a divisor is available.

type EdgeMap added in go1.23.0

type EdgeMap []*Edge

EdgeMap is used to represent the incoming/outgoing edges from a node.

func (*EdgeMap) Add added in go1.23.0

func (em *EdgeMap) Add(e *Edge)

func (*EdgeMap) Delete added in go1.23.0

func (em *EdgeMap) Delete(e *Edge)

func (EdgeMap) FindTo added in go1.23.0

func (em EdgeMap) FindTo(n *Node) *Edge

func (EdgeMap) Sort added in go1.23.0

func (em EdgeMap) Sort() []*Edge

Sort returns a slice of the edges in the map, in a consistent order. The sort order is first based on the edge weight (higher-to-lower) and then by the node names to avoid flakiness.

func (EdgeMap) Sum added in go1.23.0

func (em EdgeMap) Sum() int64

Sum returns the total weight for a set of nodes.

type Function

type Function struct {
	ID         uint64
	Name       string
	SystemName string
	Filename   string
	StartLine  int64
	// contains filtered or unexported fields
}

Function corresponds to Profile.Function

type Graph added in go1.23.0

type Graph struct {
	Nodes Nodes
}

Graph summarizes a performance profile into a format that is suitable for visualization.

func NewGraph added in go1.23.0

func NewGraph(prof *Profile, o *Options) *Graph

NewGraph computes a graph from a profile.

func (*Graph) String added in go1.23.0

func (g *Graph) String() string

String returns a text representation of a graph, for debugging purposes.

type Label

type Label struct {
	// contains filtered or unexported fields
}

Label corresponds to Profile.Label

type Line

type Line struct {
	Function *Function
	Line     int64
	// contains filtered or unexported fields
}

Line corresponds to Profile.Line

type Location

type Location struct {
	ID       uint64
	Mapping  *Mapping
	Address  uint64
	Line     []Line
	IsFolded bool
	// contains filtered or unexported fields
}

Location corresponds to Profile.Location

type Mapping

type Mapping struct {
	ID              uint64
	Start           uint64
	Limit           uint64
	Offset          uint64
	File            string
	BuildID         string
	HasFunctions