aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/codahale/hdrhistogram/window.go
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2018-10-19 06:24:23 -0700
committerChristine Dodrill <me@christine.website>2018-10-19 06:28:37 -0700
commit273b48a8b409126e14f8beb23cee4255d1f08a2c (patch)
treefeb316d464d92e143732ca3eac525fe4ca3cda1d /vendor/github.com/codahale/hdrhistogram/window.go
parent456deb2bbadbcc8fd218a2297ac4879c069ef0ba (diff)
downloadx-273b48a8b409126e14f8beb23cee4255d1f08a2c.tar.xz
x-273b48a8b409126e14f8beb23cee4255d1f08a2c.zip
GOPROXY means we can avoid vendoring
Diffstat (limited to 'vendor/github.com/codahale/hdrhistogram/window.go')
-rw-r--r--vendor/github.com/codahale/hdrhistogram/window.go45
1 files changed, 0 insertions, 45 deletions
diff --git a/vendor/github.com/codahale/hdrhistogram/window.go b/vendor/github.com/codahale/hdrhistogram/window.go
deleted file mode 100644
index dc43612..0000000
--- a/vendor/github.com/codahale/hdrhistogram/window.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package hdrhistogram
-
-// A WindowedHistogram combines histograms to provide windowed statistics.
-type WindowedHistogram struct {
- idx int
- h []Histogram
- m *Histogram
-
- Current *Histogram
-}
-
-// NewWindowed creates a new WindowedHistogram with N underlying histograms with
-// the given parameters.
-func NewWindowed(n int, minValue, maxValue int64, sigfigs int) *WindowedHistogram {
- w := WindowedHistogram{
- idx: -1,
- h: make([]Histogram, n),
- m: New(minValue, maxValue, sigfigs),
- }
-
- for i := range w.h {
- w.h[i] = *New(minValue, maxValue, sigfigs)
- }
- w.Rotate()
-
- return &w
-}
-
-// Merge returns a histogram which includes the recorded values from all the
-// sections of the window.
-func (w *WindowedHistogram) Merge() *Histogram {
- w.m.Reset()
- for _, h := range w.h {
- w.m.Merge(&h)
- }
- return w.m
-}
-
-// Rotate resets the oldest histogram and rotates it to be used as the current
-// histogram.
-func (w *WindowedHistogram) Rotate() {
- w.idx++
- w.Current = &w.h[w.idx%len(w.h)]
- w.Current.Reset()
-}