pprof

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2021 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package pprof serves the /debug/pprof endpoint

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartServer

func StartServer(port int)

StartServer starts a PProf server in background. Endpoints usage example:

curl http://localhost:6063/debug/pprof/allocs > allocs.pprof
pprof -http=: allocs.pprof

wget http://localhost:31415/debug/pprof/goroutine
pprof -http=: goroutine

wget http://localhost:31415/debug/pprof/heap
pprof -http=: heap

wget http://localhost:31415/debug/pprof/trace
pprof -http=: trace

Types

type Stoppable

type Stoppable interface {
	Stop()
}

func ProbeCPU

func ProbeCPU() Stoppable

ProbeCPU is used like the following:

defer pprof.ProbeCPU.Stop()

When the caller reaches its function end, the defer executes Stop() that writes the file "cpu.pprof". To visualize "cpu.pprof" use the pprof tool:

cd ~/go
go get -u github.com/google/pprof
cd -
pprof -http=: cpu.pprof

Jump to

Keyboard shortcuts

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