diff options
| author | Daniel Martí <mvdan@mvdan.cc> | 2018-02-12 16:34:48 +0000 |
|---|---|---|
| committer | Daniel Martí <mvdan@mvdan.cc> | 2018-02-15 16:25:43 +0000 |
| commit | e7cbbbe9bb878b6ca4ce04fde645df1c8f1845bd (patch) | |
| tree | f84255198234eb4870c48228cdb4828de1f4f8c5 /src/cmd/vendor/github.com/google/pprof/internal/graph | |
| parent | afb9fc1de922a4ead9d2d787613255a7ba3490f7 (diff) | |
| download | go-e7cbbbe9bb878b6ca4ce04fde645df1c8f1845bd.tar.xz | |
cmd/vendor/github.com/google/pprof: refresh from upstream
Updating to commit 0e0e5b7254e076a62326ab7305ba49e8515f0c91
from github.com/google/pprof
Recent modifications to the vendored pprof, such as skipping
TestWebInterface to avoid starting a web browser, have all been fixed
upstream.
Change-Id: I72e11108c438e1573bf2f9216e76d157378e8d45
Reviewed-on: https://go-review.googlesource.com/93375
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
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')
| -rw-r--r-- | src/cmd/vendor/github.com/google/pprof/internal/graph/dotgraph.go | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/graph/dotgraph.go b/src/cmd/vendor/github.com/google/pprof/internal/graph/dotgraph.go index 4e5d12f6cd..f3721e92f5 100644 --- a/src/cmd/vendor/github.com/google/pprof/internal/graph/dotgraph.go +++ b/src/cmd/vendor/github.com/google/pprof/internal/graph/dotgraph.go @@ -154,7 +154,7 @@ func (b *builder) addNode(node *Node, nodeID int, maxFlat float64) { if flat != 0 { label = label + fmt.Sprintf(`%s (%s)`, flatValue, - strings.TrimSpace(percentage(flat, b.config.Total))) + strings.TrimSpace(measurement.Percentage(flat, b.config.Total))) } else { label = label + "0" } @@ -168,7 +168,7 @@ func (b *builder) addNode(node *Node, nodeID int, maxFlat float64) { cumValue = b.config.FormatValue(cum) label = label + fmt.Sprintf(`of %s (%s)`, cumValue, - strings.TrimSpace(percentage(cum, b.config.Total))) + strings.TrimSpace(measurement.Percentage(cum, b.config.Total))) } // Scale font sizes from 8 to 24 based on percentage of flat frequency. @@ -380,23 +380,6 @@ func dotColor(score float64, isBackground bool) string { return fmt.Sprintf("#%02x%02x%02x", uint8(r*255.0), uint8(g*255.0), uint8(b*255.0)) } -// percentage computes the percentage of total of a value, and encodes -// it as a string. At least two digits of precision are printed. -func percentage(value, total int64) string { - var ratio float64 - if total != 0 { - ratio = math.Abs(float64(value)/float64(total)) * 100 - } - switch { - case math.Abs(ratio) >= 99.95 && math.Abs(ratio) <= 100.05: - return " 100%" - case math.Abs(ratio) >= 1.0: - return fmt.Sprintf("%5.2f%%", ratio) - default: - return fmt.Sprintf("%5.2g%%", ratio) - } -} - func multilinePrintableName(info *NodeInfo) string { infoCopy := *info infoCopy.Name = strings.Replace(infoCopy.Name, "::", `\n`, -1) |
