aboutsummaryrefslogtreecommitdiff
path: root/src/net/http
diff options
context:
space:
mode:
authorSean Liao <sean@liao.dev>2022-08-06 13:54:28 +0100
committerDaniel Martí <mvdan@mvdan.cc>2022-08-31 09:38:38 +0000
commit3486735bf2ca08dcd84bb820fdcb0dea8102cf82 (patch)
tree336d0eef7332208e11a5e59d991ae9613b22a0dc /src/net/http
parent3680b5e9c4f42fcf9155aa42b3b344d1fbe19571 (diff)
downloadgo-3486735bf2ca08dcd84bb820fdcb0dea8102cf82.tar.xz
net/http/pprof: link docs to runtime/pprof
And add some documentation for the debug query param. Fixes #27737 Fixes #53971 Change-Id: I629aaa2d4a43175381eb04872f1caad238519a41 Reviewed-on: https://go-review.googlesource.com/c/go/+/421635 Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/net/http')
-rw-r--r--src/net/http/pprof/pprof.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/net/http/pprof/pprof.go b/src/net/http/pprof/pprof.go
index de5a4b9752..bba522768f 100644
--- a/src/net/http/pprof/pprof.go
+++ b/src/net/http/pprof/pprof.go
@@ -21,10 +21,15 @@
// log.Println(http.ListenAndServe("localhost:6060", nil))
// }()
//
+// By default, all the profiles listed in [runtime/pprof.Profile] are
+// available (via [Handler]), in addition to the [Cmdline], [Profile], [Symbol],
+// and [Trace] profiles defined in this package.
// If you are not using DefaultServeMux, you will have to register handlers
// with the mux you are using.
//
-// Then use the pprof tool to look at the heap profile:
+// # Usage examples
+//
+// Use the pprof tool to look at the heap profile:
//
// go tool pprof http://localhost:6060/debug/pprof/heap
//
@@ -222,6 +227,7 @@ func Symbol(w http.ResponseWriter, r *http.Request) {
}
// Handler returns an HTTP handler that serves the named profile.
+// Available profiles can be found in [runtime/pprof.Profile].
func Handler(name string) http.Handler {
return handler(name)
}
@@ -345,7 +351,7 @@ var profileDescriptions = map[string]string{
"allocs": "A sampling of all past memory allocations",
"block": "Stack traces that led to blocking on synchronization primitives",
"cmdline": "The command line invocation of the current program",
- "goroutine": "Stack traces of all current goroutines",
+ "goroutine": "Stack traces of all current goroutines. Use debug=2 as a query parameter to export in the same format as an unrecovered panic.",
"heap": "A sampling of memory allocations of live objects. You can specify the gc GET parameter to run GC before taking the heap sample.",
"mutex": "Stack traces of holders of contended mutexes",
"profile": "CPU profile. You can specify the duration in the seconds GET parameter. After you get the profile file, use the go tool pprof command to investigate the profile.",
@@ -417,7 +423,9 @@ func indexTmplExecute(w io.Writer, profiles []profileEntry) error {
</style>
</head>
<body>
-/debug/pprof/<br>
+/debug/pprof/
+<br>
+<p>Set debug=1 as a query parameter to export in legacy text format</p>
<br>
Types of profiles available:
<table>