internal

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RuntimeGolang = "golang"

	CategoryCPU    = "cpu"
	CategoryMemory = "memory"
	CategoryTime   = "time"

	TypeCPUUsage         = "cpu-usage"
	TypeMemoryAllocation = "memory-allocations"
	TypeBlockingCalls    = "blocking-calls"

	UnitSample      = "sample"
	UnitMillisecond = "millisecond"
	UnitMicrosecond = "microsecond"
	UnitNanosecond  = "nanosecond"
	UnitByte        = "byte"
	UnitKilobyte    = "kilobyte"
	UnitPercent     = "percent"
)
View Source
const (
	DefaultMaxBufferedProfiles = 100
)

Variables

View Source
var (
	GetPID = GetLocalPID
)
View Source
var (
	IncludeProfilerFrames = false
)

Functions

func GenerateUUID

func GenerateUUID() string

func GetLocalPID

func GetLocalPID() string

func NoopSendProfiles

func NoopSendProfiles(interface{}) error

NoopSendProfiles is the default function to be called by Recorded to send collected profiles

Types

type AllocationSampler

type AllocationSampler struct{}

func NewAllocationSampler

func NewAllocationSampler() *AllocationSampler

func (*AllocationSampler) Profile

func (as *AllocationSampler) Profile(duration int64, timespan int64) (*Profile, error)

func (*AllocationSampler) Reset

func (as *AllocationSampler) Reset()

func (*AllocationSampler) Start

func (as *AllocationSampler) Start() error

func (*AllocationSampler) Stop

func (as *AllocationSampler) Stop() error

type BlockSampler

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

func NewBlockSampler

func NewBlockSampler() *BlockSampler

func (*BlockSampler) Profile

func (bs *BlockSampler) Profile(duration, timespan int64) (*Profile, error)

func (*BlockSampler) Reset

func (bs *BlockSampler) Reset()

func (*BlockSampler) Start

func (bs *BlockSampler) Start() error

func (*BlockSampler) Stop

func (bs *BlockSampler) Stop() error

type CPUSampler

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

func NewCPUSampler

func NewCPUSampler() *CPUSampler

func (*CPUSampler) Profile

func (cs *CPUSampler) Profile(duration int64, timespan int64) (*Profile, error)

func (*CPUSampler) Reset

func (cs *CPUSampler) Reset()

func (*CPUSampler) Start

func (cs *CPUSampler) Start() error

func (*CPUSampler) Stop

func (cs *CPUSampler) Stop() error

type CallSite

type CallSite struct {
	MethodName string
	FileName   string
	FileLine   int64
	Metadata   map[string]string
	// contains filtered or unexported fields
}

func NewCallSite

func NewCallSite(methodName string, fileName string, fileLine int64) *CallSite

func (*CallSite) FindOrAddChild

func (cs *CallSite) FindOrAddChild(methodName, fileName string, fileLine int64) *CallSite

func (*CallSite) Increment

func (cs *CallSite) Increment(value float64, numSamples int64)

func (*CallSite) Measurement

func (cs *CallSite) Measurement() (value float64, numSamples int64)

func (*CallSite) ToMap

func (cs *CallSite) ToMap() map[string]interface{}

type Flag

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

func (*Flag) IsSet

func (f *Flag) IsSet() bool

func (*Flag) Set

func (f *Flag) Set()

func (*Flag) SetIfUnset

func (f *Flag) SetIfUnset() bool

func (*Flag) Unset

func (f *Flag) Unset()

func (*Flag) UnsetIfSet

func (f *Flag) UnsetIfSet() bool

type Profile

type Profile struct {
	ID        string
	ProcessID string
	Runtime   string
	Category  string
	Type      string
	Unit      string
	Roots     []*CallSite
	Duration  int64
	Timespan  int64
	Timestamp int64
}

func NewProfile

func NewProfile(category string, typ string, unit string, roots []*CallSite, duration int64, timespan int64) *Profile

func (*Profile) ToMap

func (p *Profile) ToMap() map[string]interface{}

type Recorder

type Recorder struct {
	FlushInterval       int64
	MaxBufferedProfiles int
	SendProfiles        SendProfilesFunc
	// contains filtered or unexported fields
}

func NewRecorder

func NewRecorder() *Recorder

func (*Recorder) Flush

func (pr *Recorder) Flush()

func (*Recorder) Record

func (pr *Recorder) Record(record map[string]interface{})

func (*Recorder) Size

func (pr *Recorder) Size() int

func (*Recorder) Start

func (pr *Recorder) Start()

func (*Recorder) Stop

func (pr *Recorder) Stop()

type Sampler

type Sampler interface {
	Profile(duration int64, timespan int64) (*Profile, error)
	Start() error
	Stop() error
	Reset()
}

type SamplerConfig

type SamplerConfig struct {
	LogPrefix          string
	ReportOnly         bool
	MaxProfileDuration int64
	MaxSpanDuration    int64
	MaxSpanCount       int32
	SamplingInterval   int64
	ReportInterval     int64
}

type SamplerScheduler

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

func NewSamplerScheduler

func NewSamplerScheduler(profileRecorder *Recorder, samp Sampler, config SamplerConfig) *SamplerScheduler

func (*SamplerScheduler) Report

func (ss *SamplerScheduler) Report()

func (*SamplerScheduler) Reset

func (ss *SamplerScheduler) Reset()

func (*SamplerScheduler) Start

func (ss *SamplerScheduler) Start()

func (*SamplerScheduler) Stop

func (ss *SamplerScheduler) Stop()

type SendProfilesFunc

type SendProfilesFunc func(interface{}) error

SendProfilesFunc is a callback to emit collected profiles from recorder

type Timer

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

Timer periodically executes provided job after a delay until it's stopped. Any panic occurred inside the job is recovered and logged

func NewTimer

func NewTimer(delay, interval time.Duration, job func()) *Timer

func (*Timer) Stop

func (t *Timer) Stop()

Stop stops the job execution

Directories

Path Synopsis
pprof
profile
Package profile provides a representation of profile.proto and methods to encode/decode profiles in this format.
Package profile provides a representation of profile.proto and methods to encode/decode profiles in this format.

Jump to

Keyboard shortcuts

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