profiler

package
v0.0.0-...-eb47728 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package profiler is a simple abstraction for easily running runtime profiles and storing the results to files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProfileConfig

type ProfileConfig struct {
	// List of selected Profiler Modes
	Modes []string `required:"false" split_words:"true" default:"Cpu,"`

	// Directory path to dump the profile output to. Default is current directory.
	DirPath string `required:"false" split_words:"true" default:"."`

	// Quiet disables info log output.
	Quiet bool `required:"false" split_words:"true" default:true`

	// NoShutdownHook controls whether the profiling package should
	// hook SIGINT to automatically Stop().
	NoShutdownHook bool `required:"false" split_words:"true" default:true`

	// MemProfileRate is the rate for the memory profiler. Default is 4096.
	// To include every allocated block in the profile, set MemProfileRate to 1.
	MemProfileRate int `required:"false" split_words:"true" default:4096`

	// MemProfileType = heap or alloc. Default is heap.
	MemProfileType string `required:"false" split_words:"true" default:"heap"`
}

func (*ProfileConfig) Specified

func (c *ProfileConfig) Specified() bool

type Profiler

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

Profiler represents an active profiling session.

func New

func New(c ProfileConfig) *Profiler

New returns a new Profiler. One or more modes can be provided in config. Configuration can be directly applied once `prof` is initiailized. eg: `prof.Path = "./output"`

func (*Profiler) Start

func (prof *Profiler) Start()

func (*Profiler) Stop

func (pr *Profiler) Stop()

Stop runs all the profile stop functions.

type ProfilerMode

type ProfilerMode int
const (
	Block ProfilerMode = iota
	Cpu
	Goroutine
	Mem
	Mutex
	ThreadCreate
	Trace
)

func NewProfilerMode

func NewProfilerMode(s string) ProfilerMode

func (ProfilerMode) String

func (i ProfilerMode) String() string

Jump to

Keyboard shortcuts

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