aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/vendor/github.com
diff options
context:
space:
mode:
authorDmitri Shuralyov <dmitshur@golang.org>2024-07-23 17:38:32 -0400
committerGopher Robot <gobot@golang.org>2024-07-23 23:05:51 +0000
commitd55253f5ddfc38bd45846583e07b5e4a97719931 (patch)
treea572fa4dd25cc9f35e6522ed423ff0e78fc8da30 /src/cmd/vendor/github.com
parent0d5fc4e1f01f320d9ce8fd14393241ac09cde791 (diff)
downloadgo-d55253f5ddfc38bd45846583e07b5e4a97719931.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-20240722153945-304e4f0156b8 go mod tidy go mod vendor Change-Id: If009cff7f2d99ec58315102963cbe07b6739c09a Reviewed-on: https://go-review.googlesource.com/c/go/+/600596 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Diffstat (limited to 'src/cmd/vendor/github.com')
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/driver/html/common.css10
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/driver/html/stacks.css3
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/driver/html/stacks.js18
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/driver/stacks.go4
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/report/report.go24
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/report/stacks.go7
6 files changed, 44 insertions, 22 deletions
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 e0de53c1e1..14f836ff10 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
@@ -52,7 +52,6 @@ a {
}
#detailsbox {
display: none;
- z-index: 1;
position: fixed;
top: 40px;
right: 20px;
@@ -107,7 +106,6 @@ a {
}
.submenu {
display: none;
- z-index: 1;
margin-top: -4px;
min-width: 10em;
position: absolute;
@@ -169,8 +167,6 @@ a {
top: 60px;
left: 50%;
transform: translateX(-50%);
-
- z-index: 3;
font-size: 125%;
background-color: #ffffff;
box-shadow: 0 1px 5px rgba(0,0,0,.3);
@@ -271,3 +267,9 @@ table tr td {
background-color: #ebf5fb;
font-weight: bold;
}
+/* stacking order */
+.boxtext { z-index: 2; } /* flame graph box text */
+#current-details { z-index: 2; } /* flame graph current box info */
+#detailsbox { z-index: 3; } /* profile details */
+.submenu { z-index: 4; }
+.dialog { z-index: 5; }
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/html/stacks.css b/src/cmd/vendor/github.com/google/pprof/internal/driver/html/stacks.css
index f5aeb9857a..34c54ebb49 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/html/stacks.css
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/html/stacks.css
@@ -19,7 +19,6 @@ body {
position: absolute;
top: 5px;
right: 5px;
- z-index: 2;
font-size: 12pt;
}
/* Background of a single flame-graph frame */
@@ -57,8 +56,6 @@ body {
font-size: 12pt;
font-weight: bold;
}
-/* Ensure that pprof menu is above boxes */
-.submenu { z-index: 3; }
/* Right-click menu */
#action-menu {
max-width: 15em;
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 df0f0649b9..ced7151e8e 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
@@ -436,13 +436,29 @@ function stackViewer(stacks, nodes) {
r.appendChild(t);
}
- r.addEventListener('click', () => { switchPivots(pprofQuoteMeta(src.UniqueName)); });
+ onClick(r, () => { switchPivots(pprofQuoteMeta(src.UniqueName)); });
r.addEventListener('mouseenter', () => { handleEnter(box, r); });
r.addEventListener('mouseleave', () => { handleLeave(box); });
r.addEventListener('contextmenu', (e) => { showActionMenu(e, box); });
return r;
}
+ // Handle clicks, but only if the mouse did not move during the click.
+ function onClick(target, handler) {
+ // Disable click if mouse moves more than threshold pixels since mousedown.
+ const threshold = 3;
+ let [x, y] = [-1, -1];
+ target.addEventListener('mousedown', (e) => {
+ [x, y] = [e.clientX, e.clientY];
+ });
+ target.addEventListener('click', (e) => {
+ if (Math.abs(e.clientX - x) <= threshold &&
+ Math.abs(e.clientY - y) <= threshold) {
+ handler();
+ }
+ });
+ }
+
function drawSep(y, posTotal, negTotal) {
const m = document.createElement('div');
m.innerText = summary(posTotal, negTotal);
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/stacks.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/stacks.go
index 355b8f2e2a..a7936107d1 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/stacks.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/stacks.go
@@ -20,7 +20,6 @@ import (
"net/http"
"github.com/google/pprof/internal/measurement"
- "github.com/google/pprof/internal/report"
)
// stackView generates the flamegraph view.
@@ -51,8 +50,7 @@ func (ui *webInterface) stackView(w http.ResponseWriter, req *http.Request) {
}
nodes[0] = "" // root is not a real node
- _, legend := report.TextItems(rpt)
- ui.render(w, req, "stacks", rpt, errList, legend, webArgs{
+ ui.render(w, req, "stacks", rpt, errList, stacks.Legend(), webArgs{
Stacks: template.JS(b),
Nodes: nodes,
UnitDefs: measurement.UnitTypes,
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 d72ebe914f..e21ce859d4 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
@@ -781,7 +781,7 @@ type TextItem struct {
func TextItems(rpt *Report) ([]TextItem, []string) {
g, origCount, droppedNodes, _ := rpt.newTrimmedGraph()
rpt.selectOutputUnit(g)
- labels := reportLabels(rpt, g, origCount, droppedNodes, 0, false)
+ labels := reportLabels(rpt, graphTotal(g), len(g.Nodes), origCount, droppedNodes, 0, false)
var items []TextItem
var flatSum int64
@@ -1064,7 +1064,7 @@ func printTree(w io.Writer, rpt *Report) error {
g, origCount, droppedNodes, _ := rpt.newTrimmedGraph()
rpt.selectOutputUnit(g)
- fmt.Fprintln(w, strings.Join(reportLabels(rpt, g, origCount, droppedNodes, 0, false), "\n"))
+ fmt.Fprintln(w, strings.Join(reportLabels(rpt, graphTotal(g), len(g.Nodes), origCount, droppedNodes, 0, false), "\n"))
fmt.Fprintln(w, separator)
fmt.Fprintln(w, legend)
@@ -1128,7 +1128,7 @@ func printTree(w io.Writer, rpt *Report) error {
func GetDOT(rpt *Report) (*graph.Graph, *graph.DotConfig) {
g, origCount, droppedNodes, droppedEdges := rpt.newTrimmedGraph()
rpt.selectOutputUnit(g)
- labels := reportLabels(rpt, g, origCount, droppedNodes, droppedEdges, true)
+ labels := reportLabels(rpt, graphTotal(g), len(g.Nodes), origCount, droppedNodes, droppedEdges, true)
c := &graph.DotConfig{
Title: rpt.options.Title,
@@ -1184,12 +1184,19 @@ func ProfileLabels(rpt *Report) []string {
return label
}
+func graphTotal(g *graph.Graph) int64 {
+ var total int64
+ for _, n := range g.Nodes {
+ total += n.FlatValue()
+ }
+ return total
+}
+
// reportLabels returns printable labels for a report. Includes
// profileLabels.
-func reportLabels(rpt *Report, g *graph.Graph, origCount, droppedNodes, droppedEdges int, fullHeaders bool) []string {
+func reportLabels(rpt *Report, shownTotal int64, nodeCount, origCount, droppedNodes, droppedEdges int, fullHeaders bool) []string {
nodeFraction := rpt.options.NodeFraction
edgeFraction := rpt.options.EdgeFraction
- nodeCount := len(g.Nodes)
var label []string
if len(rpt.options.ProfileLabels) > 0 {
@@ -1198,17 +1205,12 @@ func reportLabels(rpt *Report, g *graph.Graph, origCount, droppedNodes, droppedE
label = ProfileLabels(rpt)
}
- var flatSum int64
- for _, n := range g.Nodes {
- flatSum = flatSum + n.FlatValue()
- }
-
if len(rpt.options.ActiveFilters) > 0 {
activeFilters := legendActiveFilters(rpt.options.ActiveFilters)
label = append(label, activeFilters...)
}
- label = append(label, fmt.Sprintf("Showing nodes accounting for %s, %s of %s total", rpt.formatValue(flatSum), strings.TrimSpace(measurement.Percentage(flatSum, rpt.total)), rpt.formatValue(rpt.total)))
+ label = append(label, fmt.Sprintf("Showing nodes accounting for %s, %s of %s total", rpt.formatValue(shownTotal), strings.TrimSpace(measurement.Percentage(shownTotal, rpt.total)), rpt.formatValue(rpt.total)))
if rpt.total != 0 {
if droppedNodes > 0 {
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/report/stacks.go b/src/cmd/vendor/github.com/google/pprof/internal/report/stacks.go
index aa3bf80f2d..c6b07b86de 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/report/stacks.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/report/stacks.go
@@ -34,6 +34,7 @@ type StackSet struct {
Unit string // One of "B", "s", "GCU", or "" (if unknown)
Stacks []Stack // List of stored stacks
Sources []StackSource // Mapping from source index to info
+ report *Report
}
// Stack holds a single stack instance.
@@ -94,6 +95,7 @@ func (rpt *Report) Stacks() StackSet {
Unit: unit,
Stacks: []Stack{}, // Ensure non-nil
Sources: []StackSource{}, // Ensure non-nil
+ report: rpt,
}
s.makeInitialStacks(rpt)
s.fillPlaces()
@@ -187,3 +189,8 @@ func (s *StackSet) assignColors() {
s.Sources[i].Color = int(index % numColors)
}
}
+
+// Legend returns the list of lines to display as the legend.
+func (s *StackSet) Legend() []string {
+ return reportLabels(s.report, s.report.total, len(s.Sources), len(s.Sources), 0, 0, false)
+}