hdrhistogram
Version, currently 0.4.01 version
- 0.4.0latestMar 23, 2021
github.com/yxhuvud/hdrhistogram
Shard for recording samples to a specified precision, without any post-initialization allocation.
Installation
# Add this to your shard.yml
dependencies:
hdrhistogram:
github: yxhuvud/hdrhistogram
version: ~> 0.4.0Then run:
shards installshard.yml
- Crystal
>= 1.0.0- License
- ISC
- Author
- Linus Sellberg
Dependencies
This version declares no dependencies.
README
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
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.4.0- Tagged
- Mar 23, 2021
- Commit
7b170c857364- Crystal
>= 1.0.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/yxhuvud/hdrhistogram
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 1