pprof

package
v0.1.7-nubit.1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ScalerBlockProfile = MutexProfileScaler{}
View Source
var ScalerMutexProfile = MutexProfileScaler{}

Functions

func Runtime_cyclesPerSecond

func Runtime_cyclesPerSecond() int64

func ScaleHeapSample

func ScaleHeapSample(count, size, rate int64) (int64, int64)

ScaleHeapSample adjusts the data from a heap Sample to account for its probability of appearing in the collected data. heap profiles are a sampling of the memory allocations requests in a program. We estimate the unsampled value by dividing each collected sample by its probability of appearing in the profile. heap profiles rely on a poisson process to determine which samples to collect, based on the desired average collection rate R. The probability of a sample of size S to appear in that profile is 1-exp(-S/R).

func ScaleMutexProfile

func ScaleMutexProfile(_ MutexProfileScaler, cnt int64, ns float64) (int64, float64)

ScaleMutexProfile is a no-op for go1.20+. https://github.com/golang/go/commit/30b1af00ff142a3f1a5e2a0f32cf04a649bd5e65

Types

type DeltaHeapProfiler

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

func (*DeltaHeapProfiler) WriteHeapProto

func (d *DeltaHeapProfiler) WriteHeapProto(b ProfileBuilder, p []runtime.MemProfileRecord, rate int64) error

WriteHeapProto writes the current heap profile in protobuf format to w.

type DeltaMutexProfiler

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

func (*DeltaMutexProfiler) PrintCountCycleProfile

func (d *DeltaMutexProfiler) PrintCountCycleProfile(b ProfileBuilder, scaler MutexProfileScaler, records []runtime.BlockProfileRecord) error

PrintCountCycleProfile outputs block profile records (for block or mutex profiles) as the pprof-proto format output. Translations from cycle count to time duration are done because The proto expects count and time (nanoseconds) instead of count and the number of cycles for block, contention profiles. Possible 'scaler' functions are scaleBlockProfile and scaleMutexProfile.

type MutexProfileScaler

type MutexProfileScaler struct {
}

type ProfileBuilder

type ProfileBuilder interface {
	LocsForStack(stk []uintptr) (newLocs []uint64)
	Sample(values []int64, locs []uint64, blockSize int64)
	Build()
}

func NewProfileBuilder

func NewProfileBuilder(w io.Writer, opt *ProfileBuilderOptions, stc ProfileConfig) ProfileBuilder

NewProfileBuilder returns a new profileBuilder. CPU profiling data obtained from the runtime can be added by calling b.addCPUData, and then the eventual profile can be obtained by calling b.finish.

type ProfileBuilderOptions

type ProfileBuilderOptions struct {
	// for go1.21+ if true - use runtime_FrameSymbolName - produces frames with generic types, for example [go.shape.int]
	// for go1.21+ if false - use runtime.Frame->Function - produces frames with generic types ommited [...]
	// pre 1.21 - always use runtime.Frame->Function - produces frames with generic types ommited [...]
	GenericsFrames bool
	LazyMapping    bool
	// contains filtered or unexported fields
}

type ProfileConfig

type ProfileConfig struct {
	PeriodType        ValueType
	Period            int64
	SampleType        []ValueType
	DefaultSampleType string
}

func HeapProfileConfig

func HeapProfileConfig(rate int64) ProfileConfig

func MutexProfileConfig

func MutexProfileConfig() ProfileConfig

type ValueType

type ValueType struct {
	Typ, Unit string
}

Jump to

Keyboard shortcuts

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