diff options
Diffstat (limited to 'src/cmd/vendor/github.com/google/pprof/internal/graph/graph.go')
| -rw-r--r-- | src/cmd/vendor/github.com/google/pprof/internal/graph/graph.go | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/graph/graph.go b/src/cmd/vendor/github.com/google/pprof/internal/graph/graph.go index 428e6257c7..7947e2dd42 100644 --- a/src/cmd/vendor/github.com/google/pprof/internal/graph/graph.go +++ b/src/cmd/vendor/github.com/google/pprof/internal/graph/graph.go @@ -240,6 +240,8 @@ type Edge struct { Inline bool } +// WeightValue returns the weight value for this edge, normalizing if a +// divisor is available. func (e *Edge) WeightValue() int64 { if e.WeightDiv == 0 { return e.Weight @@ -800,7 +802,11 @@ func (g *Graph) selectTopNodes(maxNodes int, visualMode bool) Nodes { // If generating a visual graph, count tags as nodes. Update // maxNodes to account for them. for i, n := range g.Nodes { - if count += countTags(n) + 1; count >= maxNodes { + tags := countTags(n) + if tags > maxNodelets { + tags = maxNodelets + } + if count += tags + 1; count >= maxNodes { maxNodes = i + 1 break } @@ -832,17 +838,6 @@ func countTags(n *Node) int { return count } -// countEdges counts the number of edges below the specified cutoff. -func countEdges(el EdgeMap, cutoff int64) int { - count := 0 - for _, e := range el { - if e.Weight > cutoff { - count++ - } - } - return count -} - // RemoveRedundantEdges removes residual edges if the destination can // be reached through another path. This is done to simplify the graph // while preserving connectivity. |
