Skip to content

b20n/bukkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bukkit: NIF-based histogram implementations

bukkit_hdr

bukkit_hdr is an implementation of Gil Tene's HdrHistogram library, based heavily on the C implementation by Michael Barker. The implemenation in this library is heavily simplified - it omits various features such as coordinated omission support and iterators - and structured for straightforward concurrent use from Erlang.

Usage is straightforward:

%% Create a new histogram.
%% Default extents are 1 - 2^63-1 with 5 significant figures.
%% Use bukkit_hdr:new/3 to supply custom extents.
{ok, Hdr} = bukkit_hdr:new().

%% Update the histogram.
lists:foreach(fun(I) -> bukkit_hdr:update(Hdr, I) end, lists:seq(1, 1000)).

%% Or update the histogram concurrently.
lists:foreach(fun(I) -> spawn(fun() -> bukkit_hdr:update(Hdr, I) end) end, lists:seq(1, 1000)).

%% Read statistics from the histogram.
bukkit_hdr:read(Hdr).

%% read/1 will also take a list of histograms and merge them at call time.
%% The dimensions (lowest, highest, sigfig) of all histograms passed to read/1 must be identical.
{ok, OtherHdr} = bukkit_hdr:new().
bukkit_hdr:read([Hdr, OtherHdr]).

bukkit_hdr does not implement any niceties such as a naming service or "sliding windows"; such features are up to the user to apply as they see fit.

See bukkit_hdr.erl for documentation on function signatures.

About

A package of Erlang NIFs for histogramming

Resources

License

Stars

Watchers

Forks

Packages

No packages published