2021-02-14 16:16:01 +03:00
|
|
|
// Package profiler is for profilers
|
2021-10-02 19:55:07 +03:00
|
|
|
package profiler // import "go.unistack.org/micro/v3/profiler"
|
2019-11-06 19:36:04 +00:00
|
|
|
|
2021-02-14 16:16:01 +03:00
|
|
|
// Profiler interface
|
|
|
|
type Profiler interface {
|
2019-11-06 19:36:04 +00:00
|
|
|
// Start the profiler
|
|
|
|
Start() error
|
|
|
|
// Stop the profiler
|
|
|
|
Stop() error
|
2019-12-08 20:31:16 +00:00
|
|
|
// Name of the profiler
|
|
|
|
String() string
|
2019-11-06 19:36:04 +00:00
|
|
|
}
|
|
|
|
|
2021-04-27 08:32:47 +03:00
|
|
|
// DefaultProfiler holds the default profiler
|
|
|
|
var DefaultProfiler Profiler = NewProfiler()
|
2020-02-26 00:42:43 +08:00
|
|
|
|
2021-02-14 16:16:01 +03:00
|
|
|
// Options holds the options for profiler
|
2019-11-06 19:36:04 +00:00
|
|
|
type Options struct {
|
|
|
|
// Name to use for the profile
|
|
|
|
Name string
|
|
|
|
}
|
|
|
|
|
2021-02-14 16:16:01 +03:00
|
|
|
// Option func signature
|
2019-11-06 19:36:04 +00:00
|
|
|
type Option func(o *Options)
|
|
|
|
|
|
|
|
// Name of the profile
|
|
|
|
func Name(n string) Option {
|
|
|
|
return func(o *Options) {
|
|
|
|
o.Name = n
|
|
|
|
}
|
|
|
|
}
|