mirror of
https://github.com/golang/go
synced 2024-11-23 00:10:07 -07:00
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. Done with: go get github.com/google/pprof go mod tidy go mod vendor For #36905. Fixes #65741. Change-Id: Ice7b085c03ff69be97929cbe47bfd91954907529 Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/go/+/564636 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
3b51581261
commit
63dd79c07b
@ -3,7 +3,7 @@ module cmd
|
||||
go 1.23
|
||||
|
||||
require (
|
||||
github.com/google/pprof v0.0.0-20230811205829-9131a7e9cc17
|
||||
github.com/google/pprof v0.0.0-20240207164012-fb44976bdcd5
|
||||
golang.org/x/arch v0.7.0
|
||||
golang.org/x/build v0.0.0-20240201175143-3ee44a092755
|
||||
golang.org/x/mod v0.15.1-0.20240207185259-766dc5df63e3
|
||||
|
@ -1,9 +1,25 @@
|
||||
github.com/chromedp/cdproto v0.0.0-20230802225258-3cf4e6d46a89 h1:aPflPkRFkVwbW6dmcVqfgwp1i+UWGFH6VgR1Jim5Ygc=
|
||||
github.com/chromedp/cdproto v0.0.0-20230802225258-3cf4e6d46a89/go.mod h1:GKljq0VrfU4D5yc+2qA6OVr8pmO/MBbPEWqWQ/oqGEs=
|
||||
github.com/chromedp/chromedp v0.9.2 h1:dKtNz4kApb06KuSXoTQIyUC2TrA0fhGDwNZf3bcgfKw=
|
||||
github.com/chromedp/chromedp v0.9.2/go.mod h1:LkSXJKONWTCHAfQasKFUZI+mxqS4tZqhmtGzzhLsnLs=
|
||||
github.com/chromedp/sysutil v1.0.0 h1:+ZxhTpfpZlmchB58ih/LBHX52ky7w2VhQVKQMucy3Ic=
|
||||
github.com/chromedp/sysutil v1.0.0/go.mod h1:kgWmDdq8fTzXYcKIBqIYvRRTnYb9aNS9moAV0xufSww=
|
||||
github.com/gobwas/httphead v0.1.0 h1:exrUm0f4YX0L7EBwZHuCF4GDp8aJfVeBrlLQrs6NqWU=
|
||||
github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM=
|
||||
github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og=
|
||||
github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
|
||||
github.com/gobwas/ws v1.2.1 h1:F2aeBZrm2NDsc7vbovKrWSogd4wvfAxg0FQ89/iqOTk=
|
||||
github.com/gobwas/ws v1.2.1/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY=
|
||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/pprof v0.0.0-20230811205829-9131a7e9cc17 h1:0h35ESZ02+hN/MFZb7XZOXg+Rl9+Rk8fBIf5YLws9gA=
|
||||
github.com/google/pprof v0.0.0-20230811205829-9131a7e9cc17/go.mod h1:Jh3hGz2jkYak8qXPD19ryItVnUgpgeqzdkY/D0EaeuA=
|
||||
github.com/google/pprof v0.0.0-20240207164012-fb44976bdcd5 h1:E/LAvt58di64hlYjx7AsNS6C/ysHWYo+2qPCZKTQhRo=
|
||||
github.com/google/pprof v0.0.0-20240207164012-fb44976bdcd5/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20230524184225-eabc099b10ab h1:BA4a7pe6ZTd9F8kXETBoijjFJ/ntaa//1wiH9BZu4zU=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20230524184225-eabc099b10ab/go.mod h1:gx7rwoVhcfuVKG5uya9Hs3Sxj7EIvldVofAWIUtGouw=
|
||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
||||
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
|
||||
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
||||
github.com/yuin/goldmark v1.6.0 h1:boZcn2GTjpsynOsC0iJHnBWa4Bi0qzfJjthwauItG68=
|
||||
github.com/yuin/goldmark v1.6.0/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
golang.org/x/arch v0.7.0 h1:pskyeJh/3AmoQ8CPE95vxHLqp1G1GfGNXTmcl9NEKTc=
|
||||
|
7
src/cmd/vendor/github.com/google/pprof/driver/driver.go
generated
vendored
7
src/cmd/vendor/github.com/google/pprof/driver/driver.go
generated
vendored
@ -186,9 +186,10 @@ type ObjFile interface {
|
||||
|
||||
// A Frame describes 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
|
||||
Func string // name of function
|
||||
File string // source file name
|
||||
Line int // line in file
|
||||
Column int // column in file
|
||||
}
|
||||
|
||||
// A Sym describes a single symbol in an object file.
|
||||
|
22
src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner_llvm.go
generated
vendored
22
src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner_llvm.go
generated
vendored
@ -129,6 +129,7 @@ func (d *llvmSymbolizer) readFrame() (plugin.Frame, bool) {
|
||||
}
|
||||
|
||||
linenumber := 0
|
||||
columnnumber := 0
|
||||
// The llvm-symbolizer outputs the <file_name>:<line_number>:<column_number>.
|
||||
// When it cannot identify the source code location, it outputs "??:0:0".
|
||||
// Older versions output just the filename and line number, so we check for
|
||||
@ -137,22 +138,27 @@ func (d *llvmSymbolizer) readFrame() (plugin.Frame, bool) {
|
||||
fileline = ""
|
||||
} else {
|
||||
switch split := strings.Split(fileline, ":"); len(split) {
|
||||
case 1:
|
||||
// filename
|
||||
fileline = split[0]
|
||||
case 2, 3:
|
||||
// filename:line , or
|
||||
// filename:line:disc , or
|
||||
fileline = split[0]
|
||||
case 3:
|
||||
// filename:line:column
|
||||
if col, err := strconv.Atoi(split[2]); err == nil {
|
||||
columnnumber = col
|
||||
}
|
||||
fallthrough
|
||||
case 2:
|
||||
// filename:line
|
||||
if line, err := strconv.Atoi(split[1]); err == nil {
|
||||
linenumber = line
|
||||
}
|
||||
fallthrough
|
||||
case 1:
|
||||
// filename
|
||||
fileline = split[0]
|
||||
default:
|
||||
// Unrecognized, ignore
|
||||
}
|
||||
}
|
||||
|
||||
return plugin.Frame{Func: funcname, File: fileline, Line: linenumber}, false
|
||||
return plugin.Frame{Func: funcname, File: fileline, Line: linenumber, Column: columnnumber}, false
|
||||
}
|
||||
|
||||
// addrInfo returns the stack frame information for a specific program
|
||||
|
2
src/cmd/vendor/github.com/google/pprof/internal/driver/commands.go
generated
vendored
2
src/cmd/vendor/github.com/google/pprof/internal/driver/commands.go
generated
vendored
@ -247,6 +247,8 @@ var configHelp = map[string]string{
|
||||
"noinlines": helpText(
|
||||
"Ignore inlines.",
|
||||
"Attributes inlined functions to their first out-of-line caller."),
|
||||
"showcolumns": helpText(
|
||||
"Show column numbers at the source code line level."),
|
||||
}
|
||||
|
||||
func helpText(s ...string) string {
|
||||
|
2
src/cmd/vendor/github.com/google/pprof/internal/driver/config.go
generated
vendored
2
src/cmd/vendor/github.com/google/pprof/internal/driver/config.go
generated
vendored
@ -51,6 +51,7 @@ type config struct {
|
||||
TagShow string `json:"tagshow,omitempty"`
|
||||
TagHide string `json:"taghide,omitempty"`
|
||||
NoInlines bool `json:"noinlines,omitempty"`
|
||||
ShowColumns bool `json:"showcolumns,omitempty"`
|
||||
|
||||
// Output granularity
|
||||
Granularity string `json:"granularity,omitempty"`
|
||||
@ -157,6 +158,7 @@ func init() {
|
||||
"sort": "sort",
|
||||
"granularity": "g",
|
||||
"noinlines": "noinlines",
|
||||
"showcolumns": "showcolumns",
|
||||
}
|
||||
|
||||
def := defaultConfig()
|
||||
|
2
src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go
generated
vendored
2
src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go
generated
vendored
@ -256,7 +256,7 @@ func aggregate(prof *profile.Profile, cfg config) error {
|
||||
default:
|
||||
return fmt.Errorf("unexpected granularity")
|
||||
}
|
||||
return prof.Aggregate(inlines, function, filename, linenumber, address)
|
||||
return prof.Aggregate(inlines, function, filename, linenumber, cfg.ShowColumns, address)
|
||||
}
|
||||
|
||||
func reportOptions(p *profile.Profile, numLabelUnits map[string]string, cfg config) (*report.Options, error) {
|
||||
|
24
src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go
generated
vendored
24
src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go
generated
vendored
@ -492,17 +492,23 @@ mapping:
|
||||
func fetch(source string, duration, timeout time.Duration, ui plugin.UI, tr http.RoundTripper) (p *profile.Profile, src string, err error) {
|
||||
var f io.ReadCloser
|
||||
|
||||
if sourceURL, timeout := adjustURL(source, duration, timeout); sourceURL != "" {
|
||||
ui.Print("Fetching profile over HTTP from " + sourceURL)
|
||||
if duration > 0 {
|
||||
ui.Print(fmt.Sprintf("Please wait... (%v)", duration))
|
||||
// First determine whether the source is a file, if not, it will be treated as a URL.
|
||||
if _, openErr := os.Stat(source); openErr == nil {
|
||||
if isPerfFile(source) {
|
||||
f, err = convertPerfData(source, ui)
|
||||
} else {
|
||||
f, err = os.Open(source)
|
||||
}
|
||||
f, err = fetchURL(sourceURL, timeout, tr)
|
||||
src = sourceURL
|
||||
} else if isPerfFile(source) {
|
||||
f, err = convertPerfData(source, ui)
|
||||
} else {
|
||||
f, err = os.Open(source)
|
||||
sourceURL, timeout := adjustURL(source, duration, timeout)
|
||||
if sourceURL != "" {
|
||||
ui.Print("Fetching profile over HTTP from " + sourceURL)
|
||||
if duration > 0 {
|
||||
ui.Print(fmt.Sprintf("Please wait... (%v)", duration))
|
||||
}
|
||||
f, err = fetchURL(sourceURL, timeout, tr)
|
||||
src = sourceURL
|
||||
}
|
||||
}
|
||||
if err == nil {
|
||||
defer f.Close()
|
||||
|
106
src/cmd/vendor/github.com/google/pprof/internal/driver/flamegraph.go
generated
vendored
106
src/cmd/vendor/github.com/google/pprof/internal/driver/flamegraph.go
generated
vendored
@ -1,106 +0,0 @@
|
||||
// Copyright 2017 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package driver
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"html/template"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/google/pprof/internal/graph"
|
||||
"github.com/google/pprof/internal/measurement"
|
||||
"github.com/google/pprof/internal/report"
|
||||
)
|
||||
|
||||
type treeNode struct {
|
||||
Name string `json:"n"`
|
||||
FullName string `json:"f"`
|
||||
Cum int64 `json:"v"`
|
||||
CumFormat string `json:"l"`
|
||||
Percent string `json:"p"`
|
||||
Children []*treeNode `json:"c"`
|
||||
}
|
||||
|
||||
// flamegraph generates a web page containing a flamegraph.
|
||||
func (ui *webInterface) flamegraph(w http.ResponseWriter, req *http.Request) {
|
||||
// Force the call tree so that the graph is a tree.
|
||||
// Also do not trim the tree so that the flame graph contains all functions.
|
||||
rpt, errList := ui.makeReport(w, req, []string{"svg"}, func(cfg *config) {
|
||||
cfg.CallTree = true
|
||||
cfg.Trim = false
|
||||
})
|
||||
if rpt == nil {
|
||||
return // error already reported
|
||||
}
|
||||
|
||||
// Generate dot graph.
|
||||
g, config := report.GetDOT(rpt)
|
||||
var nodes []*treeNode
|
||||
nroots := 0
|
||||
rootValue := int64(0)
|
||||
nodeArr := []string{}
|
||||
nodeMap := map[*graph.Node]*treeNode{}
|
||||
// Make all nodes and the map, collect the roots.
|
||||
for _, n := range g.Nodes {
|
||||
v := n.CumValue()
|
||||
fullName := n.Info.PrintableName()
|
||||
node := &treeNode{
|
||||
Name: graph.ShortenFunctionName(fullName),
|
||||
FullName: fullName,
|
||||
Cum: v,
|
||||
CumFormat: config.FormatValue(v),
|
||||
Percent: strings.TrimSpace(measurement.Percentage(v, config.Total)),
|
||||
}
|
||||
nodes = append(nodes, node)
|
||||
if len(n.In) == 0 {
|
||||
nodes[nroots], nodes[len(nodes)-1] = nodes[len(nodes)-1], nodes[nroots]
|
||||
nroots++
|
||||
rootValue += v
|
||||
}
|
||||
nodeMap[n] = node
|
||||
// Get all node names into an array.
|
||||
nodeArr = append(nodeArr, n.Info.Name)
|
||||
}
|
||||
// Populate the child links.
|
||||
for _, n := range g.Nodes {
|
||||
node := nodeMap[n]
|
||||
for child := range n.Out {
|
||||
node.Children = append(node.Children, nodeMap[child])
|
||||
}
|
||||
}
|
||||
|
||||
rootNode := &treeNode{
|
||||
Name: "root",
|
||||
FullName: "root",
|
||||
Cum: rootValue,
|
||||
CumFormat: config.FormatValue(rootValue),
|
||||
Percent: strings.TrimSpace(measurement.Percentage(rootValue, config.Total)),
|
||||
Children: nodes[0:nroots],
|
||||
}
|
||||
|
||||
// JSON marshalling flame graph
|
||||
b, err := json.Marshal(rootNode)
|
||||
if err != nil {
|
||||
http.Error(w, "error serializing flame graph", http.StatusInternalServerError)
|
||||
ui.options.UI.PrintErr(err)
|
||||
return
|
||||
}
|
||||
|
||||
ui.render(w, req, "flamegraph", rpt, errList, config.Labels, webArgs{
|
||||
FlameGraph: template.JS(b),
|
||||
Nodes: nodeArr,
|
||||
})
|
||||
}
|
14
src/cmd/vendor/github.com/google/pprof/internal/driver/html/common.js
generated
vendored
14
src/cmd/vendor/github.com/google/pprof/internal/driver/html/common.js
generated
vendored
@ -558,11 +558,6 @@ function viewer(baseUrl, nodes, options) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// convert a string to a regexp that matches that string.
|
||||
function quotemeta(str) {
|
||||
return str.replace(/([\\\.?+*\[\](){}|^$])/g, '\\$1');
|
||||
}
|
||||
|
||||
function setSampleIndexLink(si) {
|
||||
const elem = document.getElementById('sampletype-' + si);
|
||||
if (elem != null) {
|
||||
@ -595,7 +590,7 @@ function viewer(baseUrl, nodes, options) {
|
||||
// list-based. Construct regular expression depending on mode.
|
||||
let re = regexpActive
|
||||
? search.value
|
||||
: Array.from(getSelection().keys()).map(key => quotemeta(nodes[key])).join('|');
|
||||
: Array.from(getSelection().keys()).map(key => pprofQuoteMeta(nodes[key])).join('|');
|
||||
|
||||
setHrefParams(elem, function (params) {
|
||||
if (re != '') {
|
||||
@ -683,7 +678,7 @@ function viewer(baseUrl, nodes, options) {
|
||||
}
|
||||
|
||||
const ids = ['topbtn', 'graphbtn',
|
||||
'flamegraph', 'flamegraph2', 'flamegraphold',
|
||||
'flamegraph',
|
||||
'peek', 'list',
|
||||
'disasm', 'focus', 'ignore', 'hide', 'show', 'show-from'];
|
||||
ids.forEach(makeSearchLinkDynamic);
|
||||
@ -712,3 +707,8 @@ function viewer(baseUrl, nodes, options) {
|
||||
main.focus();
|
||||
}
|
||||
}
|
||||
|
||||
// convert a string to a regexp that matches exactly that string.
|
||||
function pprofQuoteMeta(str) {
|
||||
return '^' + str.replace(/([\\\.?+*\[\](){}|^$])/g, '\\$1') + '$';
|
||||
}
|
||||
|
103
src/cmd/vendor/github.com/google/pprof/internal/driver/html/flamegraph.html
generated
vendored
103
src/cmd/vendor/github.com/google/pprof/internal/driver/html/flamegraph.html
generated
vendored
@ -1,103 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{{.Title}}</title>
|
||||
{{template "css" .}}
|
||||
<style type="text/css">{{template "d3flamegraphcss" .}}</style>
|
||||
<style type="text/css">
|
||||
.flamegraph-content {
|
||||
width: 90%;
|
||||
min-width: 80%;
|
||||
margin-left: 5%;
|
||||
}
|
||||
.flamegraph-details {
|
||||
height: 1.2em;
|
||||
width: 90%;
|
||||
min-width: 90%;
|
||||
margin-left: 5%;
|
||||
padding: 15px 0 35px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
{{template "header" .}}
|
||||
<div id="bodycontainer">
|
||||
<div id="flamegraphdetails" class="flamegraph-details"></div>
|
||||
<div class="flamegraph-content">
|
||||
<div id="chart"></div>
|
||||
</div>
|
||||
</div>
|
||||
{{template "script" .}}
|
||||
<script>viewer(new URL(window.location.href), {{.Nodes}});</script>
|
||||
<script>{{template "d3flamegraphscript" .}}</script>
|
||||
<script>
|
||||
{{- /* Deserialize as JSON instead of a JS object literal because the browser's
|
||||
JSON parser can handle larger payloads than its JS parser. */ -}}
|
||||
var data = JSON.parse("{{.FlameGraph}}");
|
||||
|
||||
var width = document.getElementById('chart').clientWidth;
|
||||
|
||||
var flameGraph = flamegraph()
|
||||
.width(width)
|
||||
.cellHeight(18)
|
||||
.minFrameSize(1)
|
||||
.transitionDuration(750)
|
||||
.inverted(true)
|
||||
.sort(true)
|
||||
.title('')
|
||||
.tooltip(false)
|
||||
.setDetailsElement(document.getElementById('flamegraphdetails'));
|
||||
|
||||
// <full name> (percentage, value)
|
||||
flameGraph.label((d) => d.data.f + ' (' + d.data.p + ', ' + d.data.l + ')');
|
||||
|
||||
flameGraph.setColorHue('warm');
|
||||
|
||||
select('#chart')
|
||||
.datum(data)
|
||||
.call(flameGraph);
|
||||
|
||||
function clear() {
|
||||
flameGraph.clear();
|
||||
}
|
||||
|
||||
function resetZoom() {
|
||||
flameGraph.resetZoom();
|
||||
}
|
||||
|
||||
window.addEventListener('resize', function() {
|
||||
var width = document.getElementById('chart').clientWidth;
|
||||
var graphs = document.getElementsByClassName('d3-flame-graph');
|
||||
if (graphs.length > 0) {
|
||||
graphs[0].setAttribute('width', width);
|
||||
}
|
||||
flameGraph.width(width);
|
||||
flameGraph.resetZoom();
|
||||
}, true);
|
||||
|
||||
var search = document.getElementById('search');
|
||||
var searchAlarm = null;
|
||||
|
||||
function selectMatching() {
|
||||
searchAlarm = null;
|
||||
|
||||
if (search.value != '') {
|
||||
flameGraph.search(search.value);
|
||||
} else {
|
||||
flameGraph.clear();
|
||||
}
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
// Delay expensive processing so a flurry of key strokes is handled once.
|
||||
if (searchAlarm != null) {
|
||||
clearTimeout(searchAlarm);
|
||||
}
|
||||
searchAlarm = setTimeout(selectMatching, 300);
|
||||
}
|
||||
|
||||
search.addEventListener('input', handleSearch);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
1
src/cmd/vendor/github.com/google/pprof/internal/driver/html/header.html
generated
vendored
1
src/cmd/vendor/github.com/google/pprof/internal/driver/html/header.html
generated
vendored
@ -12,7 +12,6 @@
|
||||
<a title="{{.Help.top}}" href="./top" id="topbtn">Top</a>
|
||||
<a title="{{.Help.graph}}" href="./" id="graphbtn">Graph</a>
|
||||
<a title="{{.Help.flamegraph}}" href="./flamegraph" id="flamegraph">Flame Graph</a>
|
||||
<a title="{{.Help.flamegraphold}}" href="./flamegraphold" id="flamegraphold">Flame Graph (old)</a>
|
||||
<a title="{{.Help.peek}}" href="./peek" id="peek">Peek</a>
|
||||
<a title="{{.Help.list}}" href="./source" id="list">Source</a>
|
||||
<a title="{{.Help.disasm}}" href="./disasm" id="disasm">Disassemble</a>
|
||||
|
18
src/cmd/vendor/github.com/google/pprof/internal/driver/html/stacks.js
generated
vendored
18
src/cmd/vendor/github.com/google/pprof/internal/driver/html/stacks.js
generated
vendored
@ -75,8 +75,12 @@ function stackViewer(stacks, nodes) {
|
||||
hiliter: (n, on) => { return hilite(n, on); },
|
||||
current: () => {
|
||||
let r = new Map();
|
||||
for (let p of pivots) {
|
||||
r.set(p, true);
|
||||
if (pivots.length == 1 && pivots[0] == 0) {
|
||||
// Not pivoting
|
||||
} else {
|
||||
for (let p of pivots) {
|
||||
r.set(p, true);
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}});
|
||||
@ -145,7 +149,7 @@ function stackViewer(stacks, nodes) {
|
||||
}
|
||||
|
||||
// Update params to include src.
|
||||
let v = stacks.Sources[src].RE;
|
||||
let v = pprofQuoteMeta(stacks.Sources[src].FullName);
|
||||
if (param != 'f' && param != 'sf') { // old f,sf values are overwritten
|
||||
// Add new source to current parameter value.
|
||||
const old = params.get(param);
|
||||
@ -174,7 +178,11 @@ function stackViewer(stacks, nodes) {
|
||||
function switchPivots(regexp) {
|
||||
// Switch URL without hitting the server.
|
||||
const url = new URL(document.URL);
|
||||
url.searchParams.set('p', regexp);
|
||||
if (regexp === '' || regexp === '^$') {
|
||||
url.searchParams.delete('p'); // Not pivoting
|
||||
} else {
|
||||
url.searchParams.set('p', regexp);
|
||||
}
|
||||
history.pushState('', '', url.toString()); // Makes back-button work
|
||||
matches = new Set();
|
||||
search.value = '';
|
||||
@ -445,7 +453,7 @@ function stackViewer(stacks, nodes) {
|
||||
r.appendChild(t);
|
||||
}
|
||||
|
||||
r.addEventListener('click', () => { switchPivots(src.RE); });
|
||||
r.addEventListener('click', () => { switchPivots(pprofQuoteMeta(src.UniqueName)); });
|
||||
r.addEventListener('mouseenter', () => { handleEnter(box, r); });
|
||||
r.addEventListener('mouseleave', () => { handleLeave(box); });
|
||||
r.addEventListener('contextmenu', (e) => { showActionMenu(e, box); });
|
||||
|
2
src/cmd/vendor/github.com/google/pprof/internal/driver/stacks.go
generated
vendored
2
src/cmd/vendor/github.com/google/pprof/internal/driver/stacks.go
generated
vendored
@ -22,7 +22,7 @@ import (
|
||||
"github.com/google/pprof/internal/report"
|
||||
)
|
||||
|
||||
// stackView generates the new flamegraph view.
|
||||
// stackView generates the flamegraph view.
|
||||
func (ui *webInterface) stackView(w http.ResponseWriter, req *http.Request) {
|
||||
// Get all data in a report.
|
||||
rpt, errList := ui.makeReport(w, req, []string{"svg"}, func(cfg *config) {
|
||||
|
2
src/cmd/vendor/github.com/google/pprof/internal/driver/svg.go
generated
vendored
2
src/cmd/vendor/github.com/google/pprof/internal/driver/svg.go
generated
vendored
@ -65,7 +65,7 @@ func massageSVG(svg string) string {
|
||||
|
||||
if loc := graphID.FindStringIndex(svg); loc != nil {
|
||||
svg = svg[:loc[0]] +
|
||||
`<script type="text/ecmascript"><![CDATA[` + string(svgpan.JSSource) + `]]></script>` +
|
||||
`<script type="text/ecmascript"><![CDATA[` + svgpan.JSSource + `]]></script>` +
|
||||
`<g id="viewport" transform="scale(0.5,0.5) translate(0,0)">` +
|
||||
svg[loc[0]:]
|
||||
}
|
||||
|
10
src/cmd/vendor/github.com/google/pprof/internal/driver/webhtml.go
generated
vendored
10
src/cmd/vendor/github.com/google/pprof/internal/driver/webhtml.go
generated
vendored
@ -19,8 +19,6 @@ import (
|
||||
"fmt"
|
||||
"html/template"
|
||||
"os"
|
||||
|
||||
"github.com/google/pprof/third_party/d3flamegraph"
|
||||
)
|
||||
|
||||
//go:embed html
|
||||
@ -52,11 +50,7 @@ func addTemplates(templates *template.Template) {
|
||||
template.Must(templates.AddParseTree(name, sub.Tree))
|
||||
}
|
||||
|
||||
// Pre-packaged third-party files.
|
||||
def("d3flamegraphscript", d3flamegraph.JSSource)
|
||||
def("d3flamegraphcss", d3flamegraph.CSSSource)
|
||||
|
||||
// Embeded files.
|
||||
// Embedded files.
|
||||
def("css", loadCSS("html/common.css"))
|
||||
def("header", loadFile("html/header.html"))
|
||||
def("graph", loadFile("html/graph.html"))
|
||||
@ -64,7 +58,7 @@ func addTemplates(templates *template.Template) {
|
||||
def("top", loadFile("html/top.html"))
|
||||
def("sourcelisting", loadFile("html/source.html"))
|
||||
def("plaintext", loadFile("html/plaintext.html"))
|
||||
def("flamegraph", loadFile("html/flamegraph.html"))
|
||||
// TODO: Rename "stacks" to "flamegraph" to seal moving off d3 flamegraph.
|
||||
def("stacks", loadFile("html/stacks.html"))
|
||||
def("stacks_css", loadCSS("html/stacks.css"))
|
||||
def("stacks_js", loadJS("html/stacks.js"))
|
||||
|
16
src/cmd/vendor/github.com/google/pprof/internal/driver/webui.go
generated
vendored
16
src/cmd/vendor/github.com/google/pprof/internal/driver/webui.go
generated
vendored
@ -112,7 +112,6 @@ func serveWebInterface(hostport string, p *profile.Profile, o *plugin.Options, d
|
||||
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"
|
||||
ui.help["flamegraphold"] = "Display profile as a flame graph (old version; slated for removal)"
|
||||
ui.help["reset"] = "Show the entire profile"
|
||||
ui.help["save_config"] = "Save current settings"
|
||||
|
||||
@ -130,9 +129,9 @@ func serveWebInterface(hostport string, p *profile.Profile, o *plugin.Options, d
|
||||
"/disasm": http.HandlerFunc(ui.disasm),
|
||||
"/source": http.HandlerFunc(ui.source),
|
||||
"/peek": http.HandlerFunc(ui.peek),
|
||||
"/flamegraphold": http.HandlerFunc(ui.flamegraph),
|
||||
"/flamegraph": http.HandlerFunc(ui.stackView),
|
||||
"/flamegraph2": http.HandlerFunc(ui.stackView), // Support older URL
|
||||
"/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),
|
||||
"/download": http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||
@ -209,15 +208,20 @@ func defaultWebServer(args *plugin.HTTPServerArgs) error {
|
||||
// https://github.com/google/pprof/pull/348
|
||||
mux := http.NewServeMux()
|
||||
mux.Handle("/ui/", http.StripPrefix("/ui", handler))
|
||||
mux.Handle("/", redirectWithQuery("/ui"))
|
||||
mux.Handle("/", redirectWithQuery("/ui", http.StatusTemporaryRedirect))
|
||||
s := &http.Server{Handler: mux}
|
||||
return s.Serve(ln)
|
||||
}
|
||||
|
||||
func redirectWithQuery(path string) http.HandlerFunc {
|
||||
// redirectWithQuery responds with a given redirect code, preserving query
|
||||
// parameters in the redirect URL. It does not convert relative paths to
|
||||
// absolute paths like http.Redirect does, so that HTTPServerArgs.Handlers can
|
||||
// generate relative redirects that work with the external prefixing.
|
||||
func redirectWithQuery(path string, code int) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
pathWithQuery := &gourl.URL{Path: path, RawQuery: r.URL.RawQuery}
|
||||
http.Redirect(w, r, pathWithQuery.String(), http.StatusTemporaryRedirect)
|
||||
w.Header().Set("Location", pathWithQuery.String())
|
||||
w.WriteHeader(code)
|
||||
}
|
||||
}
|
||||
|
||||
|
15
src/cmd/vendor/github.com/google/pprof/internal/graph/graph.go
generated
vendored
15
src/cmd/vendor/github.com/google/pprof/internal/graph/graph.go
generated
vendored
@ -154,6 +154,7 @@ type NodeInfo struct {
|
||||
Address uint64
|
||||
File string
|
||||
StartLine, Lineno int
|
||||
Columnno int
|
||||
Objfile string
|
||||
}
|
||||
|
||||
@ -174,8 +175,12 @@ func (i *NodeInfo) NameComponents() []string {
|
||||
|
||||
switch {
|
||||
case i.Lineno != 0:
|
||||
s := fmt.Sprintf("%s:%d", i.File, i.Lineno)
|
||||
if i.Columnno != 0 {
|
||||
s += fmt.Sprintf(":%d", i.Columnno)
|
||||
}
|
||||
// User requested line numbers, provide what we have.
|
||||
name = append(name, fmt.Sprintf("%s:%d", i.File, i.Lineno))
|
||||
name = append(name, s)
|
||||
case i.File != "":
|
||||
// User requested file name, provide it.
|
||||
name = append(name, i.File)
|
||||
@ -239,6 +244,7 @@ func (nm NodeMap) FindOrInsertNode(info NodeInfo, kept NodeSet) *Node {
|
||||
// Find a node that represents the whole function.
|
||||
info.Address = 0
|
||||
info.Lineno = 0
|
||||
info.Columnno = 0
|
||||
n.Function = nm.FindOrInsertNode(info, nil)
|
||||
return n
|
||||
}
|
||||
@ -592,9 +598,10 @@ func nodeInfo(l *profile.Location, line profile.Line, objfile string, o *Options
|
||||
return &NodeInfo{Address: l.Address, Objfile: objfile}
|
||||
}
|
||||
ni := &NodeInfo{
|
||||
Address: l.Address,
|
||||
Lineno: int(line.Line),
|
||||
Name: line.Function.Name,
|
||||
Address: l.Address,
|
||||
Lineno: int(line.Line),
|
||||
Columnno: int(line.Column),
|
||||
Name: line.Function.Name,
|
||||
}
|
||||
if fname := line.Function.Filename; fname != "" {
|
||||
ni.File = filepath.Clean(fname)
|
||||
|
9
src/cmd/vendor/github.com/google/pprof/internal/plugin/plugin.go
generated
vendored
9
src/cmd/vendor/github.com/google/pprof/internal/plugin/plugin.go
generated
vendored
@ -157,11 +157,12 @@ type ObjFile interface {
|
||||
Close() error
|
||||
}
|
||||
|
||||
// A Frame describes a single line in a source file.
|
||||
// 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
|
||||
Func string // name of function
|
||||
File string // source file name
|
||||
Line int // line in file
|
||||
Column int // column in line (if available)
|
||||
}
|
||||
|
||||
// A Sym describes a single symbol in an object file.
|
||||
|
3
src/cmd/vendor/github.com/google/pprof/internal/report/report.go
generated
vendored
3
src/cmd/vendor/github.com/google/pprof/internal/report/report.go
generated
vendored
@ -293,7 +293,7 @@ func (rpt *Report) newGraph(nodes graph.NodeSet) *graph.Graph {
|
||||
return graph.New(rpt.prof, gopt)
|
||||
}
|
||||
|
||||
// printProto writes the incoming proto via thw writer w.
|
||||
// printProto writes the incoming proto via the writer w.
|
||||
// If the divide_by option has been specified, samples are scaled appropriately.
|
||||
func printProto(w io.Writer, rpt *Report) error {
|
||||
p, o := rpt.prof, rpt.options
|
||||
@ -339,6 +339,7 @@ func printTopProto(w io.Writer, rpt *Report) error {
|
||||
Line: []profile.Line{
|
||||
{
|
||||
Line: int64(n.Info.Lineno),
|
||||
Column: int64(n.Info.Columnno),
|
||||
Function: f,
|
||||
},
|
||||
},
|
||||
|
5
src/cmd/vendor/github.com/google/pprof/internal/report/stacks.go
generated
vendored
5
src/cmd/vendor/github.com/google/pprof/internal/report/stacks.go
generated
vendored
@ -18,7 +18,6 @@ import (
|
||||
"crypto/sha256"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"regexp"
|
||||
|
||||
"github.com/google/pprof/internal/measurement"
|
||||
"github.com/google/pprof/profile"
|
||||
@ -54,9 +53,6 @@ type StackSource struct {
|
||||
// Guaranteed to be non-empty.
|
||||
Display []string
|
||||
|
||||
// Regular expression (anchored) that matches exactly FullName.
|
||||
RE string
|
||||
|
||||
// Places holds the list of stack slots where this source occurs.
|
||||
// In particular, if [a,b] is an element in Places,
|
||||
// StackSet.Stacks[a].Sources[b] points to this source.
|
||||
@ -135,7 +131,6 @@ func (s *StackSet) makeInitialStacks(rpt *Report) {
|
||||
unknownIndex++
|
||||
}
|
||||
x.Inlined = inlined
|
||||
x.RE = "^" + regexp.QuoteMeta(x.UniqueName) + "$"
|
||||
x.Display = shortNameList(x.FullName)
|
||||
s.Sources = append(s.Sources, x)
|
||||
srcs[k] = len(s.Sources) - 1
|
||||
|
1
src/cmd/vendor/github.com/google/pprof/internal/symbolizer/symbolizer.go
generated
vendored
1
src/cmd/vendor/github.com/google/pprof/internal/symbolizer/symbolizer.go
generated
vendored
@ -181,6 +181,7 @@ func doLocalSymbolize(prof *profile.Profile, fast, force bool, obj plugin.ObjToo
|
||||
l.Line[i] = profile.Line{
|
||||
Function: f,
|
||||
Line: int64(frame.Line),
|
||||
Column: int64(frame.Column),
|
||||
}
|
||||
}
|
||||
|
||||
|
3
src/cmd/vendor/github.com/google/pprof/profile/encode.go
generated
vendored
3
src/cmd/vendor/github.com/google/pprof/profile/encode.go
generated
vendored
@ -530,6 +530,7 @@ func (p *Line) decoder() []decoder {
|
||||
func (p *Line) encode(b *buffer) {
|
||||
encodeUint64Opt(b, 1, p.functionIDX)
|
||||
encodeInt64Opt(b, 2, p.Line)
|
||||
encodeInt64Opt(b, 3, p.Column)
|
||||
}
|
||||
|
||||
var lineDecoder = []decoder{
|
||||
@ -538,6 +539,8 @@ var lineDecoder = []decoder{
|
||||
func(b *buffer, m message) error { return decodeUint64(b, &m.(*Line).functionIDX) },
|
||||
// optional int64 line = 2
|
||||
func(b *buffer, m message) error { return decodeInt64(b, &m.(*Line).Line) },
|
||||
// optional int64 column = 3
|
||||
func(b *buffer, m message) error { return decodeInt64(b, &m.(*Line).Column) },
|
||||
}
|
||||
|
||||
func (p *Function) decoder() []decoder {
|
||||
|
4
src/cmd/vendor/github.com/google/pprof/profile/legacy_java_profile.go
generated
vendored
4
src/cmd/vendor/github.com/google/pprof/profile/legacy_java_profile.go
generated
vendored
@ -56,7 +56,7 @@ func javaCPUProfile(b []byte, period int64, parse func(b []byte) (uint64, []byte
|
||||
}
|
||||
|
||||
// Strip out addresses for better merge.
|
||||
if err = p.Aggregate(true, true, true, true, false); err != nil {
|
||||
if err = p.Aggregate(true, true, true, true, false, false); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ func parseJavaProfile(b []byte) (*Profile, error) {
|
||||
}
|
||||
|
||||
// Strip out addresses for better merge.
|
||||
if err = p.Aggregate(true, true, true, true, false); err != nil {
|
||||
if err = p.Aggregate(true, true, true, true, false, false); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
4
src/cmd/vendor/github.com/google/pprof/profile/merge.go
generated
vendored
4
src/cmd/vendor/github.com/google/pprof/profile/merge.go
generated
vendored
@ -326,12 +326,13 @@ func (l *Location) key() locationKey {
|
||||
key.addr -= l.Mapping.Start
|
||||
key.mappingID = l.Mapping.ID
|
||||
}
|
||||
lines := make([]string, len(l.Line)*2)
|
||||
lines := make([]string, len(l.Line)*3)
|
||||
for i, line := range l.Line {
|
||||
if line.Function != nil {
|
||||
lines[i*2] = strconv.FormatUint(line.Function.ID, 16)
|
||||
}
|
||||
lines[i*2+1] = strconv.FormatInt(line.Line, 16)
|
||||
lines[i*2+2] = strconv.FormatInt(line.Column, 16)
|
||||
}
|
||||
key.lines = strings.Join(lines, "|")
|
||||
return key
|
||||
@ -418,6 +419,7 @@ func (pm *profileMerger) mapLine(src Line) Line {
|
||||
ln := Line{
|
||||
Function: pm.mapFunction(src.Function),
|
||||
Line: src.Line,
|
||||
Column: src.Column,
|
||||
}
|
||||
return ln
|
||||
}
|
||||
|
14
src/cmd/vendor/github.com/google/pprof/profile/profile.go
generated
vendored
14
src/cmd/vendor/github.com/google/pprof/profile/profile.go
generated
vendored
@ -145,6 +145,7 @@ type Location struct {
|
||||
type Line struct {
|
||||
Function *Function
|
||||
Line int64
|
||||
Column int64
|
||||
|
||||
functionIDX uint64
|
||||
}
|
||||
@ -436,7 +437,7 @@ func (p *Profile) CheckValid() error {
|
||||
// Aggregate merges the locations in the profile into equivalence
|
||||
// classes preserving the request attributes. It also updates the
|
||||
// samples to point to the merged locations.
|
||||
func (p *Profile) Aggregate(inlineFrame, function, filename, linenumber, address bool) error {
|
||||
func (p *Profile) Aggregate(inlineFrame, function, filename, linenumber, columnnumber, address bool) error {
|
||||
for _, m := range p.Mapping {
|
||||
m.HasInlineFrames = m.HasInlineFrames && inlineFrame
|
||||
m.HasFunctions = m.HasFunctions && function
|
||||
@ -458,7 +459,7 @@ func (p *Profile) Aggregate(inlineFrame, function, filename, linenumber, address
|
||||
}
|
||||
|
||||
// Aggregate locations
|
||||
if !inlineFrame || !address || !linenumber {
|
||||
if !inlineFrame || !address || !linenumber || !columnnumber {
|
||||
for _, l := range p.Location {
|
||||
if !inlineFrame && len(l.Line) > 1 {
|
||||
l.Line = l.Line[len(l.Line)-1:]
|
||||
@ -466,6 +467,12 @@ func (p *Profile) Aggregate(inlineFrame, function, filename, linenumber, address
|
||||
if !linenumber {
|
||||
for i := range l.Line {
|
||||
l.Line[i].Line = 0
|
||||
l.Line[i].Column = 0
|
||||
}
|
||||
}
|
||||
if !columnnumber {
|
||||
for i := range l.Line {
|
||||
l.Line[i].Column = 0
|
||||
}
|
||||
}
|
||||
if !address {
|
||||
@ -627,10 +634,11 @@ func (l *Location) string() string {
|
||||
for li := range l.Line {
|
||||
lnStr := "??"
|
||||
if fn := l.Line[li].Function; fn != nil {
|
||||
lnStr = fmt.Sprintf("%s %s:%d s=%d",
|
||||
lnStr = fmt.Sprintf("%s %s:%d:%d s=%d",
|
||||
fn.Name,
|
||||
fn.Filename,
|
||||
l.Line[li].Line,
|
||||
l.Line[li].Column,
|
||||
fn.StartLine)
|
||||
if fn.Name != fn.SystemName {
|
||||
lnStr = lnStr + "(" + fn.SystemName + ")"
|
||||
|
201
src/cmd/vendor/github.com/google/pprof/third_party/d3flamegraph/D3_FLAME_GRAPH_LICENSE
generated
vendored
201
src/cmd/vendor/github.com/google/pprof/third_party/d3flamegraph/D3_FLAME_GRAPH_LICENSE
generated
vendored
@ -1,201 +0,0 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
13
src/cmd/vendor/github.com/google/pprof/third_party/d3flamegraph/D3_LICENSE
generated
vendored
13
src/cmd/vendor/github.com/google/pprof/third_party/d3flamegraph/D3_LICENSE
generated
vendored
@ -1,13 +0,0 @@
|
||||
Copyright 2010-2021 Mike Bostock
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose
|
||||
with or without fee is hereby granted, provided that the above copyright notice
|
||||
and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
33
src/cmd/vendor/github.com/google/pprof/third_party/d3flamegraph/README.md
generated
vendored
33
src/cmd/vendor/github.com/google/pprof/third_party/d3flamegraph/README.md
generated
vendored
@ -1,33 +0,0 @@
|
||||
# Building a customized D3.js bundle
|
||||
|
||||
The D3.js version distributed with pprof is customized to only include the
|
||||
modules required by pprof.
|
||||
|
||||
## Dependencies
|
||||
|
||||
- Install [npm](https://www.npmjs.com).
|
||||
|
||||
## Building
|
||||
|
||||
- Run `update.sh` to:
|
||||
- Download npm package dependencies (declared in `package.json` and `package-lock.json`)
|
||||
- Create a d3.js bundle containing the JavScript of d3 and d3-flame-graph (by running `webpack`)
|
||||
|
||||
This will `d3_flame_graph.go`, the minified custom D3.js bundle as Go source code.
|
||||
|
||||
# References / Appendix
|
||||
|
||||
## D3 Custom Bundle
|
||||
|
||||
A demonstration of building a custom D3 4.0 bundle using ES2015 modules and Rollup.
|
||||
|
||||
[bl.ocks.org/mbostock/bb09af4c39c79cffcde4](https://bl.ocks.org/mbostock/bb09af4c39c79cffcde4)
|
||||
|
||||
## Old version of d3-pprof
|
||||
|
||||
A previous version of d3-flame-graph bundled for pprof used Rollup instead of
|
||||
Webpack. This has now been migrated directly into this directory.
|
||||
|
||||
The repository configuring Rollup was here:
|
||||
|
||||
[github.com/spiermar/d3-pprof](https://github.com/spiermar/d3-pprof)
|
65
src/cmd/vendor/github.com/google/pprof/third_party/d3flamegraph/d3_flame_graph.go
generated
vendored
65
src/cmd/vendor/github.com/google/pprof/third_party/d3flamegraph/d3_flame_graph.go
generated
vendored
File diff suppressed because one or more lines are too long
13
src/cmd/vendor/github.com/google/pprof/third_party/d3flamegraph/index.js
generated
vendored
13
src/cmd/vendor/github.com/google/pprof/third_party/d3flamegraph/index.js
generated
vendored
@ -1,13 +0,0 @@
|
||||
// This file exports a stripped-down API surface of d3 and d3-flame-graph,
|
||||
// using only the functions used by pprof.
|
||||
|
||||
export {
|
||||
select,
|
||||
} from "d3-selection";
|
||||
|
||||
export {
|
||||
default as flamegraph
|
||||
// If we export from "d3-flame-graph" that exports the "dist" version which
|
||||
// includes another copy of d3-selection. To avoid including d3-selection
|
||||
// twice in the output, instead import the "src" version.
|
||||
} from "d3-flame-graph/src/flamegraph";
|
1106
src/cmd/vendor/github.com/google/pprof/third_party/d3flamegraph/package-lock.json
generated
vendored
1106
src/cmd/vendor/github.com/google/pprof/third_party/d3flamegraph/package-lock.json
generated
vendored
File diff suppressed because it is too large
Load Diff
17
src/cmd/vendor/github.com/google/pprof/third_party/d3flamegraph/package.json
generated
vendored
17
src/cmd/vendor/github.com/google/pprof/third_party/d3flamegraph/package.json
generated
vendored
@ -1,17 +0,0 @@
|
||||
{
|
||||
"name": "d3-pprof",
|
||||
"version": "2.0.0",
|
||||
"description": "A d3.js bundle for pprof.",
|
||||
"scripts": {
|
||||
"prepare": "webpack --mode production"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"d3-flame-graph": "^4.1.3",
|
||||
"d3-selection": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"webpack": "^5.64.4",
|
||||
"webpack-cli": "^4.9.1"
|
||||
}
|
||||
}
|
62
src/cmd/vendor/github.com/google/pprof/third_party/d3flamegraph/update.sh
generated
vendored
62
src/cmd/vendor/github.com/google/pprof/third_party/d3flamegraph/update.sh
generated
vendored
@ -1,62 +0,0 @@
|
||||
# Copyright 2021 Google Inc. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
D3FLAMEGRAPH_CSS="d3-flamegraph.css"
|
||||
|
||||
cd $(dirname $0)
|
||||
|
||||
generate_d3_flame_graph_go() {
|
||||
npm install
|
||||
# https://stackoverflow.com/a/21199041/171898
|
||||
local d3_js=$(cat d3.js | sed 's/`/`+"`"+`/g')
|
||||
local d3_css=$(cat "node_modules/d3-flame-graph/dist/${D3FLAMEGRAPH_CSS}")
|
||||
|
||||
cat <<-EOF > d3_flame_graph.go
|
||||
// D3.js is a JavaScript library for manipulating documents based on data.
|
||||
// https://github.com/d3/d3
|
||||
// See D3_LICENSE file for license details
|
||||
|
||||
// d3-flame-graph is a D3.js plugin that produces flame graphs from hierarchical data.
|
||||
// https://github.com/spiermar/d3-flame-graph
|
||||
// See D3_FLAME_GRAPH_LICENSE file for license details
|
||||
|
||||
package d3flamegraph
|
||||
|
||||
// JSSource returns the d3 and d3-flame-graph JavaScript bundle
|
||||
const JSSource = \`
|
||||
|
||||
$d3_js
|
||||
\`
|
||||
|
||||
// CSSSource returns the $D3FLAMEGRAPH_CSS file
|
||||
const CSSSource = \`
|
||||
$d3_css
|
||||
\`
|
||||
|
||||
EOF
|
||||
gofmt -w d3_flame_graph.go
|
||||
}
|
||||
|
||||
get_licenses() {
|
||||
cp node_modules/d3-selection/LICENSE D3_LICENSE
|
||||
cp node_modules/d3-flame-graph/LICENSE D3_FLAME_GRAPH_LICENSE
|
||||
}
|
||||
|
||||
get_licenses
|
||||
generate_d3_flame_graph_go
|
13
src/cmd/vendor/github.com/google/pprof/third_party/d3flamegraph/webpack.config.js
generated
vendored
13
src/cmd/vendor/github.com/google/pprof/third_party/d3flamegraph/webpack.config.js
generated
vendored
@ -1,13 +0,0 @@
|
||||
// Minimal webpack config to package a minified JS bundle (including
|
||||
// dependencies) for execution in a <script> tag in the browser.
|
||||
module.exports = {
|
||||
entry: './index.js',
|
||||
output: {
|
||||
path: __dirname, // Directory containing this webpack.config.js file.
|
||||
filename: 'd3.js',
|
||||
// Arbitrary; many module formats could be used, just keeping Universal
|
||||
// Module Definition as it's the same as what we used in a previous
|
||||
// version.
|
||||
libraryTarget: 'umd',
|
||||
},
|
||||
};
|
294
src/cmd/vendor/github.com/google/pprof/third_party/svgpan/svgpan.go
generated
vendored
294
src/cmd/vendor/github.com/google/pprof/third_party/svgpan/svgpan.go
generated
vendored
@ -3,295 +3,9 @@
|
||||
|
||||
package svgpan
|
||||
|
||||
import _ "embed"
|
||||
|
||||
// https://github.com/aleofreddi/svgpan
|
||||
|
||||
// JSSource returns the svgpan.js file
|
||||
const JSSource = `
|
||||
/**
|
||||
* SVGPan library 1.2.2
|
||||
* ======================
|
||||
*
|
||||
* Given an unique existing element with id "viewport" (or when missing, the
|
||||
* first g-element), including the library into any SVG adds the following
|
||||
* capabilities:
|
||||
*
|
||||
* - Mouse panning
|
||||
* - Mouse zooming (using the wheel)
|
||||
* - Object dragging
|
||||
*
|
||||
* You can configure the behaviour of the pan/zoom/drag with the variables
|
||||
* listed in the CONFIGURATION section of this file.
|
||||
*
|
||||
* Known issues:
|
||||
*
|
||||
* - Zooming (while panning) on Safari has still some issues
|
||||
*
|
||||
* Releases:
|
||||
*
|
||||
* 1.2.2, Tue Aug 30 17:21:56 CEST 2011, Andrea Leofreddi
|
||||
* - Fixed viewBox on root tag (#7)
|
||||
* - Improved zoom speed (#2)
|
||||
*
|
||||
* 1.2.1, Mon Jul 4 00:33:18 CEST 2011, Andrea Leofreddi
|
||||
* - Fixed a regression with mouse wheel (now working on Firefox 5)
|
||||
* - Working with viewBox attribute (#4)
|
||||
* - Added "use strict;" and fixed resulting warnings (#5)
|
||||
* - Added configuration variables, dragging is disabled by default (#3)
|
||||
*
|
||||
* 1.2, Sat Mar 20 08:42:50 GMT 2010, Zeng Xiaohui
|
||||
* Fixed a bug with browser mouse handler interaction
|
||||
*
|
||||
* 1.1, Wed Feb 3 17:39:33 GMT 2010, Zeng Xiaohui
|
||||
* Updated the zoom code to support the mouse wheel on Safari/Chrome
|
||||
*
|
||||
* 1.0, Andrea Leofreddi
|
||||
* First release
|
||||
*
|
||||
* This code is licensed under the following BSD license:
|
||||
*
|
||||
* Copyright 2009-2017 Andrea Leofreddi <a.leofreddi@vleo.net>. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDERS AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of Andrea Leofreddi.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
/// CONFIGURATION
|
||||
/// ====>
|
||||
|
||||
var enablePan = 1; // 1 or 0: enable or disable panning (default enabled)
|
||||
var enableZoom = 1; // 1 or 0: enable or disable zooming (default enabled)
|
||||
var enableDrag = 0; // 1 or 0: enable or disable dragging (default disabled)
|
||||
var zoomScale = 0.2; // Zoom sensitivity
|
||||
|
||||
/// <====
|
||||
/// END OF CONFIGURATION
|
||||
|
||||
var root = document.documentElement;
|
||||
|
||||
var state = 'none', svgRoot = null, stateTarget, stateOrigin, stateTf;
|
||||
|
||||
setupHandlers(root);
|
||||
|
||||
/**
|
||||
* Register handlers
|
||||
*/
|
||||
function setupHandlers(root){
|
||||
setAttributes(root, {
|
||||
"onmouseup" : "handleMouseUp(evt)",
|
||||
"onmousedown" : "handleMouseDown(evt)",
|
||||
"onmousemove" : "handleMouseMove(evt)",
|
||||
//"onmouseout" : "handleMouseUp(evt)", // Decomment this to stop the pan functionality when dragging out of the SVG element
|
||||
});
|
||||
|
||||
if(navigator.userAgent.toLowerCase().indexOf('webkit') >= 0)
|
||||
window.addEventListener('mousewheel', handleMouseWheel, false); // Chrome/Safari
|
||||
else
|
||||
window.addEventListener('DOMMouseScroll', handleMouseWheel, false); // Others
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the root element for SVG manipulation. The element is then cached into the svgRoot global variable.
|
||||
*/
|
||||
function getRoot(root) {
|
||||
if(svgRoot == null) {
|
||||
var r = root.getElementById("viewport") ? root.getElementById("viewport") : root.documentElement, t = r;
|
||||
|
||||
while(t != root) {
|
||||
if(t.getAttribute("viewBox")) {
|
||||
setCTM(r, t.getCTM());
|
||||
|
||||
t.removeAttribute("viewBox");
|
||||
}
|
||||
|
||||
t = t.parentNode;
|
||||
}
|
||||
|
||||
svgRoot = r;
|
||||
}
|
||||
|
||||
return svgRoot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instance an SVGPoint object with given event coordinates.
|
||||
*/
|
||||
function getEventPoint(evt) {
|
||||
var p = root.createSVGPoint();
|
||||
|
||||
p.x = evt.clientX;
|
||||
p.y = evt.clientY;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current transform matrix of an element.
|
||||
*/
|
||||
function setCTM(element, matrix) {
|
||||
var s = "matrix(" + matrix.a + "," + matrix.b + "," + matrix.c + "," + matrix.d + "," + matrix.e + "," + matrix.f + ")";
|
||||
|
||||
element.setAttribute("transform", s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dumps a matrix to a string (useful for debug).
|
||||
*/
|
||||
function dumpMatrix(matrix) {
|
||||
var s = "[ " + matrix.a + ", " + matrix.c + ", " + matrix.e + "\n " + matrix.b + ", " + matrix.d + ", " + matrix.f + "\n 0, 0, 1 ]";
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets attributes of an element.
|
||||
*/
|
||||
function setAttributes(element, attributes){
|
||||
for (var i in attributes)
|
||||
element.setAttributeNS(null, i, attributes[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle mouse wheel event.
|
||||
*/
|
||||
function handleMouseWheel(evt) {
|
||||
if(!enableZoom)
|
||||
return;
|
||||
|
||||
if(evt.preventDefault)
|
||||
evt.preventDefault();
|
||||
|
||||
evt.returnValue = false;
|
||||
|
||||
var svgDoc = evt.target.ownerDocument;
|
||||
|
||||
var delta;
|
||||
|
||||
if(evt.wheelDelta)
|
||||
delta = evt.wheelDelta / 360; // Chrome/Safari
|
||||
else
|
||||
delta = evt.detail / -9; // Mozilla
|
||||
|
||||
var z = Math.pow(1 + zoomScale, delta);
|
||||
|
||||
var g = getRoot(svgDoc);
|
||||
|
||||
var p = getEventPoint(evt);
|
||||
|
||||
p = p.matrixTransform(g.getCTM().inverse());
|
||||
|
||||
// Compute new scale matrix in current mouse position
|
||||
var k = root.createSVGMatrix().translate(p.x, p.y).scale(z).translate(-p.x, -p.y);
|
||||
|
||||
setCTM(g, g.getCTM().multiply(k));
|
||||
|
||||
if(typeof(stateTf) == "undefined")
|
||||
stateTf = g.getCTM().inverse();
|
||||
|
||||
stateTf = stateTf.multiply(k.inverse());
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle mouse move event.
|
||||
*/
|
||||
function handleMouseMove(evt) {
|
||||
if(evt.preventDefault)
|
||||
evt.preventDefault();
|
||||
|
||||
evt.returnValue = false;
|
||||
|
||||
var svgDoc = evt.target.ownerDocument;
|
||||
|
||||
var g = getRoot(svgDoc);
|
||||
|
||||
if(state == 'pan' && enablePan) {
|
||||
// Pan mode
|
||||
var p = getEventPoint(evt).matrixTransform(stateTf);
|
||||
|
||||
setCTM(g, stateTf.inverse().translate(p.x - stateOrigin.x, p.y - stateOrigin.y));
|
||||
} else if(state == 'drag' && enableDrag) {
|
||||
// Drag mode
|
||||
var p = getEventPoint(evt).matrixTransform(g.getCTM().inverse());
|
||||
|
||||
setCTM(stateTarget, root.createSVGMatrix().translate(p.x - stateOrigin.x, p.y - stateOrigin.y).multiply(g.getCTM().inverse()).multiply(stateTarget.getCTM()));
|
||||
|
||||
stateOrigin = p;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle click event.
|
||||
*/
|
||||
function handleMouseDown(evt) {
|
||||
if(evt.preventDefault)
|
||||
evt.preventDefault();
|
||||
|
||||
evt.returnValue = false;
|
||||
|
||||
var svgDoc = evt.target.ownerDocument;
|
||||
|
||||
var g = getRoot(svgDoc);
|
||||
|
||||
if(
|
||||
evt.target.tagName == "svg"
|
||||
|| !enableDrag // Pan anyway when drag is disabled and the user clicked on an element
|
||||
) {
|
||||
// Pan mode
|
||||
state = 'pan';
|
||||
|
||||
stateTf = g.getCTM().inverse();
|
||||
|
||||
stateOrigin = getEventPoint(evt).matrixTransform(stateTf);
|
||||
} else {
|
||||
// Drag mode
|
||||
state = 'drag';
|
||||
|
||||
stateTarget = evt.target;
|
||||
|
||||
stateTf = g.getCTM().inverse();
|
||||
|
||||
stateOrigin = getEventPoint(evt).matrixTransform(stateTf);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle mouse button release event.
|
||||
*/
|
||||
function handleMouseUp(evt) {
|
||||
if(evt.preventDefault)
|
||||
evt.preventDefault();
|
||||
|
||||
evt.returnValue = false;
|
||||
|
||||
var svgDoc = evt.target.ownerDocument;
|
||||
|
||||
if(state == 'pan' || state == 'drag') {
|
||||
// Quit pan mode
|
||||
state = '';
|
||||
}
|
||||
}
|
||||
`
|
||||
//go:embed svgpan.js
|
||||
var JSSource string
|
||||
|
261
src/cmd/vendor/github.com/google/pprof/third_party/svgpan/svgpan.js
generated
vendored
Normal file
261
src/cmd/vendor/github.com/google/pprof/third_party/svgpan/svgpan.js
generated
vendored
Normal file
@ -0,0 +1,261 @@
|
||||
/**
|
||||
* SVGPan library 1.2.2
|
||||
* ======================
|
||||
*
|
||||
* 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
|
||||
* capabilities:
|
||||
*
|
||||
* - Mouse panning
|
||||
* - Mouse zooming (using the wheel)
|
||||
* - Object dragging
|
||||
*
|
||||
* You can configure the behaviour of the pan/zoom/drag with the variables
|
||||
* listed in the CONFIGURATION section of this file.
|
||||
*
|
||||
* This code is licensed under the following BSD license:
|
||||
*
|
||||
* Copyright 2009-2019 Andrea Leofreddi <a.leofreddi@vleo.net>. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of Andrea Leofreddi.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
/// CONFIGURATION
|
||||
/// ====>
|
||||
|
||||
var enablePan = 1; // 1 or 0: enable or disable panning (default enabled)
|
||||
var enableZoom = 1; // 1 or 0: enable or disable zooming (default enabled)
|
||||
var enableDrag = 0; // 1 or 0: enable or disable dragging (default disabled)
|
||||
var zoomScale = 0.2; // Zoom sensitivity
|
||||
|
||||
/// <====
|
||||
/// END OF CONFIGURATION
|
||||
|
||||
var root = document.documentElement;
|
||||
var state = 'none', svgRoot = null, stateTarget, stateOrigin, stateTf;
|
||||
|
||||
setupHandlers(root);
|
||||
|
||||
/**
|
||||
* Register handlers
|
||||
*/
|
||||
function setupHandlers(root){
|
||||
setAttributes(root, {
|
||||
"onmouseup" : "handleMouseUp(evt)",
|
||||
"onmousedown" : "handleMouseDown(evt)",
|
||||
"onmousemove" : "handleMouseMove(evt)",
|
||||
//"onmouseout" : "handleMouseUp(evt)", // Decomment this to stop the pan functionality when dragging out of the SVG element
|
||||
});
|
||||
|
||||
if(navigator.userAgent.toLowerCase().indexOf('webkit') >= 0)
|
||||
window.addEventListener('mousewheel', handleMouseWheel, false); // Chrome/Safari
|
||||
else
|
||||
window.addEventListener('DOMMouseScroll', handleMouseWheel, false); // Others
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the root element for SVG manipulation. The element is then cached into the svgRoot global variable.
|
||||
*/
|
||||
function getRoot(root) {
|
||||
if(svgRoot == null) {
|
||||
var r = root.getElementById("viewport") ? root.getElementById("viewport") : root.documentElement, t = r;
|
||||
|
||||
while(t != root) {
|
||||
if(t.getAttribute("viewBox")) {
|
||||
setCTM(r, t.getCTM());
|
||||
|
||||
t.removeAttribute("viewBox");
|
||||
}
|
||||
|
||||
t = t.parentNode;
|
||||
}
|
||||
|
||||
svgRoot = r;
|
||||
}
|
||||
|
||||
return svgRoot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instance an SVGPoint object with given event coordinates.
|
||||
*/
|
||||
function getEventPoint(evt) {
|
||||
var p = root.createSVGPoint();
|
||||
|
||||
p.x = evt.clientX;
|
||||
p.y = evt.clientY;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current transform matrix of an element.
|
||||
*/
|
||||
function setCTM(element, matrix) {
|
||||
var s = "matrix(" + matrix.a + "," + matrix.b + "," + matrix.c + "," + matrix.d + "," + matrix.e + "," + matrix.f + ")";
|
||||
|
||||
element.setAttribute("transform", s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dumps a matrix to a string (useful for debug).
|
||||
*/
|
||||
function dumpMatrix(matrix) {
|
||||
var s = "[ " + matrix.a + ", " + matrix.c + ", " + matrix.e + "\n " + matrix.b + ", " + matrix.d + ", " + matrix.f + "\n 0, 0, 1 ]";
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets attributes of an element.
|
||||
*/
|
||||
function setAttributes(element, attributes){
|
||||
for (var i in attributes)
|
||||
element.setAttributeNS(null, i, attributes[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle mouse wheel event.
|
||||
*/
|
||||
function handleMouseWheel(evt) {
|
||||
if(!enableZoom)
|
||||
return;
|
||||
|
||||
if(evt.preventDefault)
|
||||
evt.preventDefault();
|
||||
|
||||
evt.returnValue = false;
|
||||
|
||||
var svgDoc = evt.target.ownerDocument;
|
||||
|
||||
var delta;
|
||||
|
||||
if(evt.wheelDelta)
|
||||
delta = evt.wheelDelta / 360; // Chrome/Safari
|
||||
else
|
||||
delta = evt.detail / -9; // Mozilla
|
||||
|
||||
var z = Math.pow(1 + zoomScale, delta);
|
||||
|
||||
var g = getRoot(svgDoc);
|
||||
|
||||
var p = getEventPoint(evt);
|
||||
|
||||
p = p.matrixTransform(g.getCTM().inverse());
|
||||
|
||||
// Compute new scale matrix in current mouse position
|
||||
var k = root.createSVGMatrix().translate(p.x, p.y).scale(z).translate(-p.x, -p.y);
|
||||
|
||||
setCTM(g, g.getCTM().multiply(k));
|
||||
|
||||
if(typeof(stateTf) == "undefined")
|
||||
stateTf = g.getCTM().inverse();
|
||||
|
||||
stateTf = stateTf.multiply(k.inverse());
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle mouse move event.
|
||||
*/
|
||||
function handleMouseMove(evt) {
|
||||
if(evt.preventDefault)
|
||||
evt.preventDefault();
|
||||
|
||||
evt.returnValue = false;
|
||||
|
||||
var svgDoc = evt.target.ownerDocument;
|
||||
|
||||
var g = getRoot(svgDoc);
|
||||
|
||||
if(state == 'pan' && enablePan) {
|
||||
// Pan mode
|
||||
var p = getEventPoint(evt).matrixTransform(stateTf);
|
||||
|
||||
setCTM(g, stateTf.inverse().translate(p.x - stateOrigin.x, p.y - stateOrigin.y));
|
||||
} else if(state == 'drag' && enableDrag) {
|
||||
// Drag mode
|
||||
var p = getEventPoint(evt).matrixTransform(g.getCTM().inverse());
|
||||
|
||||
setCTM(stateTarget, root.createSVGMatrix().translate(p.x - stateOrigin.x, p.y - stateOrigin.y).multiply(g.getCTM().inverse()).multiply(stateTarget.getCTM()));
|
||||
|
||||
stateOrigin = p;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle click event.
|
||||
*/
|
||||
function handleMouseDown(evt) {
|
||||
if(evt.preventDefault)
|
||||
evt.preventDefault();
|
||||
|
||||
evt.returnValue = false;
|
||||
|
||||
var svgDoc = evt.target.ownerDocument;
|
||||
|
||||
var g = getRoot(svgDoc);
|
||||
|
||||
if(
|
||||
evt.target.tagName == "svg"
|
||||
|| !enableDrag // Pan anyway when drag is disabled and the user clicked on an element
|
||||
) {
|
||||
// Pan mode
|
||||
state = 'pan';
|
||||
|
||||
stateTf = g.getCTM().inverse();
|
||||
|
||||
stateOrigin = getEventPoint(evt).matrixTransform(stateTf);
|
||||
} else {
|
||||
// Drag mode
|
||||
state = 'drag';
|
||||
|
||||
stateTarget = evt.target;
|
||||
|
||||
stateTf = g.getCTM().inverse();
|
||||
|
||||
stateOrigin = getEventPoint(evt).matrixTransform(stateTf);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle mouse button release event.
|
||||
*/
|
||||
function handleMouseUp(evt) {
|
||||
if(evt.preventDefault)
|
||||
evt.preventDefault();
|
||||
|
||||
evt.returnValue = false;
|
||||
|
||||
var svgDoc = evt.target.ownerDocument;
|
||||
|
||||
if(state == 'pan' || state == 'drag') {
|
||||
// Quit pan mode
|
||||
state = '';
|
||||
}
|
||||
}
|
3
src/cmd/vendor/modules.txt
vendored
3
src/cmd/vendor/modules.txt
vendored
@ -1,4 +1,4 @@
|
||||
# github.com/google/pprof v0.0.0-20230811205829-9131a7e9cc17
|
||||
# github.com/google/pprof v0.0.0-20240207164012-fb44976bdcd5
|
||||
## explicit; go 1.19
|
||||
github.com/google/pprof/driver
|
||||
github.com/google/pprof/internal/binutils
|
||||
@ -12,7 +12,6 @@ github.com/google/pprof/internal/symbolizer
|
||||
github.com/google/pprof/internal/symbolz
|
||||
github.com/google/pprof/internal/transport
|
||||
github.com/google/pprof/profile
|
||||
github.com/google/pprof/third_party/d3flamegraph
|
||||
github.com/google/pprof/third_party/svgpan
|
||||
# github.com/ianlancetaylor/demangle v0.0.0-20230524184225-eabc099b10ab
|
||||
## explicit; go 1.13
|
||||
|
Loading…
Reference in New Issue
Block a user