tsweb: restore CPU profiling handler

It was accidentally deleted in the earlier 0022c3d2e (#2143) refactor.
Lock it in with a test.

Fixes tailscale/corp#2503

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2021-09-02 08:57:14 -07:00
committed by Brad Fitzpatrick
parent daf54d1253
commit 722942dd46
2 changed files with 25 additions and 0 deletions

View File

@@ -47,6 +47,11 @@ func Debugger(mux *http.ServeMux) *DebugHandler {
}
mux.Handle("/debug/", ret)
// Register this one directly on mux, rather than using
// ret.URL/etc, as we don't need another line of output on the
// index page. The /pprof/ index already covers it.
mux.Handle("/debug/pprof/profile", http.HandlerFunc(pprof.Profile))
ret.KVFunc("Uptime", func() interface{} { return Uptime() })
ret.KV("Version", version.Long)
ret.Handle("vars", "Metrics (Go)", expvar.Handler())