diff options
| author | Dmitri Shuralyov <dmitshur@golang.org> | 2025-12-01 11:29:26 -0500 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-12-01 09:15:40 -0800 |
| commit | 4be545115cf8ed42aa0337cbb6c3a92f718192b9 (patch) | |
| tree | dd7495ce97f9d540edc8c71d762d9b8d5c6f0062 /src/cmd | |
| parent | 16c0f7e1524c40521312e485b0b0f8b26c95b174 (diff) | |
| download | go-4be545115cf8ed42aa0337cbb6c3a92f718192b9.tar.xz | |
cmd/pprof: update vendored github.com/google/pprof
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>
Diffstat (limited to 'src/cmd')
10 files changed, 77 insertions, 41 deletions
diff --git a/src/cmd/go.mod b/src/cmd/go.mod index 64bb4c3d79..9a1a38bccc 100644 --- a/src/cmd/go.mod +++ b/src/cmd/go.mod @@ -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 diff --git a/src/cmd/go.sum b/src/cmd/go.sum index 489f9bfb00..52d55d8173 100644 --- a/src/cmd/go.sum +++ b/src/cmd/go.sum @@ -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= diff --git a/src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner_llvm.go b/src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner_llvm.go index 2f5d97e89a..c5c7cc0e10 100644 --- a/src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner_llvm.go +++ b/src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner_llvm.go @@ -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 { diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/config.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/config.go index 184de397ef..20d169c8f6 100644 --- a/src/cmd/vendor/github.com/google/pprof/internal/driver/config.go +++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/config.go @@ -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"), ",") diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/html/header.html b/src/cmd/vendor/github.com/google/pprof/internal/driver/html/header.html index 5405a0be95..4d0f198a69 100644 --- a/src/cmd/vendor/github.com/google/pprof/internal/driver/html/header.html +++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/html/header.html @@ -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> diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/webui.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/webui.go index ac7465c93e..568a5cb99a 100644 --- a/src/cmd/vendor/github.com/google/pprof/internal/driver/webui.go +++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/webui.go @@ -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), }, } 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 c4b0d4869f..ee7a700174 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 @@ -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 diff --git a/src/cmd/vendor/github.com/google/pprof/internal/plugin/plugin.go b/src/cmd/vendor/github.com/google/pprof/internal/plugin/plugin.go index 2692c72276..e6f0827633 100644 --- a/src/cmd/vendor/github.com/google/pprof/internal/plugin/plugin.go +++ b/src/cmd/vendor/github.com/google/pprof/internal/plugin/plugin.go @@ -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. diff --git a/src/cmd/vendor/github.com/google/pprof/profile/proto.go b/src/cmd/vendor/github.com/google/pprof/profile/proto.go index a15696ba16..31bf6bca63 100644 --- a/src/cmd/vendor/github.com/google/pprof/profile/proto.go +++ b/src/cmd/vendor/github.com/google/pprof/profile/proto.go @@ -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 diff --git a/src/cmd/vendor/modules.txt b/src/cmd/vendor/modules.txt index a5e5cf0551..8641f2dca3 100644 --- a/src/cmd/vendor/modules.txt +++ b/src/cmd/vendor/modules.txt @@ -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 |
