]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/vendor: sync pprof@v0.0.0-20201007051231-1066cbb265c7
authorHana <hyangah@gmail.com>
Wed, 7 Oct 2020 21:27:42 +0000 (17:27 -0400)
committerHyang-Ah Hana Kim <hyangah@gmail.com>
Thu, 22 Oct 2020 23:33:06 +0000 (23:33 +0000)
This is a belated early sync for 1.16 dev cycle

For #36905

Change-Id: I387528ae897794841c0c78b0f0910fc5ce8599ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/260538
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
src/cmd/go.mod
src/cmd/go.sum
src/cmd/vendor/github.com/google/pprof/internal/driver/driver_focus.go
src/cmd/vendor/github.com/google/pprof/internal/driver/tempfile.go
src/cmd/vendor/github.com/google/pprof/internal/graph/dotgraph.go
src/cmd/vendor/github.com/google/pprof/internal/report/report.go
src/cmd/vendor/modules.txt

index 4d4320aa9b01372565f118865fccaf0d5aad8427..f79b238a1dea6426622fb244ea7b34ea89a38cf7 100644 (file)
@@ -3,7 +3,7 @@ module cmd
 go 1.16
 
 require (
-       github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99
+       github.com/google/pprof v0.0.0-20201007051231-1066cbb265c7
        github.com/ianlancetaylor/demangle v0.0.0-20200414190113-039b1ae3a340 // indirect
        golang.org/x/arch v0.0.0-20201008161808-52c3e6f60cff
        golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a
index 3f2562a040d741ceea284550a7586fdbbfa8c395..6eff8a2c57bc04b795067f403ed5f0475f1792dc 100644 (file)
@@ -1,8 +1,8 @@
 github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
 github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
 github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
-github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99 h1:Ak8CrdlwwXwAZxzS66vgPt4U8yUZX7JwLvVR58FN5jM=
-github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
+github.com/google/pprof v0.0.0-20201007051231-1066cbb265c7 h1:qYWTuM6SUNWgtvkhV8oH6GFHCpU+rKQOxPcepM3xKi0=
+github.com/google/pprof v0.0.0-20201007051231-1066cbb265c7/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
 github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
 github.com/ianlancetaylor/demangle v0.0.0-20200414190113-039b1ae3a340 h1:S1+yTUaFPXuDZnPDbO+TrDFIjPzQraYH8/CwSlu9Fac=
 github.com/ianlancetaylor/demangle v0.0.0-20200414190113-039b1ae3a340/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
index 048ba17cb09852f8b7305419d28dfc253482ec68..fd05adb1469993d1214ddf576a652768b68c6199 100644 (file)
@@ -58,7 +58,7 @@ func applyFocus(prof *profile.Profile, numLabelUnits map[string]string, cfg conf
        taghide, err := compileRegexOption("taghide", cfg.TagHide, err)
        tns, tnh := prof.FilterTagsByName(tagshow, taghide)
        warnNoMatches(tagshow == nil || tns, "TagShow", ui)
-       warnNoMatches(tagignore == nil || tnh, "TagHide", ui)
+       warnNoMatches(taghide == nil || tnh, "TagHide", ui)
 
        if prunefrom != nil {
                prof.PruneFrom(prunefrom)
index 28679f1c1554993b2a859a66c5e0a5f1a03b0dce..b6c8776ff83ab90b58a66ad2733f76f6c23a7028 100644 (file)
@@ -24,9 +24,11 @@ import (
 // newTempFile returns a new output file in dir with the provided prefix and suffix.
 func newTempFile(dir, prefix, suffix string) (*os.File, error) {
        for index := 1; index < 10000; index++ {
-               path := filepath.Join(dir, fmt.Sprintf("%s%03d%s", prefix, index, suffix))
-               if _, err := os.Stat(path); err != nil {
-                       return os.Create(path)
+               switch f, err := os.OpenFile(filepath.Join(dir, fmt.Sprintf("%s%03d%s", prefix, index, suffix)), os.O_RDWR|os.O_CREATE|os.O_EXCL, 0666); {
+               case err == nil:
+                       return f, nil
+               case !os.IsExist(err):
+                       return nil, err
                }
        }
        // Give up
@@ -44,11 +46,15 @@ func deferDeleteTempFile(path string) {
 }
 
 // cleanupTempFiles removes any temporary files selected for deferred cleaning.
-func cleanupTempFiles() {
+func cleanupTempFiles() error {
        tempFilesMu.Lock()
+       defer tempFilesMu.Unlock()
+       var lastErr error
        for _, f := range tempFiles {
-               os.Remove(f)
+               if err := os.Remove(f); err != nil {
+                       lastErr = err
+               }
        }
        tempFiles = nil
-       tempFilesMu.Unlock()
+       return lastErr
 }
index 09debfb007984dd9ae8eb5a807b8d1fe9d874538..cde648f20bcad66ac3c8aba9e9e320f84b2cbbe3 100644 (file)
@@ -127,7 +127,7 @@ func (b *builder) addLegend() {
        }
        title := labels[0]
        fmt.Fprintf(b, `subgraph cluster_L { "%s" [shape=box fontsize=16`, title)
-       fmt.Fprintf(b, ` label="%s\l"`, strings.Join(labels, `\l`))
+       fmt.Fprintf(b, ` label="%s\l"`, strings.Join(escapeForDot(labels), `\l`))
        if b.config.LegendURL != "" {
                fmt.Fprintf(b, ` URL="%s" target="_blank"`, b.config.LegendURL)
        }
@@ -472,3 +472,14 @@ func min64(a, b int64) int64 {
        }
        return b
 }
+
+// escapeForDot escapes double quotes and backslashes, and replaces Graphviz's
+// "center" character (\n) with a left-justified character.
+// See https://graphviz.org/doc/info/attrs.html#k:escString for more info.
+func escapeForDot(in []string) []string {
+       var out = make([]string, len(in))
+       for i := range in {
+               out[i] = strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll(in[i], `\`, `\\`), `"`, `\"`), "\n", `\l`)
+       }
+       return out
+}
index a34520891029032cdf47307176d8e71cd6b41a95..bc5685d61e1b16eec1c4516198b518126092634a 100644 (file)
@@ -1207,7 +1207,7 @@ func reportLabels(rpt *Report, g *graph.Graph, origCount, droppedNodes, droppedE
        // Help new users understand the graph.
        // A new line is intentionally added here to better show this message.
        if fullHeaders {
-               label = append(label, "\\lSee https://git.io/JfYMW for how to read the graph")
+               label = append(label, "\nSee https://git.io/JfYMW for how to read the graph")
        }
 
        return label
index 75a118f039c5da7239dc040671511f74fcf2a1e7..4be3a2b68000ceda5e1984d814164636ffd1faed 100644 (file)
@@ -1,4 +1,4 @@
-# github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99
+# github.com/google/pprof v0.0.0-20201007051231-1066cbb265c7
 ## explicit
 github.com/google/pprof/driver
 github.com/google/pprof/internal/binutils