You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Documented the duration parameter in Profile() to match with Trace().
- Properly handling the error from strconv.ParseInt to match with Trace().
- Updated the profiles tables to include additional handlers exposed from
net/http/pprof. Added a separate section at the bottom to explain what
the profiles are and how to use them.
Fixes#24380
Change-Id: I8b7e100d6826a4feec81f29f918e7a7f7ccc71a0
Reviewed-on: https://go-review.googlesource.com/112495
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
"allocs": "A sampling of all past memory allocations",
250
+
"block": "Stack traces that led to blocking on synchronization primitives",
251
+
"cmdline": "The command line invocation of the current program",
252
+
"goroutine": "Stack traces of all current goroutines",
253
+
"heap": "A sampling of memory allocations of live objects. You can specify the gc GET parameter to run GC before taking the heap sample.",
254
+
"mutex": "Stack traces of holders of contended mutexes",
255
+
"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.",
256
+
"threadcreate": "Stack traces that led to the creation of new OS threads",
257
+
"trace": "A trace of execution of the current program. You can specify the duration in the seconds GET parameter. After you get the trace file, use the go tool trace command to investigate the trace.",
258
+
}
259
+
246
260
// Index responds with the pprof-formatted profile named by the request.
247
261
// For example, "/debug/pprof/heap" serves the "heap" profile.
248
262
// Index responds to a request for "/debug/pprof/" with an HTML page
@@ -256,7 +270,35 @@ func Index(w http.ResponseWriter, r *http.Request) {
256
270
}
257
271
}
258
272
259
-
profiles:=pprof.Profiles()
273
+
typeprofilestruct {
274
+
Namestring
275
+
Hrefstring
276
+
Descstring
277
+
Countint
278
+
}
279
+
varprofiles []profile
280
+
for_, p:=rangepprof.Profiles() {
281
+
profiles=append(profiles, profile{
282
+
Name: p.Name(),
283
+
Href: p.Name() +"?debug=1",
284
+
Desc: profileDescriptions[p.Name()],
285
+
Count: p.Count(),
286
+
})
287
+
}
288
+
289
+
// Adding other profiles exposed from within this package
0 commit comments