Involved Source Filesencode.gofilter.go Package profile represents a pprof profile as a directed graph.
This package is a simplified fork of github.com/google/pprof/internal/graph.merge.go Package profile provides a representation of
github.com/google/pprof/proto/profile.proto and
methods to encode/decode/merge profiles in this format.proto.goprune.go
Package-Level Type Names (total 20)
/* sort by: | */
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.
func (*Profile).Demangle(d Demangler) error
Edge contains any attributes to be represented about edges in a graph.Dest*Node An inline edge represents a call that was inlined into the caller. residual edges connect nodes that were connected through a
separate node, which has been removed from the report.Src*Node The summary weight of the edge The summary weight of the edge WeightValue returns the weight value for this edge, normalizing if a
divisor is available.
func EdgeMap.FindTo(n *Node) *Edge
func EdgeMap.Sort() []*Edge
func (*EdgeMap).Add(e *Edge)
func (*EdgeMap).Delete(e *Edge)
EdgeMap is used to represent the incoming/outgoing edges from a node.(*EdgeMap) Add(e *Edge)(*EdgeMap) Delete(e *Edge)( EdgeMap) FindTo(n *Node) *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. Sum returns the total weight for a set of nodes.
Graph summarizes a performance profile into a format that is
suitable for visualization.NodesNodes String returns a text representation of a graph, for debugging purposes.
*Graph : expvar.Var
*Graph : fmt.Stringer
func NewGraph(prof *Profile, o *Options) *Graph
Node is an entry on a profiling report. It represents a unique
program location. Values associated to this node. Flat is exclusive to this node,
Cum includes all descendents. Values associated to this node. Flat is exclusive to this node,
Cum includes all descendents. Values associated to this node. Flat is exclusive to this node,
Cum includes all descendents. Values associated to this node. Flat is exclusive to this node,
Cum includes all descendents. 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. In and out Contains the nodes immediately reaching or reached by
this node. Info describes the source location associated to this node. In and out Contains the nodes immediately reaching or reached by
this node. AddToEdge increases the weight of an edge between two nodes. If
there isn't such an edge one is created. AddToEdgeDiv increases the weight of an edge between two nodes. If
there isn't such an edge one is created. CumValue returns the inclusive value for this node, computing the
mean if a divisor is available. FlatValue returns the exclusive value for this node, computing the
mean if a divisor is available.
func NodeMap.FindOrInsertNode(info NodeInfo, kept NodeSet) *Node
func EdgeMap.FindTo(n *Node) *Edge
func (*Node).AddToEdge(to *Node, v int64, residual, inline bool)
func (*Node).AddToEdgeDiv(to *Node, dv, v int64, residual, inline bool)
NodeInfo contains the attributes for a node.Addressuint64LinenointNamestringStartLineint NameComponents returns the components of the printable name to be used for a node. PrintableName calls the Node's Formatter function with a single space separator.
func NodeMap.FindOrInsertNode(info NodeInfo, kept NodeSet) *Node
NodeMap maps from a node info struct to a node. It is used to merge
report entries with the same info. 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.
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.
Nodes is an ordered collection of graph nodes. Sum adds the flat and cum values of a set of nodes.
func CreateNodes(prof *Profile, o *Options) (Nodes, locationMap)
Options encodes the options for constructing a graph // Drop nodes with overall negative values // If non-nil, only use nodes in this set // Function to compute the divisor for mean graphs, or nil // Function to compute the value of a sample
func CreateNodes(prof *Profile, o *Options) (Nodes, locationMap)
func NewGraph(prof *Profile, o *Options) *Graph
Profile is an in-memory representation of profile.proto.Comments[]stringDefaultSampleTypestringDropFramesstringDurationNanosint64Function[]*FunctionKeepFramesstringLocation[]*LocationMapping[]*MappingPeriodint64PeriodType*ValueTypeSample[]*SampleSampleType[]*ValueTypeTimeNanosint64 Aggregate merges the locations in the profile into equivalence
classes preserving the request attributes. It also updates the
samples to point to the merged locations. CheckValid tests whether the profile is valid. Checks include, but are
not limited to:
- len(Profile.Sample[n].value) == len(Profile.value_unit)
- Sample.id has a corresponding Profile.Location Compatible determines if two profiles can be compared/merged.
returns nil if the profiles are compatible; otherwise an error with
details on the incompatibility. Copy makes a fully independent copy of a profile. Demangle attempts to demangle and optionally simplify any function
names referenced in the profile. It works on a best-effort basis:
it will silently preserve the original names in case of any errors. Empty reports whether the profile contains no samples. FilterSamplesByTag removes all samples from the profile, except
those that match focus and do not match the ignore regular
expression. HasFileLines determines if all locations in this profile have
symbolized file and line number information. HasFunctions determines if all locations in this profile have
symbolized function information. Merge adds profile p adjusted by ratio r into profile p. Profiles
must be compatible (same Type and SampleType).
TODO(rsilvera): consider normalizing the profiles based on the
total samples collected. Normalize normalizes the source profile by multiplying each value in profile by the
ratio of the sum of the base profile's values of that sample type to the sum of the
source profile's value of that sample type. Prune removes all nodes beneath a node matching dropRx, and not
matching keepRx. If the root node of a Sample matches, the sample
will have an empty stack. RemoveUninteresting prunes and elides profiles using built-in
tables of uninteresting function names. Scale multiplies all sample values in a profile by a constant. ScaleN multiplies each sample values in a sample by a different amount. Print dumps a text representation of a profile. Intended mainly
for debugging purposes. Write writes the profile as a gzip-compressed marshaled protobuf.
*Profile : expvar.Var
*Profile : fmt.Stringer
func Merge(srcs []*Profile) (*Profile, error)
func Parse(r io.Reader) (*Profile, error)
func (*Profile).Copy() *Profile
func internal/trace/traceviewer.BuildProfile(prof []traceviewer.ProfileRecord) *Profile
func CreateNodes(prof *Profile, o *Options) (Nodes, locationMap)
func Merge(srcs []*Profile) (*Profile, error)
func NewGraph(prof *Profile, o *Options) *Graph
func (*Profile).Compatible(pb *Profile) error
func (*Profile).Merge(pb *Profile, r float64) error
func (*Profile).Normalize(pb *Profile) error
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).
Merge merges all the profiles in profs into a single Profile.
Returns a new profile independent of the input profiles. The merged
profile is compacted to eliminate unused samples, locations,
functions and mappings. Profiles must have identical profile sample
and period types or the merge will fail. profile.Period of the
resulting profile will be the maximum of all profiles, and
profile.TimeNanos will be the earliest nonzero one.
NewGraph computes a graph from a profile.
Parse parses a profile and checks for its validity. The input must be an
encoded pprof protobuf, which may optionally be gzip-compressed.
The pages are generated with Goldsv0.7.3. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.