Documentation
¶
Index ¶
- func Elapsed(name string) time.Duration
- func ElapsedAll() map[string]time.Duration
- func Measure(name string) time.Duration
- func MeasureAll() map[string]time.Duration
- func Pause(names ...string)
- func PauseAll()
- func Resume(names ...string)
- func Start(names ...string)
- type StopWatch
- func (s *StopWatch) Elapsed() time.Duration
- func (s *StopWatch) Pause()
- func (s *StopWatch) PauseAt(at time.Time)
- func (s *StopWatch) Restart()
- func (s *StopWatch) RestartAt(at time.Time)
- func (s *StopWatch) Start()
- func (s *StopWatch) StartAt(at time.Time)
- func (s *StopWatch) Stop()
- func (s *StopWatch) StopAt(at time.Time)
- type Timers
- func (t *Timers) Elapsed(name string) time.Duration
- func (t *Timers) ElapsedAll() map[string]time.Duration
- func (t *Timers) Measure(name string) time.Duration
- func (t *Timers) MeasureAll() map[string]time.Duration
- func (t *Timers) Message(name string) string
- func (t *Timers) Pause(names ...string)
- func (t *Timers) PauseAll()
- func (t *Timers) Resume(names ...string)
- func (t *Timers) Start(names ...string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ElapsedAll ¶ added in v1.1.0
ElapsedAll returns the elapsed time for all timers, and does not pause them.
Types ¶
type StopWatch ¶
type StopWatch struct {
// contains filtered or unexported fields
}
StopWatch measures the elapsed time.
func (*StopWatch) Pause ¶
func (s *StopWatch) Pause()
Pause adds the current elapsed time to `elapsed` and resets the `start` time.
func (*StopWatch) PauseAt ¶ added in v1.0.1
PauseAt adds the specified elapsed time to `elapsed` and resets the `start` time. Useful for testing.
func (*StopWatch) Restart ¶
func (s *StopWatch) Restart()
Restart restarts the stopwatch. It sets `start` time to the current time, and resets the `end` time and `elapsed` time.
func (*StopWatch) RestartAt ¶ added in v1.0.1
RestartAt restarts the stopwatch. It sets `start` time to the specified time, and resets the `end` time and `elapsed` time. Useful for testing.
func (*StopWatch) Start ¶
func (s *StopWatch) Start()
Start starts the stopwatch. It sets the `start` time to the current time.
func (*StopWatch) StartAt ¶ added in v1.0.1
StartAt starts the stopwatch. It sets the `start` time to the specified time. Useful for testing.
type Timers ¶
type Timers struct {
// contains filtered or unexported fields
}
Timers measures the elapsed time.
func (*Timers) Elapsed ¶ added in v1.1.0
Elapsed returns the elapsed time, and does not pause the timer.
func (*Timers) ElapsedAll ¶ added in v1.1.0
ElapsedAll returns the elapsed time for all timers, and does not pause them.
func (*Timers) MeasureAll ¶
MeasureAll measures the elapsed time for all timers, and pauses them.