mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-07 16:17:41 +00:00
ipn/ipnlocal: add c2n pprof option to force a GC
Like net/http/pprof has. Updates tailscale/corp#18514 Change-Id: I264adb6dcf5732d19707783b29b7273b4ca69cf4 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
5d1c72f76b
commit
6a860cfb35
@ -7,11 +7,17 @@
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"runtime"
|
||||||
"runtime/pprof"
|
"runtime/pprof"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
c2nLogHeap = func(w http.ResponseWriter, r *http.Request) {
|
c2nLogHeap = func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
// Support same optional gc parameter as net/http/pprof:
|
||||||
|
if gc, _ := strconv.Atoi(r.FormValue("gc")); gc > 0 {
|
||||||
|
runtime.GC()
|
||||||
|
}
|
||||||
pprof.WriteHeapProfile(w)
|
pprof.WriteHeapProfile(w)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user