stopwatch

package
Version: v0.0.0-...-164d4eb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2014 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stopwatch

type Stopwatch struct {
	// contains filtered or unexported fields
}

Stopwatch is a simple timer that prints elapsed time to console or returns it as nanoseconds

func NewStopwatch

func NewStopwatch() *Stopwatch

NewStopwatchAndStart returns a new timer and starts it immediately.

func NewStopwatchWithAccuracy

func NewStopwatchWithAccuracy(accuracy time.Duration) *Stopwatch

NewStopwatchAndStart returns a new timer and starts it immediately.

func (*Stopwatch) Get

func (t *Stopwatch) Get() time.Duration

GetAndContinue calculates the elapsed time since last start and returns it as duration. The timer will continue.

func (*Stopwatch) GetAndRestart

func (t *Stopwatch) GetAndRestart() time.Duration

GetAndRestart calculates the elapsed time since last start and returns it as duration. The timer will restart.

func (*Stopwatch) GetPrecise

func (t *Stopwatch) GetPrecise() int

GetPrecise returns the elapsed time in nanoseconds. Compared to GetAndContinue it saves calculation time (in range of 10-30 nanoseconds)

func (*Stopwatch) GetPreciseAndRestart

func (t *Stopwatch) GetPreciseAndRestart() int

GetPreciseAndRestart returns the elapsed time in nanoseconds. Compared to GetandRestart it saves calculation time (in range of 10-30 nanoseconds)

func (*Stopwatch) Log

func (t *Stopwatch) Log(markerMessage string)

LogAndContinue logs the elapsed time since last start. The timer will continue.

func (*Stopwatch) LogAndRestart

func (t *Stopwatch) LogAndRestart(markerMessage string)

LogAndRestart logs the elapsed time since last start and restarts the timer

func (*Stopwatch) Restart

func (t *Stopwatch) Restart()

Start starts the timer, if it has already been started, the timer will restart

func (*Stopwatch) SetAccuracy

func (t *Stopwatch) SetAccuracy(accuracy time.Duration)

Sets the accuracy of the Log output

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL