mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-05 04:21:01 +02:00
Saves 442 KB. Lock it with a new min test. Updates #12614 Change-Id: Ia7bf6f797b6cbf08ea65419ade2f359d390f8e91 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
29 lines
559 B
Go
29 lines
559 B
Go
// Copyright (c) Tailscale Inc & AUTHORS
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
//go:build !ios && !android && !js && !ts_omit_debug
|
|
|
|
// We don't include it on mobile where we're more memory constrained and
|
|
// there's no CLI to get at the results anyway.
|
|
|
|
package localapi
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/pprof"
|
|
)
|
|
|
|
func init() {
|
|
servePprofFunc = servePprof
|
|
}
|
|
|
|
func servePprof(w http.ResponseWriter, r *http.Request) {
|
|
name := r.FormValue("name")
|
|
switch name {
|
|
case "profile":
|
|
pprof.Profile(w, r)
|
|
default:
|
|
pprof.Handler(name).ServeHTTP(w, r)
|
|
}
|
|
}
|