pproflogging

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package pproflogging for pproflogging helper functions.

Index

Constants

View Source
const (
	// DefaultDebugProfileRate default sample/data fraction for profile sample collection rates (1/x, where x is the
	// data fraction sample rate).
	DefaultDebugProfileRate = 100
	// DefaultDebugProfileDumpBufferSizeB default size of the pprof output buffer.
	DefaultDebugProfileDumpBufferSizeB = 1 << 17
)
View Source
const (
	// KopiaDebugFlagForceGc force garbage collection before dumping heap data.
	KopiaDebugFlagForceGc = "forcegc"
	// KopiaDebugFlagDebug value of the profiles `debug` parameter.
	KopiaDebugFlagDebug = "debug"
	// KopiaDebugFlagRate rate setting for the named profile (if available). always an integer.
	KopiaDebugFlagRate = "rate"
)

flags used to configure profiling in EnvVarKopiaDebugPprof.

View Source
const (
	// ProfileNameBlock block profile key.
	ProfileNameBlock ProfileName = "block"
	// ProfileNameMutex mutex profile key.
	ProfileNameMutex = "mutex"
	// ProfileNameCPU cpu profile key.
	ProfileNameCPU = "cpu"
)
View Source
const (
	// EnvVarKopiaDebugPprof environment variable that contains the pprof dump configuration.
	EnvVarKopiaDebugPprof = "KOPIA_PPROF_LOGGING_CONFIG"
)
View Source
const (

	// PPROFDumpTimeout when dumping PPROF data, set an upper bound on the time it can take to log.
	PPROFDumpTimeout = 15 * time.Second
)

Variables

View Source
var (
	// ErrEmptyProfileName returned when a profile configuration flag has no argument.
	ErrEmptyProfileName = errors.New("empty profile flag")
)

Functions

func DumpPem

func DumpPem(bs []byte, types string, wrt *os.File) error

DumpPem dump a PEM version of the byte slice, bs, into writer, wrt.

func LoadProfileConfig

func LoadProfileConfig(ctx context.Context, ppconfigss string) (map[ProfileName]*ProfileConfig, error)

LoadProfileConfig configure PPROF profiling from the config in ppconfigss.

func StartProfileBuffers

func StartProfileBuffers(ctx context.Context)

StartProfileBuffers start profile buffers for enabled profiles/trace. Buffers are returned in an slice of buffers: CPU, Heap and trace respectively. class is used to distinguish profiles external to kopia.

func StopProfileBuffers

func StopProfileBuffers(ctx context.Context)

StopProfileBuffers stop and dump the contents of the buffers to the log as PEMs. Buffers supplied here are from StartProfileBuffers.

Types

type ProfileConfig

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

ProfileConfig configuration flags for a profile.

func (ProfileConfig) GetValue

func (p ProfileConfig) GetValue(s string) (string, bool)

GetValue get the value of the named flag, `s`. False will be returned if the flag does not exist. True will be returned if flag exists without a value.

type ProfileConfigs

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

ProfileConfigs configuration flags for all requested profiles.

type ProfileName

type ProfileName string

ProfileName the name of the profile (see: runtime/pprof/Lookup).

type Writer

type Writer interface {
	io.Writer
	io.StringWriter
}

Writer interface supports destination for PEM output.

Jump to

Keyboard shortcuts

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