aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/vendor/github.com/google/pprof/internal/driver/webhtml.go
diff options
context:
space:
mode:
authorEmmanuel T Odeke <emmanuel@orijtech.com>2024-05-27 21:07:22 -0600
committerGopher Robot <gobot@golang.org>2024-05-31 19:48:28 +0000
commit9b43bfbc51c469ec13fca24960834a75b2bf66eb (patch)
treecafe177d5e024ae1a903f9c69824ed99ee673082 /src/cmd/vendor/github.com/google/pprof/internal/driver/webhtml.go
parent00b8071a12e298303b2f4bd0e9f641ef3e54772a (diff)
downloadgo-9b43bfbc51c469ec13fca24960834a75b2bf66eb.tar.xz
cmd/vendor: update github.com/google/pprof
Brings in the latest github.com/google/pprof. Fixes #67626 Change-Id: Id8faef20f0a9bf81dd117110bf540aca852db6be Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/go/+/588655 Reviewed-by: Carlos Amedee <carlos@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Diffstat (limited to 'src/cmd/vendor/github.com/google/pprof/internal/driver/webhtml.go')
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/driver/webhtml.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/webhtml.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/webhtml.go
index 984936a9d6..0b8630bcf1 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/webhtml.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/webhtml.go
@@ -19,8 +19,27 @@ import (
"fmt"
"html/template"
"os"
+ "sync"
+
+ "github.com/google/pprof/internal/report"
+)
+
+var (
+ htmlTemplates *template.Template // Lazily loaded templates
+ htmlTemplateInit sync.Once
)
+// getHTMLTemplates returns the set of HTML templates used by pprof,
+// initializing them if necessary.
+func getHTMLTemplates() *template.Template {
+ htmlTemplateInit.Do(func() {
+ htmlTemplates = template.New("templategroup")
+ addTemplates(htmlTemplates)
+ report.AddSourceTemplates(htmlTemplates)
+ })
+ return htmlTemplates
+}
+
//go:embed html
var embeddedFiles embed.FS
@@ -54,6 +73,7 @@ func addTemplates(templates *template.Template) {
def("css", loadCSS("html/common.css"))
def("header", loadFile("html/header.html"))
def("graph", loadFile("html/graph.html"))
+ def("graph_css", loadCSS("html/graph.css"))
def("script", loadJS("html/common.js"))
def("top", loadFile("html/top.html"))
def("sourcelisting", loadFile("html/source.html"))