timer

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2018 License: MIT Imports: 3 Imported by: 5 modules, 7 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Log

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

Log struct is Timer interface implementation that writes all timings to log

func (*Log) Finish

func (t *Log) Finish(bucket string)

Finish writes elapsed time for metric to log

func (*Log) Start

func (t *Log) Start() Timer

Start starts timer

func (*Log) StartAt added in v0.6.3

func (t *Log) StartAt(s time.Time) Timer

StartAt starts timer at a given time

type Memory

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

Memory struct is Timer interface implementation that stores results in memory for further usage

func (*Memory) Elapsed

func (t *Memory) Elapsed() Metric

Elapsed returns elapsed duration

func (*Memory) Finish

func (t *Memory) Finish(bucket string)

Finish stores elapsed duration in memory

func (*Memory) Start

func (t *Memory) Start() Timer

Start starts timer

func (*Memory) StartAt added in v0.6.3

func (t *Memory) StartAt(s time.Time) Timer

StartAt starts timer at a given time

type Metric

type Metric struct {
	Bucket  string
	Elapsed time.Duration
}

Metric is a type for storing single duration metric

type StatsD added in v0.6.0

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

StatsD struct is Timer interface implementation that writes all timings to statsd

func NewStatsD added in v0.6.0

func NewStatsD(c *statsd.Client) *StatsD

NewStatsD creates new statsd timer instance

func (*StatsD) Finish added in v0.6.0

func (t *StatsD) Finish(bucket string)

Finish writes elapsed time for metric to statsd

func (*StatsD) Start added in v0.6.0

func (t *StatsD) Start() Timer

Start starts timer

func (*StatsD) StartAt added in v0.6.3

func (t *StatsD) StartAt(s time.Time) Timer

StartAt starts timer at a given time

type Timer

type Timer interface {
	// Start starts timer
	Start() Timer
	// StartAt starts timer at a given time
	StartAt(time.Time) Timer
	// Finish writes elapsed time for metric
	Finish(bucket string)
}

Timer is a metric time tracking interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL