HDRHistogram 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/HDRHistogram.rb +6 -4
- data/lib/HDRHistogram/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b2de8e94a6c083e066e95ca335f181ec355b65b6eb3a22ec0a326f9afcceeb2
|
4
|
+
data.tar.gz: d387cd8f4a484c9918bee4dbd0a1092643c668b47406ff105a82a9dadbcfdcbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c977ac22baee37229e542488f43ac383c993f208924debaa27798672af31a209a98bba14cd1270b02b65961f5f7df8fb1d7e2e827043802f9845bde17e251c3
|
7
|
+
data.tar.gz: a29bd66335546f115ccf0a02c373509551732e87af77a09802303891686bbf0c86a9eab723a0d23571a0f352b76699abf77cca2486228e14cfd5449356d5042d
|
data/README.md
CHANGED
@@ -108,6 +108,9 @@ Get the standard deviation for the values in the histogram.
|
|
108
108
|
#### `hdr.mean`
|
109
109
|
Get the mean (average) for the values in the histogram.
|
110
110
|
|
111
|
+
#### `hdr.merge!(other_hdr)`
|
112
|
+
Merge another HDRHistogram's data.
|
113
|
+
|
111
114
|
#### `hdr.reset`
|
112
115
|
Reset a histogram to zero - empty out a histogram and re-initialise it. If you want to re-use an existing histogram, but reset everything back to zero, this is the method to use.
|
113
116
|
|
data/lib/HDRHistogram.rb
CHANGED
@@ -2,8 +2,6 @@ require "HDRHistogram/version"
|
|
2
2
|
require "ruby_hdr_histogram"
|
3
3
|
|
4
4
|
class HDRHistogram
|
5
|
-
class UnserializeError < StandardError
|
6
|
-
end
|
7
5
|
def initialize(lowest, highest, sig, opt={})
|
8
6
|
@multiplier = opt[:multiplier] || 1
|
9
7
|
@unit = opt[:unit] || opt[:units]
|
@@ -61,7 +59,10 @@ class HDRHistogram
|
|
61
59
|
def percentile(pct)
|
62
60
|
raw_percentile(pct) * @multiplier
|
63
61
|
end
|
64
|
-
def merge(other)
|
62
|
+
def merge!(other)
|
63
|
+
if self == other
|
64
|
+
raise HDRHistogramError, "can't merge histogram with itself"
|
65
|
+
end
|
65
66
|
if other.multiplier != multiplier
|
66
67
|
raise HDRHistogramError, "can't merge histograms with different multipliers"
|
67
68
|
end
|
@@ -69,6 +70,7 @@ class HDRHistogram
|
|
69
70
|
raise HDRHistogramError, "can't merge histograms with different units"
|
70
71
|
end
|
71
72
|
raw_merge other
|
73
|
+
self
|
72
74
|
end
|
73
75
|
|
74
76
|
def to_s
|
@@ -100,7 +102,7 @@ class HDRHistogram
|
|
100
102
|
|
101
103
|
m = str.match regex
|
102
104
|
|
103
|
-
raise
|
105
|
+
raise HDRHistogramError, "invalid serialization pattern" if m.nil?
|
104
106
|
|
105
107
|
opt[:unserialized]=m
|
106
108
|
|
data/lib/HDRHistogram/version.rb
CHANGED