HDRHistogram 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6bc83dd9876e1ee8fce3a8aab6c3a19c3cdab9013362b2b0e478932709f0213
4
- data.tar.gz: 662746096a757ea07856c7d560b60c005d80a2a7fff4ffda8582dd791263ea09
3
+ metadata.gz: 4b2de8e94a6c083e066e95ca335f181ec355b65b6eb3a22ec0a326f9afcceeb2
4
+ data.tar.gz: d387cd8f4a484c9918bee4dbd0a1092643c668b47406ff105a82a9dadbcfdcbf
5
5
  SHA512:
6
- metadata.gz: 14b8a27b28b4fda00fbb1f9571c7d086477534b15ec5ac6037a53a7d99b290440252c814d701376b1d87a2f04f5195890e06f2570b39174b457d6c172392658f
7
- data.tar.gz: d870f490a37cc05d3fa49af17d98e879cb4b8415efbe3cfb3e373aace2079949f30c273dfd533731d00a178dc25a08befbb8d28bcd4d7ee4f1d538dc18233926
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
 
@@ -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 UnserializeError, "invalid serialization pattern" if m.nil?
105
+ raise HDRHistogramError, "invalid serialization pattern" if m.nil?
104
106
 
105
107
  opt[:unserialized]=m
106
108
 
@@ -1,3 +1,3 @@
1
1
  class HDRHistogram
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: HDRHistogram
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leo P.