aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/vendor/github.com
diff options
context:
space:
mode:
authorDmitri Shuralyov <dmitshur@golang.org>2025-08-13 16:48:59 -0400
committerGopher Robot <gobot@golang.org>2025-08-13 15:06:59 -0700
commitde9b6f98759f718fb48ecef22c2275ac98f1871d (patch)
tree98c235d281d99e2b7c18a3cd5af57fc05edad369 /src/cmd/vendor/github.com
parent674c5f0edd82b5d1dd5cb44eb4b85830245c151e (diff)
downloadgo-de9b6f98759f718fb48ecef22c2275ac98f1871d.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-20250630185457-6e76a2b096b5 go mod tidy go mod vendor Change-Id: Icfa35291f629fcffae67238704e59e17ee05e0b5 Reviewed-on: https://go-review.googlesource.com/c/go/+/696015 Reviewed-by: David Chase <drchase@google.com> 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>
Diffstat (limited to 'src/cmd/vendor/github.com')
-rw-r--r--src/cmd/vendor/github.com/google/pprof/driver/driver.go5
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/driver/config.go9
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/driver/driver_focus.go7
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go5
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/driver/html/common.css4
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/driver/html/stacks.js2
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/driver/webui.go13
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/elfexec/elfexec.go4
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/graph/graph.go13
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/measurement/measurement.go9
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/report/report.go2
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/report/source.go10
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/symbolizer/symbolizer.go11
-rw-r--r--src/cmd/vendor/github.com/google/pprof/profile/merge.go11
-rw-r--r--src/cmd/vendor/github.com/google/pprof/profile/profile.go20
-rw-r--r--src/cmd/vendor/github.com/google/pprof/profile/prune.go9
-rw-r--r--src/cmd/vendor/github.com/google/pprof/third_party/svgpan/svgpan.js2
-rw-r--r--src/cmd/vendor/github.com/ianlancetaylor/demangle/demangle.go2
18 files changed, 58 insertions, 80 deletions
diff --git a/src/cmd/vendor/github.com/google/pprof/driver/driver.go b/src/cmd/vendor/github.com/google/pprof/driver/driver.go
index 989aac32ff..657a673521 100644
--- a/src/cmd/vendor/github.com/google/pprof/driver/driver.go
+++ b/src/cmd/vendor/github.com/google/pprof/driver/driver.go
@@ -17,6 +17,7 @@ package driver
import (
"io"
+ "maps"
"net/http"
"regexp"
"time"
@@ -293,8 +294,6 @@ type internalSymbolizer struct {
func (s *internalSymbolizer) Symbolize(mode string, srcs plugin.MappingSources, prof *profile.Profile) error {
isrcs := MappingSources{}
- for m, s := range srcs {
- isrcs[m] = s
- }
+ maps.Copy(isrcs, srcs)
return s.Symbolizer.Symbolize(mode, isrcs, prof)
}
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 090230e2a7..184de397ef 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
@@ -4,6 +4,7 @@ import (
"fmt"
"net/url"
"reflect"
+ "slices"
"strconv"
"strings"
"sync"
@@ -226,11 +227,9 @@ func (cfg *config) set(f configField, value string) error {
case *string:
if len(f.choices) > 0 {
// Verify that value is one of the allowed choices.
- for _, choice := range f.choices {
- if choice == value {
- *ptr = value
- return nil
- }
+ if slices.Contains(f.choices, value) {
+ *ptr = value
+ return nil
}
return fmt.Errorf("invalid %q value %q", f.name, value)
}
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/driver_focus.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/driver_focus.go
index fd05adb146..fb9c35c601 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/driver_focus.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/driver_focus.go
@@ -17,6 +17,7 @@ package driver
import (
"fmt"
"regexp"
+ "slices"
"strconv"
"strings"
@@ -148,10 +149,8 @@ func compileTagFilter(name, value string, numLabelUnits map[string]string, ui pl
return func(s *profile.Sample) bool {
if vals, ok := s.Label[wantKey]; ok {
for _, rx := range rfx {
- for _, val := range vals {
- if rx.MatchString(val) {
- return true
- }
+ if slices.ContainsFunc(vals, rx.MatchString) {
+ return true
}
}
}
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go
index a94ddf6adb..969c1dac11 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go
@@ -174,10 +174,7 @@ func chunkedGrab(sources []profileSource, fetch plugin.Fetcher, obj plugin.ObjTo
var count int
for start := 0; start < len(sources); start += chunkSize {
- end := start + chunkSize
- if end > len(sources) {
- end = len(sources)
- }
+ end := min(start+chunkSize, len(sources))
chunkP, chunkMsrc, chunkSave, chunkCount, chunkErr := concurrentGrab(sources[start:end], fetch, obj, ui, tr)
switch {
case chunkErr != nil:
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/html/common.css b/src/cmd/vendor/github.com/google/pprof/internal/driver/html/common.css
index 0a897ce291..8c7693d0a7 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/html/common.css
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/html/common.css
@@ -218,10 +218,12 @@ a {
}
#graph {
overflow: hidden;
+ width: 100%;
+ height: 100%;
}
#graph svg {
width: 100%;
- height: auto;
+ height: 100%;
padding: 10px;
}
#content.source .filename {
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/html/stacks.js b/src/cmd/vendor/github.com/google/pprof/internal/driver/html/stacks.js
index 7db06996da..8ba2f35c37 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/html/stacks.js
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/html/stacks.js
@@ -579,7 +579,7 @@ function stackViewer(stacks, nodes) {
}
// percentText returns text that displays v in appropriate units alongside its
- // percentange.
+ // percentage.
function percentText(v) {
function percent(v, total) {
return Number(((100.0 * v) / total).toFixed(1)) + '%';
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 dd628f7c2d..ac7465c93e 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
@@ -19,11 +19,13 @@ import (
"fmt"
"html/template"
"io"
+ "maps"
"net"
"net/http"
gourl "net/url"
"os"
"os/exec"
+ "slices"
"strconv"
"strings"
"time"
@@ -107,9 +109,7 @@ func serveWebInterface(hostport string, p *profile.Profile, o *plugin.Options, d
for n, c := range pprofCommands {
ui.help[n] = c.description
}
- for n, help := range configHelp {
- ui.help[n] = help
- }
+ maps.Copy(ui.help, configHelp)
ui.help["details"] = "Show information about the profile and this view"
ui.help["graph"] = "Display profile as a directed graph"
ui.help["flamegraph"] = "Display profile as a flame graph"
@@ -227,12 +227,7 @@ func redirectWithQuery(path string, code int) http.HandlerFunc {
}
func isLocalhost(host string) bool {
- for _, v := range []string{"localhost", "127.0.0.1", "[::1]", "::1"} {
- if host == v {
- return true
- }
- }
- return false
+ return slices.Contains([]string{"localhost", "127.0.0.1", "[::1]", "::1"}, host)
}
func openBrowser(url string, o *plugin.Options) {
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/elfexec/elfexec.go b/src/cmd/vendor/github.com/google/pprof/internal/elfexec/elfexec.go
index 3f5b09b5e7..37884033d3 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/elfexec/elfexec.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/elfexec/elfexec.go
@@ -230,7 +230,7 @@ func GetBase(fh *elf.FileHeader, loadSegment *elf.ProgHeader, stextOffset *uint6
}
if stextOffset == nil && start > 0 && start < 0x8000000000000000 {
// A regular user-mode executable. Compute the base offset using same
- // arithmetics as in ET_DYN case below, see the explanation there.
+ // arithmetic as in ET_DYN case below, see the explanation there.
// Ideally, the condition would just be "stextOffset == nil" as that
// represents the address of _stext symbol in the vmlinux image. Alas,
// the caller may skip reading it from the binary (it's expensive to scan
@@ -313,7 +313,7 @@ func ProgramHeadersForMapping(phdrs []elf.ProgHeader, mapOff, mapSz uint64) []*e
// value is dependent on the memory management unit of the CPU. The page
// size is 4KB virtually on all the architectures that we care about, so we
// define this metric as a constant. If we encounter architectures where
- // page sie is not 4KB, we must try to guess the page size on the system
+ // page size is not 4KB, we must try to guess the page size on the system
// where the profile was collected, possibly using the architecture
// specified in the ELF file header.
pageSize = 4096
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 8abbd83f76..c4b0d4869f 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
@@ -336,12 +336,8 @@ func newGraph(prof *profile.Profile, o *Options) (*Graph, map[uint64]Nodes) {
if dw == 0 && w == 0 {
continue
}
- for k := range seenNode {
- delete(seenNode, k)
- }
- for k := range seenEdge {
- delete(seenEdge, k)
- }
+ clear(seenNode)
+ clear(seenEdge)
var parent *Node
// A residual edge goes over one or more nodes that were not kept.
residual := false
@@ -850,10 +846,7 @@ 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 {
- tags := countTags(n)
- if tags > maxNodelets {
- tags = maxNodelets
- }
+ tags := min(countTags(n), maxNodelets)
if count += tags + 1; count >= maxNodes {
maxNodes = i + 1
break
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/measurement/measurement.go b/src/cmd/vendor/github.com/google/pprof/internal/measurement/measurement.go
index e5b7dbc6c4..479235c0a6 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/measurement/measurement.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/measurement/measurement.go
@@ -18,6 +18,7 @@ package measurement
import (
"fmt"
"math"
+ "slices"
"strings"
"time"
@@ -197,16 +198,14 @@ type UnitType struct {
// nil if the unit with such alias is not found.
func (ut UnitType) findByAlias(alias string) *Unit {
for _, u := range ut.Units {
- for _, a := range u.aliases {
- if alias == a {
- return &u
- }
+ if slices.Contains(u.aliases, alias) {
+ return &u
}
}
return nil
}
-// sniffUnit simpifies the input alias and returns the unit associated with the
+// sniffUnit simplifies the input alias and returns the unit associated with the
// specified alias. It returns nil if the unit with such alias is not found.
func (ut UnitType) sniffUnit(unit string) *Unit {
unit = strings.ToLower(unit)
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/report/report.go b/src/cmd/vendor/github.com/google/pprof/internal/report/report.go
index 9d52872b7d..ad8b84bf80 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/report/report.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/report/report.go
@@ -569,7 +569,7 @@ func symbolsFromBinaries(prof *profile.Profile, g *graph.Graph, rx *regexp.Regex
return objSyms
}
-// objSym represents a symbol identified from a binary. It includes
+// objSymbol represents a symbol identified from a binary. It includes
// the SymbolInfo from the disasm package and the base that must be
// added to correspond to sample addresses
type objSymbol struct {
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/report/source.go b/src/cmd/vendor/github.com/google/pprof/internal/report/source.go
index d2148607ea..f17952faee 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/report/source.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/report/source.go
@@ -25,6 +25,7 @@ import (
"os"
"path/filepath"
"regexp"
+ "slices"
"sort"
"strconv"
"strings"
@@ -490,7 +491,7 @@ func (sp *sourcePrinter) addStack(addr uint64, frames []plugin.Frame) {
file.lines[f.Line] = append(file.lines[f.Line], sourceInst{addr, stack})
// Remember the first function name encountered per source line
- // and assume that that line belongs to that function.
+ // and assume that line belongs to that function.
if _, ok := file.funcName[f.Line]; !ok {
file.funcName[f.Line] = f.Func
}
@@ -553,7 +554,7 @@ func (sp *sourcePrinter) splitIntoRanges(prof *profile.Profile, addrMap map[uint
unprocessed = append(unprocessed, addr)
}
}
- sort.Slice(addrs, func(i, j int) bool { return addrs[i] < addrs[j] })
+ slices.Sort(addrs)
const expand = 500 // How much to expand range to pick up nearby addresses.
var result []addressRange
@@ -769,10 +770,7 @@ func (sp *sourcePrinter) functions(f *sourceFile) []sourceFunction {
}
} else {
// Find gap from predecessor and divide between predecessor and f.
- halfGap := (f.begin - funcs[i-1].end) / 2
- if halfGap > expand {
- halfGap = expand
- }
+ halfGap := min((f.begin-funcs[i-1].end)/2, expand)
funcs[i-1].end += halfGap
f.begin -= halfGap
}
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/symbolizer/symbolizer.go b/src/cmd/vendor/github.com/google/pprof/internal/symbolizer/symbolizer.go
index 95c15b1366..3a279eca75 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/symbolizer/symbolizer.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/symbolizer/symbolizer.go
@@ -281,14 +281,11 @@ func demanglerModeToOptions(demanglerMode string) []demangle.Option {
panic(fmt.Sprintf("unknown demanglerMode %s", demanglerMode))
}
-func demangleSingleFunction(fn *profile.Function, options []demangle.Option) {
+func demangleSingleFunction(fn *profile.Function, opts []demangle.Option) {
if fn.Name != "" && fn.SystemName != fn.Name {
return // Already demangled.
}
- // Copy the options because they may be updated by the call.
- o := make([]demangle.Option, len(options))
- copy(o, options)
- if demangled := demangle.Filter(fn.SystemName, o...); demangled != fn.SystemName {
+ if demangled := demangle.Filter(fn.SystemName, opts...); demangled != fn.SystemName {
fn.Name = demangled
return
}
@@ -296,7 +293,7 @@ func demangleSingleFunction(fn *profile.Function, options []demangle.Option) {
// OSX has all the symbols prefixed with extra '_' so lets try
// once more without it
if strings.HasPrefix(fn.SystemName, "_") {
- if demangled := demangle.Filter(fn.SystemName[1:], o...); demangled != fn.SystemName {
+ if demangled := demangle.Filter(fn.SystemName[1:], opts...); demangled != fn.SystemName[1:] {
fn.Name = demangled
return
}
@@ -306,7 +303,7 @@ func demangleSingleFunction(fn *profile.Function, options []demangle.Option) {
// already demangled.
name := fn.SystemName
if looksLikeDemangledCPlusPlus(name) {
- for _, o := range options {
+ for _, o := range opts {
switch o {
case demangle.NoParams:
name = removeMatching(name, '(', ')')
diff --git a/src/cmd/vendor/github.com/google/pprof/profile/merge.go b/src/cmd/vendor/github.com/google/pprof/profile/merge.go
index ba4d746407..8a51690be4 100644
--- a/src/cmd/vendor/github.com/google/pprof/profile/merge.go
+++ b/src/cmd/vendor/github.com/google/pprof/profile/merge.go
@@ -17,6 +17,7 @@ package profile
import (
"encoding/binary"
"fmt"
+ "slices"
"sort"
"strconv"
"strings"
@@ -78,12 +79,10 @@ func Merge(srcs []*Profile) (*Profile, error) {
}
}
- for _, s := range p.Sample {
- if isZeroSample(s) {
- // If there are any zero samples, re-merge the profile to GC
- // them.
- return Merge([]*Profile{p})
- }
+ if slices.ContainsFunc(p.Sample, isZeroSample) {
+ // If there are any zero samples, re-merge the profile to GC
+ // them.
+ return Merge([]*Profile{p})
}
return p, nil
diff --git a/src/cmd/vendor/github.com/google/pprof/profile/profile.go b/src/cmd/vendor/github.com/google/pprof/profile/profile.go
index f47a243903..43f561d445 100644
--- a/src/cmd/vendor/github.com/google/pprof/profile/profile.go
+++ b/src/cmd/vendor/github.com/google/pprof/profile/profile.go
@@ -24,6 +24,7 @@ import (
"math"
"path/filepath"
"regexp"
+ "slices"
"sort"
"strings"
"sync"
@@ -734,12 +735,7 @@ func (p *Profile) RemoveLabel(key string) {
// HasLabel returns true if a sample has a label with indicated key and value.
func (s *Sample) HasLabel(key, value string) bool {
- for _, v := range s.Label[key] {
- if v == value {
- return true
- }
- }
- return false
+ return slices.Contains(s.Label[key], value)
}
// SetNumLabel sets the specified key to the specified value for all samples in the
@@ -852,7 +848,17 @@ func (p *Profile) HasFileLines() bool {
// "[vdso]", "[vsyscall]" and some others, see the code.
func (m *Mapping) Unsymbolizable() bool {
name := filepath.Base(m.File)
- return strings.HasPrefix(name, "[") || strings.HasPrefix(name, "linux-vdso") || strings.HasPrefix(m.File, "/dev/dri/") || m.File == "//anon"
+ switch {
+ case strings.HasPrefix(name, "["):
+ case strings.HasPrefix(name, "linux-vdso"):
+ case strings.HasPrefix(m.File, "/dev/dri/"):
+ case m.File == "//anon":
+ case m.File == "":
+ case strings.HasPrefix(m.File, "/memfd:"):
+ default:
+ return false
+ }
+ return true
}
// Copy makes a fully independent copy of a profile.
diff --git a/src/cmd/vendor/github.com/google/pprof/profile/prune.go b/src/cmd/vendor/github.com/google/pprof/profile/prune.go
index b2f9fd5466..7bba31e8ce 100644
--- a/src/cmd/vendor/github.com/google/pprof/profile/prune.go
+++ b/src/cmd/vendor/github.com/google/pprof/profile/prune.go
@@ -19,6 +19,7 @@ package profile
import (
"fmt"
"regexp"
+ "slices"
"strings"
)
@@ -40,13 +41,7 @@ func simplifyFunc(f string) string {
// Account for unsimplified names -- try to remove the argument list by trimming
// starting from the first '(', but skipping reserved names that have '('.
for _, ind := range bracketRx.FindAllStringSubmatchIndex(funcName, -1) {
- foundReserved := false
- for _, res := range reservedNames {
- if funcName[ind[0]:ind[1]] == res {
- foundReserved = true
- break
- }
- }
+ foundReserved := slices.Contains(reservedNames, funcName[ind[0]:ind[1]])
if !foundReserved {
funcName = funcName[:ind[0]]
break
diff --git a/src/cmd/vendor/github.com/google/pprof/third_party/svgpan/svgpan.js b/src/cmd/vendor/github.com/google/pprof/third_party/svgpan/svgpan.js
index 2c4951ecd3..dda7f0f041 100644
--- a/src/cmd/vendor/github.com/google/pprof/third_party/svgpan/svgpan.js
+++ b/src/cmd/vendor/github.com/google/pprof/third_party/svgpan/svgpan.js
@@ -3,7 +3,7 @@
* ======================
*
* Given an unique existing element with id "viewport" (or when missing, the
- * first g-element), including the the library into any SVG adds the following
+ * first g-element), including the library into any SVG adds the following
* capabilities:
*
* - Mouse panning
diff --git a/src/cmd/vendor/github.com/ianlancetaylor/demangle/demangle.go b/src/cmd/vendor/github.com/ianlancetaylor/demangle/demangle.go
index dc238e0773..b812d35ac2 100644
--- a/src/cmd/vendor/github.com/ianlancetaylor/demangle/demangle.go
+++ b/src/cmd/vendor/github.com/ianlancetaylor/demangle/demangle.go
@@ -186,7 +186,7 @@ func ToAST(name string, options ...Option) (AST, error) {
i := 0
for i < len(options) {
if options[i] == NoParams {
- options = append(options[:i], options[i+1:]...)
+ options = append(options[:i:i], options[i+1:]...)
} else {
i++
}