-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.go
40 lines (34 loc) · 1.05 KB
/
profile.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
Copyright © 2025 Seednode <seednode@seedno.de>
*/
package main
import (
"net/http/pprof"
"sync"
"github.com/julienschmidt/httprouter"
)
func registerProfile(mux *httprouter.Router, usage *sync.Map) {
const module = "profile"
mux.Handler("GET", "/pprof/allocs", pprof.Handler("allocs"))
mux.Handler("GET", "/pprof/block", pprof.Handler("block"))
mux.Handler("GET", "/pprof/goroutine", pprof.Handler("goroutine"))
mux.Handler("GET", "/pprof/heap", pprof.Handler("heap"))
mux.Handler("GET", "/pprof/mutex", pprof.Handler("mutex"))
mux.Handler("GET", "/pprof/threadcreate", pprof.Handler("threadcreate"))
mux.HandlerFunc("GET", "/pprof/cmdline", pprof.Cmdline)
mux.HandlerFunc("GET", "/pprof/profile", pprof.Profile)
mux.HandlerFunc("GET", "/pprof/symbol", pprof.Symbol)
mux.HandlerFunc("GET", "/pprof/trace", pprof.Trace)
usage.Store(module, []string{
"/pprof/allocs",
"/pprof/block",
"/pprof/cmdline",
"/pprof/goroutine",
"/pprof/heap",
"/pprof/mutex",
"/pprof/profile",
"/pprof/symbol",
"/pprof/threadcreate",
"/pprof/trace",
})
}