micro/profiler/profile.go

32 lines
569 B
Go
Raw Permalink Normal View History

// Package profiler is for profilers
package profiler
// Profiler interface
type Profiler interface {
// Start the profiler
Start() error
// Stop the profiler
Stop() error
2019-12-08 20:31:16 +00:00
// Name of the profiler
String() string
}
// DefaultProfiler holds the default profiler
var DefaultProfiler = NewProfiler()
// Options holds the options for profiler
type Options struct {
// Name to use for the profile
Name string
}
// Option func signature
type Option func(o *Options)
// Name of the profile
func Name(n string) Option {
return func(o *Options) {
o.Name = n
}
}