You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
347 B

  1. package stats
  2. import "time"
  3. // Stopper calls Client.BumpSum and Client.BumpHistogram when End'ed
  4. type Stopper struct {
  5. Key string
  6. Start time.Time
  7. Client Client
  8. }
  9. // End the Stopper
  10. func (s *Stopper) End() {
  11. since := time.Since(s.Start).Seconds() * 1000.0
  12. s.Client.BumpSum(s.Key+".total", since)
  13. s.Client.BumpHistogram(s.Key, since)
  14. }