MCPcopy Create free account
hub / github.com/google/pprof / String

Method String

internal/graph/graph.go:726–748  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

724
725// String returns a text representation of a graph, for debugging purposes.
726func (g *Graph) String() string {
727 var s []string
728
729 nodeIndex := make(map[*Node]int, len(g.Nodes))
730
731 for i, n := range g.Nodes {
732 nodeIndex[n] = i + 1
733 }
734
735 for i, n := range g.Nodes {
736 name := n.Info.PrintableName()
737 var in, out []int
738
739 for _, from := range n.In {
740 in = append(in, nodeIndex[from.Src])
741 }
742 for _, to := range n.Out {
743 out = append(out, nodeIndex[to.Dest])
744 }
745 s = append(s, fmt.Sprintf("%d: %s[flat=%d cum=%d] %x -> %v ", i+1, name, n.Flat, n.Cum, in, out))
746 }
747 return strings.Join(s, "\n")
748}
749
750// DiscardLowFrequencyNodes returns a set of the nodes at or over a
751// specific cum value cutoff.

Callers

nothing calls this directly

Calls 1

PrintableNameMethod · 0.80

Tested by

no test coverage detected