hdrhistogram
HDRHistogram
High Dynamic Range Histogram crystal implementation
A Histogram that supports recording and analyzing sampled data value counts across a configurable integer value range with configurable value precision within the range.
HdrHistogram is designed for recording histograms in latency and performance sensitive applications. The memory footprint is constant (depending only on precision), as is the work required to record a value.
Implementation heavily inspired HdrHistogram by Gil Tene and the different implementations that can be found on the project site. All errors are original content and not present in the original.
Supports:
- Recording values.
- Recording values with correction for coordinated omission.
- Get value at percentile.
- Get total count.
- Get min, max, mean and std deviation.
Installation
Add this to your application's shard.yml
:
dependencies:
hdrhistogram:
github: yxhuvud/hdrhistogram
Usage
First create a histogram with minimum, maximu and the amount of significant figures:
require "hdr_histogram"
histogram = HDRHistogram.new(1, 60 * 1000, 2)
Then it is possible to record values like:
histogram.record_value latency
It is also possible to record values with an expected known interval:
time_between_iteration = 100
histogram.record_corrected_value latency, time_between_iteration
It is possible to query a histogram for properties:
count = histogram.total_count
value = histogram.value_at_percentile(99.9)
It is possible to iterate over the values:
histogram.each_value do |i|
puts "value: #{i.value_from_index}, count: #{i.count_at_index}"
end
Performance
Fixme: Add benchmarks.
Contributing
- Fork it ( https://github.com/yxhuvud/hdrhistogram/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- yxhuvud Linus Sellberg - creator, maintainer
hdrhistogram
- 1
- 0
- 6
- 0
- 0
- almost 4 years ago
- June 6, 2016
ISC License
Sun, 22 Dec 2024 18:12:00 GMT