Documentation ¶
Overview ¶
Package graph represents a pprof profile as a directed graph.
This package is a simplified fork of github.com/google/pprof/github.com/go-asm/go/graph.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Edge ¶
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 ¶
WeightValue returns the weight value for this edge, normalizing if a divisor is available.
type EdgeMap ¶
type EdgeMap []*Edge
EdgeMap is used to represent the incoming/outgoing edges from a node.
type Graph ¶
type Graph struct {
Nodes Nodes
}
Graph summarizes a performance profile into a format that is suitable for visualization.
type Node ¶
type Node struct { // Info describes the source location associated to this node. Info NodeInfo // Function represents the function that this node belongs to. On // graphs with sub-function resolution (eg line number or // addresses), two nodes in a NodeMap that are part of the same // function have the same value of Node.Function. If the Node // represents the whole function, it points back to itself. Function *Node // Values associated to this node. Flat is exclusive to this node, // Cum includes all descendents. Flat, FlatDiv, Cum, CumDiv int64 // In and out Contains the nodes immediately reaching or reached by // this node. In, Out EdgeMap }
Node is an entry on a profiling report. It represents a unique program location.
func (*Node) AddToEdge ¶
AddToEdge increases the weight of an edge between two nodes. If there isn't such an edge one is created.
func (*Node) AddToEdgeDiv ¶
AddToEdgeDiv increases the weight of an edge between two nodes. If there isn't such an edge one is created.
type NodeInfo ¶
NodeInfo contains the attributes for a node.
func (*NodeInfo) NameComponents ¶
NameComponents returns the components of the printable name to be used for a node.
func (*NodeInfo) PrintableName ¶
PrintableName calls the Node's Formatter function with a single space separator.
type NodeMap ¶
NodeMap maps from a node info struct to a node. It is used to merge report entries with the same info.
func (NodeMap) FindOrInsertNode ¶
FindOrInsertNode takes the info for a node and either returns a matching node from the node map if one exists, or adds one to the map if one does not. If kept is non-nil, nodes are only added if they can be located on it.
type NodePtrSet ¶
NodePtrSet is a collection of nodes. Trimming a graph or tree requires a set of objects which uniquely identify the nodes to keep. In a graph, NodeInfo works as a unique identifier; however, in a tree multiple nodes may share identical NodeInfos. A *Node does uniquely identify a node so we can use that instead. Though a *Node also uniquely identifies a node in a graph, currently, during trimming, graphs are rebuilt from scratch using only the NodeSet, so there would not be the required context of the initial graph to allow for the use of *Node.
type Nodes ¶
type Nodes []*Node
Nodes is an ordered collection of graph nodes.
func CreateNodes ¶
CreateNodes creates graph nodes for all locations in a profile. It returns set of all nodes, plus a mapping of each location to the set of corresponding nodes (one per location.Line).
type Options ¶
type Options struct { SampleValue func(s []int64) int64 // Function to compute the value of a sample SampleMeanDivisor func(s []int64) int64 // Function to compute the divisor for mean graphs, or nil DropNegative bool // Drop nodes with overall negative values KeptNodes NodeSet // If non-nil, only use nodes in this set }
Options encodes the options for constructing a graph