pprof

package
v0.0.82 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCacheDir

func GetCacheDir() (string, error)

GetCacheDir returns the XDG cache directory for term-llm. Uses $XDG_CACHE_HOME if set, otherwise ~/.cache

func IsServerRunning

func IsServerRunning() (int, bool)

IsServerRunning checks if a pprof server appears to be running. It checks if the port file exists and the port is reachable.

func PrintUsage

func PrintUsage(w io.Writer, port int)

PrintUsage prints helpful pprof commands to the given writer.

func ReadPortFile

func ReadPortFile() (int, error)

ReadPortFile reads the port from the registry file. Returns the port, or an error if the file doesn't exist or is invalid.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server wraps the net/http/pprof server for runtime profiling.

func NewServer

func NewServer() *Server

NewServer creates a new pprof Server.

func (*Server) Port

func (s *Server) Port() int

Port returns the port the server is listening on.

func (*Server) Start

func (s *Server) Start(port int) (int, error)

Start binds the pprof server to localhost on the given port. Use port 0 for a random available port. Returns the actual port the server is listening on.

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop gracefully shuts down the pprof server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL