package pprof

import (
	"net/http"
	"net/http/pprof"
)

func RegisterPprof(mux *http.ServeMux, contextPath string) {
	mux.HandleFunc(contextPath+"/", pprof.Index)
	mux.HandleFunc(contextPath+"/cmdline", pprof.Cmdline)
	mux.HandleFunc(contextPath+"/profile", pprof.Profile)
	mux.HandleFunc(contextPath+"/symbol", pprof.Symbol)
	mux.HandleFunc(contextPath+"/trace", pprof.Trace)

	// Add the allocs handler
	mux.Handle("/debug/pprof/allocs", pprof.Handler("allocs"))

	// Optional: Add other pprof handlers
	mux.Handle("/debug/pprof/goroutine", pprof.Handler("goroutine"))
	mux.Handle("/debug/pprof/heap", pprof.Handler("heap"))
	mux.Handle("/debug/pprof/threadcreate", pprof.Handler("threadcreate"))
	mux.Handle("/debug/pprof/block", pprof.Handler("block"))
}