profiler

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogProcessor

func LogProcessor(profiles []*TagsProfile) error

func NewProfiler

func NewProfiler(processor Processor, interval, window time.Duration) *profiler

func Tag

func Tag(ctx context.Context)

Tag current goroutine with tagged ctx it's used for reuse goroutine scenario

func Untag

func Untag(ctx context.Context)

Untag current goroutine with tagged ctx it's used for reuse goroutine scenario

Types

type Processor

type Processor func(profiles []*TagsProfile) error

type Profiler

type Profiler interface {
	Run(ctx context.Context) (err error)
	Stop()
	Pause()
	Resume()
	Prepare(ctx context.Context) context.Context
	Tag(ctx context.Context, tags ...string) context.Context
	Untag(ctx context.Context)
	Lookup(ctx context.Context, key string) (string, bool)
}

type TagsProfile

type TagsProfile struct {
	Key     string   // eg: a=1,b=2
	Tags    []string // eg: ["a", "1", "b", "2"]
	Value   int64    // pprof cpu times
	Percent float64  // <= 1.0
}

TagsProfile is the stats result group by tag key

Jump to

Keyboard shortcuts

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