srs/internal/debug/pprof.go
winlin a217ff9a4e Proxy: Enable pprof endpoints and add WHEP performance analysis guide.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 18:18:46 -04:00

23 lines
414 B
Go

// Copyright (c) 2026 Winlin
//
// SPDX-License-Identifier: MIT
package debug
import (
"context"
"net/http"
_ "net/http/pprof"
"srsx/internal/env"
"srsx/internal/logger"
)
func HandleGoPprof(ctx context.Context, environment env.ProxyEnvironment) {
if addr := environment.GoPprof(); addr != "" {
go func() {
logger.Debug(ctx, "Start Go pprof at %v", addr)
http.ListenAndServe(addr, nil)
}()
}
}