profiler

package
v0.9.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: Apache-2.0 Imports: 11 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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