1HdrHistogram_c: 'C' port of High Dynamic Range (HDR) Histogram
2
3HdrHistogram
4----------------------------------------------
5[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/HdrHistogram/HdrHistogram?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
6
7Windows Build: ![AppVeyor](https://ci.appveyor.com/api/projects/status/github/HdrHistogram/HdrHistogram_c)
8Linux Build: [![Build Status](https://semaphoreci.com/api/v1/mikeb01/hdrhistogram_c/branches/master/badge.svg)](https://semaphoreci.com/mikeb01/hdrhistogram_c)
9
10This port contains a subset of the functionality supported by the Java
11implementation.  The current supported features are:
12
13* Standard histogram with 64 bit counts (32/16 bit counts not supported)
14* All iterator types (all values, recorded, percentiles, linear, logarithmic)
15* Histogram serialisation (encoding version 1.2, decoding 1.0-1.2)
16* Reader/writer phaser and interval recorder
17
18Features not supported, but planned
19
20* Auto-resizing of histograms
21
22Features unlikely to be implemented
23
24* Double histograms
25* Atomic/Concurrent histograms
26* 16/32 bit histograms
27
28# Simple Tutorial
29
30## Recording values
31
32```C
33#include <hdr_histogram.h>
34
35struct hdr_histogram* histogram;
36
37// Initialise the histogram
38hdr_init(
39    1,  // Minimum value
40    INT64_C(3600000000),  // Maximum value
41    3,  // Number of significant figures
42    &histogram)  // Pointer to initialise
43
44// Record value
45hdr_record_value(
46    histogram,  // Histogram to record to
47    value)  // Value to record
48
49// Record value n times
50hdr_record_values(
51    histogram,  // Histogram to record to
52    value,  // Value to record
53    10)  // Record value 10 times
54
55// Record value with correction for co-ordinated omission.
56hdr_record_corrected_value(
57    histogram,  // Histogram to record to
58    value,  // Value to record
59    1000)  // Record with expected interval of 1000.
60
61// Print out the values of the histogram
62hdr_percentiles_print(
63    histogram,
64    stdout,  // File to write to
65    5,  // Granularity of printed values
66    1.0,  // Multiplier for results
67    CLASSIC);  // Format CLASSIC/CSV supported.
68```
69
70## More examples
71
72For more detailed examples of recording and logging results look at the
73[hdr_decoder](examples/hdr_decoder.c)
74and [hiccup](examples/hiccup.c)
75examples.  You can run hiccup and decoder
76and pipe the results of one into the other.
77
78```
79$ ./examples/hiccup | ./examples/hdr_decoder
80```
81