HDRHistogram 0.1.6 → 0.1.7

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: 4b2de8e94a6c083e066e95ca335f181ec355b65b6eb3a22ec0a326f9afcceeb2
4
- data.tar.gz: d387cd8f4a484c9918bee4dbd0a1092643c668b47406ff105a82a9dadbcfdcbf
3
+ metadata.gz: d475c4c4cbb66898aeff2e9dfdeccbaf9b8e7e000920332076a63b05191ccc6f
4
+ data.tar.gz: a409b91d6a9fe2dd87ed4e4e74f2f6425dbea2743901540bcd0908915b1861ac
5
5
  SHA512:
6
- metadata.gz: 8c977ac22baee37229e542488f43ac383c993f208924debaa27798672af31a209a98bba14cd1270b02b65961f5f7df8fb1d7e2e827043802f9845bde17e251c3
7
- data.tar.gz: a29bd66335546f115ccf0a02c373509551732e87af77a09802303891686bbf0c86a9eab723a0d23571a0f352b76699abf77cca2486228e14cfd5449356d5042d
6
+ metadata.gz: 4733bc0361f91f457b3fe462cac735296e9190a69f95cb8aab09ec864dec9e4da91e3935aae26f240397e7504bf3310da2e3f29d842dfb75c4c8a631efd39e4c
7
+ data.tar.gz: 4f1ec7b4af487e4a7034e1d552959dd3326757a9ac3760bb664779ec2ef73cc5284a644b241d43d76cb2bee47b4b48e33f70087cd9da020a640df086b0d39067
@@ -18,23 +18,30 @@ class HDRHistogram
18
18
  self.max_value= m[:max_value].to_i
19
19
  self.normalizing_index_offset= m[:normalizing_index_offset].to_i
20
20
  self.conversion_ratio= m[:conversion_ratio].to_f
21
- self.counts_len= m[:counts_len].to_i
21
+ counts_len = m[:counts_len].to_i
22
+ self.counts_len= counts_len
22
23
  self.total_count= m[:total_count].to_i
23
24
 
24
25
  counts = m[:counts].split " "
25
26
  i=0
27
+ shorted = 0
26
28
  counts.each do |count|
27
- m = count.match /^~(\d+)$/
28
- if m then #zerofill
29
- m[1].to_i.times do
30
- set_raw_count(i, 0)
31
- i=i+1
29
+ nf="~!@#$%^&*"
30
+ m = count.match /^([#{nf}])(\d+)$/
31
+ if m && nf.index(m[1])
32
+ shorted += 1
33
+ m[2].to_i.times do
34
+ set_raw_count(i, nf.index(m[1]))
35
+ i+=1
32
36
  end
33
37
  else
34
38
  set_raw_count(i, count.to_i)
35
- i=i+1
39
+ i+=1
36
40
  end
37
41
  end
42
+ if counts_len != i
43
+ raise HDRHistogramError, "invalid serialization pattern: total count doesn't match, expected: #{counts_len}, found #{i} (diff: #{counts_len - i}), counts.count: #{counts.count}, shorted: #{shorted}"
44
+ end
38
45
  end
39
46
  end
40
47
 
@@ -98,7 +105,7 @@ class HDRHistogram
98
105
  private_class_method :adjusted_boundary_val
99
106
 
100
107
  def self.unserialize(str, opt={})
101
- regex = /^(?<lowest_trackable_value>\d+) (?<highest_trackable_value>\d+) (?<unit_magnitude>\d+) (?<significant_figures>\d+) (?<sub_bucket_half_count_magnitude>\d+) (?<sub_bucket_half_count>\d+) (?<sub_bucket_mask>\d+) (?<sub_bucket_count>\d+) (?<bucket_count>\d+) (?<min_value>\d+) (?<max_value>\d+) (?<normalizing_index_offset>\d+) (?<conversion_ratio>\S+) (?<counts_len>\d+) (?<total_count>\d+) \[(?<counts>[\d~ ]+)\s\]/
108
+ regex = /^(?<lowest_trackable_value>\d+) (?<highest_trackable_value>\d+) (?<unit_magnitude>\d+) (?<significant_figures>\d+) (?<sub_bucket_half_count_magnitude>\d+) (?<sub_bucket_half_count>\d+) (?<sub_bucket_mask>\d+) (?<sub_bucket_count>\d+) (?<bucket_count>\d+) (?<min_value>\d+) (?<max_value>\d+) (?<normalizing_index_offset>\d+) (?<conversion_ratio>\S+) (?<counts_len>\d+) (?<total_count>\d+) \[(?<counts>([~!@#$%^&*]?\d+ )+)\]/
102
109
 
103
110
  m = str.match regex
104
111
 
@@ -1,3 +1,3 @@
1
1
  class HDRHistogram
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: HDRHistogram
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leo P.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-26 00:00:00.000000000 Z
11
+ date: 2018-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler