vendor: Update everything
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4620
This commit is contained in:
18
vendor/github.com/rcrowley/go-metrics/timer.go
generated
vendored
18
vendor/github.com/rcrowley/go-metrics/timer.go
generated
vendored
@@ -19,6 +19,7 @@ type Timer interface {
|
||||
RateMean() float64
|
||||
Snapshot() Timer
|
||||
StdDev() float64
|
||||
Stop()
|
||||
Sum() int64
|
||||
Time(func())
|
||||
Update(time.Duration)
|
||||
@@ -28,6 +29,8 @@ type Timer interface {
|
||||
|
||||
// GetOrRegisterTimer returns an existing Timer or constructs and registers a
|
||||
// new StandardTimer.
|
||||
// Be sure to unregister the meter from the registry once it is of no use to
|
||||
// allow for garbage collection.
|
||||
func GetOrRegisterTimer(name string, r Registry) Timer {
|
||||
if nil == r {
|
||||
r = DefaultRegistry
|
||||
@@ -36,6 +39,7 @@ func GetOrRegisterTimer(name string, r Registry) Timer {
|
||||
}
|
||||
|
||||
// NewCustomTimer constructs a new StandardTimer from a Histogram and a Meter.
|
||||
// Be sure to call Stop() once the timer is of no use to allow for garbage collection.
|
||||
func NewCustomTimer(h Histogram, m Meter) Timer {
|
||||
if UseNilMetrics {
|
||||
return NilTimer{}
|
||||
@@ -47,6 +51,8 @@ func NewCustomTimer(h Histogram, m Meter) Timer {
|
||||
}
|
||||
|
||||
// NewRegisteredTimer constructs and registers a new StandardTimer.
|
||||
// Be sure to unregister the meter from the registry once it is of no use to
|
||||
// allow for garbage collection.
|
||||
func NewRegisteredTimer(name string, r Registry) Timer {
|
||||
c := NewTimer()
|
||||
if nil == r {
|
||||
@@ -58,6 +64,7 @@ func NewRegisteredTimer(name string, r Registry) Timer {
|
||||
|
||||
// NewTimer constructs a new StandardTimer using an exponentially-decaying
|
||||
// sample with the same reservoir size and alpha as UNIX load averages.
|
||||
// Be sure to call Stop() once the timer is of no use to allow for garbage collection.
|
||||
func NewTimer() Timer {
|
||||
if UseNilMetrics {
|
||||
return NilTimer{}
|
||||
@@ -112,6 +119,9 @@ func (NilTimer) Snapshot() Timer { return NilTimer{} }
|
||||
// StdDev is a no-op.
|
||||
func (NilTimer) StdDev() float64 { return 0.0 }
|
||||
|
||||
// Stop is a no-op.
|
||||
func (NilTimer) Stop() {}
|
||||
|
||||
// Sum is a no-op.
|
||||
func (NilTimer) Sum() int64 { return 0 }
|
||||
|
||||
@@ -201,6 +211,11 @@ func (t *StandardTimer) StdDev() float64 {
|
||||
return t.histogram.StdDev()
|
||||
}
|
||||
|
||||
// Stop stops the meter.
|
||||
func (t *StandardTimer) Stop() {
|
||||
t.meter.Stop()
|
||||
}
|
||||
|
||||
// Sum returns the sum in the sample.
|
||||
func (t *StandardTimer) Sum() int64 {
|
||||
return t.histogram.Sum()
|
||||
@@ -288,6 +303,9 @@ func (t *TimerSnapshot) Snapshot() Timer { return t }
|
||||
// was taken.
|
||||
func (t *TimerSnapshot) StdDev() float64 { return t.histogram.StdDev() }
|
||||
|
||||
// Stop is a no-op.
|
||||
func (t *TimerSnapshot) Stop() {}
|
||||
|
||||
// Sum returns the sum at the time the snapshot was taken.
|
||||
func (t *TimerSnapshot) Sum() int64 { return t.histogram.Sum() }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user