gxpprof

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 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 added in v0.3.3

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)
Output:

Types

type BlockProfile added in v0.3.3

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 added in v0.3.3

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

type CPUProfile added in v0.3.3

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

CPUProfile captures the CPU profile.

func (CPUProfile) Capture added in v0.3.3

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

type GoroutineProfile added in v0.3.3

type GoroutineProfile struct{}

GoroutineProfile captures stack traces of all current goroutines.

func (GoroutineProfile) Capture added in v0.3.3

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

type HeapProfile added in v0.3.3

type HeapProfile struct{}

HeapProfile captures the heap profile.

func (HeapProfile) Capture added in v0.3.3

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

type MutexProfile added in v0.3.3

type MutexProfile struct{}

MutexProfile captures stack traces of holders of contended mutexes.

func (MutexProfile) Capture added in v0.3.3

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

type Profile added in v0.3.3

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

Profile represents a pprof profile.

type ThreadcreateProfile added in v0.3.3

type ThreadcreateProfile struct{}

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

func (ThreadcreateProfile) Capture added in v0.3.3

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

Jump to

Keyboard shortcuts

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