gxpprof

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package autopprof provides a development-time library to collect pprof profiles from Go programs.

This package is experimental and APIs may change. package autopprof

2017-11-05 16:38 Package gxpprof provides go process info

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Capture

func Capture(p Profile)

Capture captures the given profiles at SIGINT and opens a browser with the collected profiles.

Capture should be used in development-time and shouldn't be in production binaries.

func Gops

func Gops(addr string) error

@addr: ":10001"

Example

go test -v -run Gops

// err := Gops("127.0.0.1:60000")
err := Gops("")
if err != nil {
	fmt.Printf("error:%#v\n", err)
	return
}
time.Sleep(60e9)

Types

type BlockProfile

type BlockProfile struct {
	// Rate is the fraction of goroutine blocking events that
	// are reported in the blocking profile. The profiler aims to
	// sample an average of one blocking event per rate nanoseconds spent blocked.
	//
	// If zero value is provided, it will include every blocking event
	// in the profile.
	Rate int
}

BlockProfile captures stack traces that led to blocking on synchronization primitives.

func (BlockProfile) Capture

func (p BlockProfile) Capture() (string, error)

type CPUProfile

type CPUProfile struct {
	Duration time.Duration // 30 seconds by default
}

CPUProfile captures the CPU profile.

func (CPUProfile) Capture

func (p CPUProfile) Capture() (string, error)

type GoroutineProfile

type GoroutineProfile struct{}

GoroutineProfile captures stack traces of all current goroutines.

func (GoroutineProfile) Capture

func (p GoroutineProfile) Capture() (string, error)

type HeapProfile

type HeapProfile struct{}

HeapProfile captures the heap profile.

func (HeapProfile) Capture

func (p HeapProfile) Capture() (string, error)

type MutexProfile

type MutexProfile struct{}

MutexProfile captures stack traces of holders of contended mutexes.

func (MutexProfile) Capture

func (p MutexProfile) Capture() (string, error)

type Profile

type Profile interface {
	Capture() (profile string, err error)
}

Profile represents a pprof profile.

type ThreadcreateProfile

type ThreadcreateProfile struct{}

Threadcreate profile captures the stack traces that led to the creation of new OS threads.

func (ThreadcreateProfile) Capture

func (p ThreadcreateProfile) Capture() (string, error)

Jump to

Keyboard shortcuts

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