Documentation ¶
Index ¶
- type Data
- type Entry
- type LP
- type Option
- func WithDelay(delay time.Duration) Option
- func WithEnabled(enabled bool) Option
- func WithEnabledFunc(enabledFunc func() bool) Option
- func WithErrorHandler(errHandler func(err error)) Option
- func WithFilter(filter string) Option
- func WithJitter(jitter float64) Option
- func WithLimit(limit int) Option
- type Profiler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Data ¶
type Data struct { // Timestamp when the data was generated. Timestamp time.Time // Entries, sorted by order of importance, greater numbers at the beginning. Entries []Entry }
Data passed in channels.
type Entry ¶
type Entry struct { // Key is the aggregation key for data, basically a location in the code. Key objfile.Location // Value is the measured value (bytes, CPU cycles...) Value float64 }
Entry is used to store data results.
type LP ¶
type LP struct {
// contains filtered or unexported fields
}
LP is an implementation of a live profiler.
type Option ¶
type Option func(o *opts) error
Option passed when creating the live profiler.
func WithEnabled ¶
WithEnabled allows you to enable/disable the profiler. If enabled is false, no profiling fill be done, even if the profiler is started.
func WithEnabledFunc ¶
WithEnabledFunc allows you to enable/disable the profiler with a callback. This is useful if you want to enable/disable it on-the-fly without explicitly stopping or starting it. One use-case is if you have a dynamic configuration. This will actually poll the dynamic configuration, and enable/disable it. Typically interesting if you are concerned with the CPU the profiling is consuming, and/or if you want to get rid of any side effect.
func WithErrorHandler ¶
WithErrorHandler allows custom handling of errors. This is useful as live profiler does thing in the background, the instanciation and start can not return all possible errors, so they need to be handled later, in a separate goroutine, as they happen.
func WithFilter ¶
WithFilter helps you spot where time is spent within your code by reporting functions which are in packages containing a given filter in their name. Typically if you are coding something in github.com/thisisme/supergolib/package1 you might want to give this "supergolib/package1" as you want functions in that part of the code to be reported. Not doing this, you might not have insightful reports as you may get a lot of entries about small "leaf" part of the code. If you do this the live profiler will aggregate all data until it finds a common parent in "supergolib/package1".
func WithJitter ¶
WithJitter allows a custom jitter to be used on top of delay. Default is 0.1. Which means value can be 5% lower or 5% higher than specified. Jitter needs to be within 0 (no jitter at all) and 1 (from 50% to 150% of the value).
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
internal
|
|
google/binutils
Package binutils provides access to the GNU binutils.
|
Package binutils provides access to the GNU binutils. |
google/elfexec
Package elfexec provides utility routines to examine ELF binaries.
|
Package elfexec provides utility routines to examine ELF binaries. |
google/plugin
Package plugin defines the plugin implementations that the main pprof driver requires.
|
Package plugin defines the plugin implementations that the main pprof driver requires. |