debugutil

package
v3.5.8 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

README

Vearch CPU/Memory performance analyze

master/router node

ipaddr: remote ip address of master/router server pprof_port: pprof_port config of master/router server

show web ui options: http://ipaddr:pprof_port/debug/pprof/ui/

show profile result in web:

CPU:

http://ipaddr:pprof_port/debug/pprof/ui/profile http://ipaddr:pprof_port/debug/pprof/ui/profile?seconds=30

Memory:

http://ipaddr:pprof_port/debug/pprof/ui/heap

ps node

install perf tools in linux system ipaddr: remote ip address of ps server pprof_port: pprof_port config of ps server

CPU:

http://ipaddr:pprof_port/perf/profile

Memory:

http://ipaddr:pprof_port/perf/heap

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CPUProfile

func CPUProfile(w http.ResponseWriter, r *http.Request)

func CPUProfileDo

func CPUProfileDo(typ CPUProfileType, do func() error) error

CPUProfileDo invokes the closure while enabling (and disabling) the supplied CPUProfileMode. Errors if the profiling mode could not be set or if do() returns an error.

func CPUProfileHandler

func CPUProfileHandler(w http.ResponseWriter, r *http.Request)

CPUProfileHandler is replacement for `pprof.Profile` that supports additional options.

func GetPerfSVGHtml

func GetPerfSVGHtml(w io.Writer, name string, interval int64) error

func HeapProfile

func HeapProfile(w http.ResponseWriter, r *http.Request)

func StartUIPprofListener

func StartUIPprofListener(port int)

Types

type CPUProfileOptions

type CPUProfileOptions struct {
	// Number of seconds to profile for.
	Seconds int32
	// Whether to enable pprof labels while the profile is taken.
	WithLabels bool
}

CPUProfileOptions contains options for generating a CPU profile.

func CPUProfileOptionsFromRequest

func CPUProfileOptionsFromRequest(r *http.Request) CPUProfileOptions

CPUProfileOptionsFromRequest parses the `seconds` and `labels` fragments from the URL and populates CPUProfileOptions from it.

For convenience, `labels` defaults to true, that is, `?labels=false` must be specified to disable them. `seconds` defaults to the pprof default of 30s.

func (CPUProfileOptions) Type

func (opts CPUProfileOptions) Type() CPUProfileType

Type returns the CPUProfileType corresponding to the options.

type CPUProfileType

type CPUProfileType int32

CPUProfileType tracks whether a CPU profile is in progress.

const (
	// CPUProfileNone means that no CPU profile is currently taken.
	CPUProfileNone CPUProfileType = iota
	// CPUProfileDefault means that a CPU profile is currently taken, but
	// pprof labels are not enabled.
	CPUProfileDefault
	// CPUProfileWithLabels means that a CPU profile is currently taken and
	// pprof labels are enabled.
	CPUProfileWithLabels
)
var GlobalCPUProfiling CPUProfileType

type Server

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

Server serves the /debug/* family of tools.

func NewServer

func NewServer() *Server

NewServer sets up a debug server.

func (*Server) ServeHTTP

func (ds *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves various tools under the /debug endpoint. It restricts access according to the `server.remote_debugging.mode` cluster variable.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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