aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/vendor/github.com/google/pprof/internal/graph/graph.go
diff options
context:
space:
mode:
authorAlberto Donizetti <alb.donizetti@gmail.com>2017-06-20 17:40:21 +0200
committerBrad Fitzpatrick <bradfitz@golang.org>2017-06-20 18:31:06 +0000
commit3d13b5e00c9bc065d83e27d787a64adc683cea02 (patch)
tree60f71d89af63a6ee45cc73e79336c271511c5883 /src/cmd/vendor/github.com/google/pprof/internal/graph/graph.go
parentdc8b4e65a7a68e102484020efbf80cecd2d515bd (diff)
downloadgo-3d13b5e00c9bc065d83e27d787a64adc683cea02.tar.xz
cmd/vendor/github.com/google/pprof: refresh from upstream
Updating to commit fffc5831a499a958516664a34cb7ba2b9e228793 from github.com/google/pprof Fixes #19380 Change-Id: I7a0c64101f42b494c4a469c41628374272eccf95 Reviewed-on: https://go-review.googlesource.com/46155 Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
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.go19
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.