github.com/lyft/flytestdlib@v0.3.12-0.20210213045714-8cdd111ecda1/promutils/labeled/timer_wrapper.go (about)

     1  package labeled
     2  
     3  // Defines a common interface for timers.
     4  type Timer interface {
     5  	// Stops the timer and reports observation.
     6  	Stop() float64
     7  }
     8  
     9  type timer struct {
    10  	Timers []Timer
    11  }
    12  
    13  func (t timer) Stop() float64 {
    14  	var res float64
    15  	for _, timer := range t.Timers {
    16  		res = timer.Stop()
    17  	}
    18  
    19  	return res
    20  }