]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/pprof: update vendored github.com/google/pprof
authorDmitri Shuralyov <dmitshur@golang.org>
Mon, 1 Dec 2025 16:29:26 +0000 (11:29 -0500)
committerGopher Robot <gobot@golang.org>
Mon, 1 Dec 2025 17:15:40 +0000 (09:15 -0800)
Pull in the latest published version of github.com/google/pprof
as part of the continuous process of keeping Go's dependencies
up to date.

For #36905.

[git-generate]
cd src/cmd
go get github.com/google/pprof@v0.0.0-20251114195745-4902fdda35c8
go mod tidy
go mod vendor

Change-Id: Id26eb632f637fb2c602d87cb83fdff7f099934ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/725500
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/cmd/go.mod
src/cmd/go.sum
src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner_llvm.go
src/cmd/vendor/github.com/google/pprof/internal/driver/config.go
src/cmd/vendor/github.com/google/pprof/internal/driver/html/header.html
src/cmd/vendor/github.com/google/pprof/internal/driver/webui.go
src/cmd/vendor/github.com/google/pprof/internal/graph/graph.go
src/cmd/vendor/github.com/google/pprof/internal/plugin/plugin.go
src/cmd/vendor/github.com/google/pprof/profile/proto.go
src/cmd/vendor/modules.txt

