HDRHistogram 0.1.4 → 0.1.5
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/lib/HDRHistogram.rb +10 -2
- data/lib/HDRHistogram/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6bc83dd9876e1ee8fce3a8aab6c3a19c3cdab9013362b2b0e478932709f0213
|
4
|
+
data.tar.gz: 662746096a757ea07856c7d560b60c005d80a2a7fff4ffda8582dd791263ea09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14b8a27b28b4fda00fbb1f9571c7d086477534b15ec5ac6037a53a7d99b290440252c814d701376b1d87a2f04f5195890e06f2570b39174b457d6c172392658f
|
7
|
+
data.tar.gz: d870f490a37cc05d3fa49af17d98e879cb4b8415efbe3cfb3e373aace2079949f30c273dfd533731d00a178dc25a08befbb8d28bcd4d7ee4f1d538dc18233926
|
data/lib/HDRHistogram.rb
CHANGED
@@ -2,6 +2,8 @@ require "HDRHistogram/version"
|
|
2
2
|
require "ruby_hdr_histogram"
|
3
3
|
|
4
4
|
class HDRHistogram
|
5
|
+
class UnserializeError < StandardError
|
6
|
+
end
|
5
7
|
def initialize(lowest, highest, sig, opt={})
|
6
8
|
@multiplier = opt[:multiplier] || 1
|
7
9
|
@unit = opt[:unit] || opt[:units]
|
@@ -93,12 +95,18 @@ class HDRHistogram
|
|
93
95
|
end
|
94
96
|
private_class_method :adjusted_boundary_val
|
95
97
|
|
96
|
-
def self.unserialize(str)
|
98
|
+
def self.unserialize(str, opt={})
|
97
99
|
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\]/
|
98
100
|
|
99
101
|
m = str.match regex
|
100
102
|
|
101
|
-
|
103
|
+
raise UnserializeError, "invalid serialization pattern" if m.nil?
|
104
|
+
|
105
|
+
opt[:unserialized]=m
|
106
|
+
|
107
|
+
low = m[:lowest_trackable_value].to_i * (opt[:multiplier] || 1)
|
108
|
+
high = m[:highest_trackable_value].to_i * (opt[:multiplier] || 1)
|
109
|
+
hdrh = self.new(low, high, m[:significant_figures].to_i, opt)
|
102
110
|
|
103
111
|
return hdrh
|
104
112
|
end
|
data/lib/HDRHistogram/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.5
|
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-
|
11
|
+
date: 2018-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|