Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AsyncTimeKeeper ¶
type AsyncTimeKeeper struct {
// contains filtered or unexported fields
}
AsyncTimeKeeper tracks concurrent operations because parallel timing is twice the fun
func NewAsyncTimeKeeper ¶
func NewAsyncTimeKeeper(name string) *AsyncTimeKeeper
NewAsyncTimeKeeper creates a new async timekeeper because concurrent timing needs special handling
func (*AsyncTimeKeeper) Track ¶
func (atk *AsyncTimeKeeper) Track(fn func())
Track adds a new operation to track because keeping track of parallel operations is like herding cats
func (*AsyncTimeKeeper) Wait ¶
func (atk *AsyncTimeKeeper) Wait() []time.Duration
Wait waits for all operations to complete because patience is still a virtue
type TimeKeeper ¶
type TimeKeeper struct {
// contains filtered or unexported fields
}
TimeKeeper tracks execution time because time is money, and we're all about that ROI
func NewTimeKeeper ¶
func NewTimeKeeper(name string, opts ...TimeKeeperOption) *TimeKeeper
NewTimeKeeper creates a new timekeeper because someone has to watch the clock
func (*TimeKeeper) Start ¶
func (tk *TimeKeeper) Start() *TimeKeeper
Start begins timing because every journey begins with a single step
func (*TimeKeeper) Stop ¶
func (tk *TimeKeeper) Stop() time.Duration
Stop ends timing and logs the duration because all good things must come to an end
type TimeKeeperOption ¶
type TimeKeeperOption func(*TimeKeeper)
func WithCallback ¶
func WithCallback(cb func(duration time.Duration)) TimeKeeperOption
WithCallback adds a callback function because sometimes you want to do more than just log