File: stopper.go

package info (click to toggle)
golang-github-facebookgo-stats 0.0~git20151006.0.1b76add-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 108 kB
  • sloc: makefile: 2
file content (17 lines) | stat: -rw-r--r-- 347 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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)
}