index 64bb4c3d791af8fd7dd67b56667747e7ea5c7c8d..9a1a38bccca6b5a1abf818ba08f21ec39b1147b4 100644 (file)
@@ -3,7 +3,7 @@ module cmd
 go 1.26
 
 require (
-       github.com/google/pprof v0.0.0-20250630185457-6e76a2b096b5
+       github.com/google/pprof v0.0.0-20251114195745-4902fdda35c8
        golang.org/x/arch v0.23.0
        golang.org/x/build v0.0.0-20251128064159-b9bfd88b30e8
        golang.org/x/mod v0.30.1-0.20251115032019-269c237cf350
index 489f9bfb001167d2b4c6d85a3a7a85c21fbbea3c..52d55d81732f7f2671f4f7aa3033b1c31cf69bf9 100644 (file)
@@ -1,7 +1,7 @@
 github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
 github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
-github.com/google/pprof v0.0.0-20250630185457-6e76a2b096b5 h1:xhMrHhTJ6zxu3gA4enFM9MLn9AY7613teCdFnlUVbSQ=
-github.com/google/pprof v0.0.0-20250630185457-6e76a2b096b5/go.mod h1:5hDyRhoBCxViHszMt12TnOpEI4VVi+U8Gm9iphldiMA=
+github.com/google/pprof v0.0.0-20251114195745-4902fdda35c8 h1:3DsUAV+VNEQa2CUVLxCY3f87278uWfIDhJnbdvDjvmE=
+github.com/google/pprof v0.0.0-20251114195745-4902fdda35c8/go.mod h1:I6V7YzU0XDpsHqbsyrghnFZLO1gwK6NPTNvmetQIk9U=
 github.com/ianlancetaylor/demangle v0.0.0-20250417193237-f615e6bd150b h1:ogbOPx86mIhFy764gGkqnkFC8m5PJA7sPzlk9ppLVQA=
 github.com/ianlancetaylor/demangle v0.0.0-20250417193237-f615e6bd150b/go.mod h1:gx7rwoVhcfuVKG5uya9Hs3Sxj7EIvldVofAWIUtGouw=
 github.com/yuin/goldmark v1.6.0 h1:boZcn2GTjpsynOsC0iJHnBWa4Bi0qzfJjthwauItG68=
index 2f5d97e89a669c061ac306cb570def1cfc73f977..c5c7cc0e10ca56b0f6fdb86357223a565c16f3eb 100644 (file)
@@ -151,11 +151,11 @@ func (d *llvmSymbolizer) readCodeFrames() ([]plugin.Frame, error) {
                Address    string `json:"Address"`
                ModuleName string `json:"ModuleName"`
                Symbol     []struct {
-                       Line          int    `json:"Line"`
-                       Column        int    `json:"Column"`
-                       FunctionName  string `json:"FunctionName"`
-                       FileName      string `json:"FileName"`
-                       StartLine     int    `json:"StartLine"`
+                       Line         int    `json:"Line"`
+                       Column       int    `json:"Column"`
+                       FunctionName string `json:"FunctionName"`
+                       FileName     string `json:"FileName"`
+                       StartLine    int    `json:"StartLine"`
                } `json:"Symbol"`
        }
        if err := json.Unmarshal([]byte(line), &frame); err != nil {
index 184de397ef57e4af0ee397123472d368faea7716..20d169c8f68e8737b5b01d10bb737abc45b38b43 100644 (file)
@@ -164,7 +164,7 @@ func init() {
 
        def := defaultConfig()
        configFieldMap = map[string]configField{}
-       t := reflect.TypeOf(config{})
+       t := reflect.TypeFor[config]()
        for i, n := 0, t.NumField(); i < n; i++ {
                field := t.Field(i)
                js := strings.Split(field.Tag.Get("json"), ",")
index 5405a0be955421ea82654fee7971f5d2e61265d8..4d0f198a69598442575070dad8690a86b48852a1 100644 (file)
@@ -10,7 +10,7 @@
     </div>
     <div class="submenu">
       <a title="{{.Help.top}}"  href="./top" id="topbtn">Top</a>
-      <a title="{{.Help.graph}}" href="./" id="graphbtn">Graph</a>
+      <a title="{{.Help.graph}}" href="./graph" id="graphbtn">Graph</a>
       <a title="{{.Help.flamegraph}}" href="./flamegraph" id="flamegraph">Flame Graph</a>
       <a title="{{.Help.peek}}" href="./peek" id="peek">Peek</a>
       <a title="{{.Help.list}}" href="./source" id="list">Source</a>
index ac7465c93e6c12a103f08718f6b08809798ebc41..568a5cb99a7dbb55244616395036eb4654214e32 100644 (file)
@@ -125,21 +125,23 @@ func serveWebInterface(hostport string, p *profile.Profile, o *plugin.Options, d
                Host:     host,
                Port:     port,
                Handlers: map[string]http.Handler{
-                       "/":              http.HandlerFunc(ui.dot),
-                       "/top":           http.HandlerFunc(ui.top),
-                       "/disasm":        http.HandlerFunc(ui.disasm),
-                       "/source":        http.HandlerFunc(ui.source),
-                       "/peek":          http.HandlerFunc(ui.peek),
-                       "/flamegraph":    http.HandlerFunc(ui.stackView),
-                       "/flamegraph2":   redirectWithQuery("flamegraph", http.StatusMovedPermanently), // Keep legacy URL working.
-                       "/flamegraphold": redirectWithQuery("flamegraph", http.StatusMovedPermanently), // Keep legacy URL working.
-                       "/saveconfig":    http.HandlerFunc(ui.saveConfig),
-                       "/deleteconfig":  http.HandlerFunc(ui.deleteConfig),
+                       "/":             redirectWithQuery("flamegraph", http.StatusMovedPermanently),
+                       "/graph":        http.HandlerFunc(ui.dot),
+                       "/top":          http.HandlerFunc(ui.top),
+                       "/disasm":       http.HandlerFunc(ui.disasm),
+                       "/source":       http.HandlerFunc(ui.source),
+                       "/peek":         http.HandlerFunc(ui.peek),
+                       "/flamegraph":   http.HandlerFunc(ui.stackView),
+                       "/saveconfig":   http.HandlerFunc(ui.saveConfig),
+                       "/deleteconfig": http.HandlerFunc(ui.deleteConfig),
                        "/download": http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
                                w.Header().Set("Content-Type", "application/vnd.google.protobuf+gzip")
                                w.Header().Set("Content-Disposition", "attachment;filename=profile.pb.gz")
                                p.Write(w)
                        }),
+                       // Keep legacy URLs working.
+                       "/flamegraph2":   redirectWithQuery("flamegraph", http.StatusMovedPermanently),
+                       "/flamegraphold": redirectWithQuery("flamegraph", http.StatusMovedPermanently),
                },
        }
 
index c4b0d4869f5316d57a2fa7640ec0b418ffe511d2..ee7a7001743621b06828ce0af2bc90758b201289 100644 (file)
@@ -196,6 +196,21 @@ func (i *NodeInfo) NameComponents() []string {
        return name
 }
 
+// comparePrintableName compares NodeInfo lexicographically the same way as `i.PrintableName() < right.PrintableName()`, but much more performant.
+func (i *NodeInfo) comparePrintableName(right NodeInfo) (equal bool, less bool) {
+       if right == *i {
+               return true, false
+       }
+
+       if i.Address != 0 && right.Address != 0 && i.Address != right.Address {
+               // comparing ints directly is the same as comparing padded hex from fmt.Sprintf("%016x", Address)
+               return false, i.Address < right.Address
+       }
+
+       // fallback
+       return false, i.PrintableName() < right.PrintableName()
+}
+
 // NodeMap maps from a node info struct to a node. It is used to merge
 // report entries with the same info.
 type NodeMap map[NodeInfo]*Node
@@ -583,17 +598,16 @@ func (nm NodeMap) findOrInsertLine(l *profile.Location, li profile.Line, o *Opti
                objfile = m.File
        }
 
-       if ni := nodeInfo(l, li, objfile, o); ni != nil {
-               return nm.FindOrInsertNode(*ni, o.KeptNodes)
-       }
-       return nil
+       ni := nodeInfo(l, li, objfile, o)
+
+       return nm.FindOrInsertNode(ni, o.KeptNodes)
 }
 
-func nodeInfo(l *profile.Location, line profile.Line, objfile string, o *Options) *NodeInfo {
+func nodeInfo(l *profile.Location, line profile.Line, objfile string, o *Options) NodeInfo {
        if line.Function == nil {
-               return &NodeInfo{Address: l.Address, Objfile: objfile}
+               return NodeInfo{Address: l.Address, Objfile: objfile}
        }
-       ni := &NodeInfo{
+       ni := NodeInfo{
                Address:  l.Address,
                Lineno:   int(line.Line),
                Columnno: int(line.Column),
@@ -951,8 +965,9 @@ func (ns Nodes) Sort(o NodeOrder) error {
                                if iv, jv := abs64(l.Flat), abs64(r.Flat); iv != jv {
                                        return iv > jv
                                }
-                               if iv, jv := l.Info.PrintableName(), r.Info.PrintableName(); iv != jv {
-                                       return iv < jv
+                               equal, leftLess := l.Info.comparePrintableName(r.Info)
+                               if !equal {
+                                       return leftLess
                                }
                                if iv, jv := abs64(l.Cum), abs64(r.Cum); iv != jv {
                                        return iv > jv
@@ -969,8 +984,9 @@ func (ns Nodes) Sort(o NodeOrder) error {
                                if iv, jv := abs64(l.Cum), abs64(r.Cum); iv != jv {
                                        return iv > jv
                                }
-                               if iv, jv := l.Info.PrintableName(), r.Info.PrintableName(); iv != jv {
-                                       return iv < jv
+                               equal, leftLess := l.Info.comparePrintableName(r.Info)
+                               if !equal {
+                                       return leftLess
                                }
                                return compareNodes(l, r)
                        },
@@ -1012,8 +1028,9 @@ func (ns Nodes) Sort(o NodeOrder) error {
                        if iv, jv := abs64(score[l]), abs64(score[r]); iv != jv {
                                return iv > jv
                        }
-                       if iv, jv := l.Info.PrintableName(), r.Info.PrintableName(); iv != jv {
-                               return iv < jv
+                       equal, leftLess := l.Info.comparePrintableName(r.Info)
+                       if !equal {
+                               return leftLess
                        }
                        if iv, jv := abs64(l.Flat), abs64(r.Flat); iv != jv {
                                return iv > jv
index 2692c722763f392efde05767359aa27f0a0c54d6..e6f0827633dba2fe9c92d3dd4fdfc8e7e25fee0a 100644 (file)
@@ -159,11 +159,11 @@ type ObjFile interface {
 
 // A Frame describes a location in a single line in a source file.
 type Frame struct {
-       Func          string // name of function
-       File          string // source file name
-       Line          int    // line in file
-       Column        int    // column in line (if available)
-       StartLine     int    // start line of function (if available)
+       Func      string // name of function
+       File      string // source file name
+       Line      int    // line in file
+       Column    int    // column in line (if available)
+       StartLine int    // start line of function (if available)
 }
 
 // A Sym describes a single symbol in an object file.
index a15696ba16f24448c3e81163c6d41b277eec104e..31bf6bca63eca29471f0de58a15d70bb150dae29 100644 (file)
@@ -36,6 +36,7 @@ package profile
 import (
        "errors"
        "fmt"
+       "slices"
 )
 
 type buffer struct {
@@ -187,6 +188,16 @@ func le32(p []byte) uint32 {
        return uint32(p[0]) | uint32(p[1])<<8 | uint32(p[2])<<16 | uint32(p[3])<<24
 }
 
+func peekNumVarints(data []byte) (numVarints int) {
+       for ; len(data) > 0; numVarints++ {
+               var err error
+               if _, data, err = decodeVarint(data); err != nil {
+                       break
+               }
+       }
+       return numVarints
+}
+
 func decodeVarint(data []byte) (uint64, []byte, error) {
        var u uint64
        for i := 0; ; i++ {
@@ -286,6 +297,9 @@ func decodeInt64(b *buffer, x *int64) error {
 func decodeInt64s(b *buffer, x *[]int64) error {
        if b.typ == 2 {
                // Packed encoding
+               dataLen := peekNumVarints(b.data)
+               *x = slices.Grow(*x, dataLen)
+
                data := b.data
                for len(data) > 0 {
                        var u uint64
@@ -316,8 +330,11 @@ func decodeUint64(b *buffer, x *uint64) error {
 
 func decodeUint64s(b *buffer, x *[]uint64) error {
        if b.typ == 2 {
-               data := b.data
                // Packed encoding
+               dataLen := peekNumVarints(b.data)
+               *x = slices.Grow(*x, dataLen)
+
+               data := b.data
                for len(data) > 0 {
                        var u uint64
                        var err error
index a5e5cf05518f5a5b40b336e50dfb1ca870fee378..8641f2dca3dde88aeb8d43f768b491f60d83f11d 100644 (file)
@@ -1,5 +1,5 @@
-# github.com/google/pprof v0.0.0-20250630185457-6e76a2b096b5
-## explicit; go 1.23.0
+# github.com/google/pprof v0.0.0-20251114195745-4902fdda35c8
+## explicit; go 1.24.0
 github.com/google/pprof/driver
 github.com/google/pprof/internal/binutils
 github.com/google/pprof/internal/driver