Codebase list golang-github-facebookgo-stats / upstream/0.0_git20151006.2.1b76add stopper.go
upstream/0.0_git20151006.2.1b76add

Tree @upstream/0.0_git20151006.2.1b76add (Download .tar.gz)

stopper.go @upstream/0.0_git20151006.2.1b76addraw · history · blame

package stats

import "time"

// Stopper calls Client.BumpSum and Client.BumpHistogram when End'ed
type Stopper struct {
	Key    string
	Start  time.Time
	Client Client
}

// End the Stopper
func (s *Stopper) End() {
	since := time.Since(s.Start).Seconds() * 1000.0
	s.Client.BumpSum(s.Key+".total", since)
	s.Client.BumpHistogram(s.Key, since)
}