|
21 | 21 | // log.Println(http.ListenAndServe("localhost:6060", nil))
|
22 | 22 | // }()
|
23 | 23 | //
|
| 24 | +// By default, all the profiles listed in [runtime/pprof.Profile] are |
| 25 | +// available (via [Handler]), in addition to the [Cmdline], [Profile], [Symbol], |
| 26 | +// and [Trace] profiles defined in this package. |
24 | 27 | // If you are not using DefaultServeMux, you will have to register handlers
|
25 | 28 | // with the mux you are using.
|
26 | 29 | //
|
27 |
| -// Then use the pprof tool to look at the heap profile: |
| 30 | +// # Usage examples |
| 31 | +// |
| 32 | +// Use the pprof tool to look at the heap profile: |
28 | 33 | //
|
29 | 34 | // go tool pprof http://localhost:6060/debug/pprof/heap
|
30 | 35 | //
|
@@ -222,6 +227,7 @@ func Symbol(w http.ResponseWriter, r *http.Request) {
|
222 | 227 | }
|
223 | 228 |
|
224 | 229 | // Handler returns an HTTP handler that serves the named profile.
|
| 230 | +// Available profiles can be found in [runtime/pprof.Profile]. |
225 | 231 | func Handler(name string) http.Handler {
|
226 | 232 | return handler(name)
|
227 | 233 | }
|
@@ -345,7 +351,7 @@ var profileDescriptions = map[string]string{
|
345 | 351 | "allocs": "A sampling of all past memory allocations",
|
346 | 352 | "block": "Stack traces that led to blocking on synchronization primitives",
|
347 | 353 | "cmdline": "The command line invocation of the current program",
|
348 |
| - "goroutine": "Stack traces of all current goroutines", |
| 354 | + "goroutine": "Stack traces of all current goroutines. Use debug=2 as a query parameter to export in the same format as an unrecovered panic.", |
349 | 355 | "heap": "A sampling of memory allocations of live objects. You can specify the gc GET parameter to run GC before taking the heap sample.",
|
350 | 356 | "mutex": "Stack traces of holders of contended mutexes",
|
351 | 357 | "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 {
|
417 | 423 | </style>
|
418 | 424 | </head>
|
419 | 425 | <body>
|
420 |
| -/debug/pprof/<br> |
| 426 | +/debug/pprof/ |
| 427 | +<br> |
| 428 | +<p>Set debug=1 as a query parameter to export in legacy text format</p> |
421 | 429 | <br>
|
422 | 430 | Types of profiles available:
|
423 | 431 | <table>
|
|
0 commit comments