|
rpm-build |
2ca94e |
HdrHistogram_c: 'C' port of High Dynamic Range (HDR) Histogram
|
|
rpm-build |
2ca94e |
|
|
rpm-build |
2ca94e |
HdrHistogram
|
|
rpm-build |
2ca94e |
----------------------------------------------
|
|
rpm-build |
2ca94e |
|
|
rpm-build |
2ca94e |
[![Gitter chat](https://badges.gitter.im/HdrHistogram/HdrHistogram.png)](https://gitter.im/HdrHistogram/HdrHistogram)
|
|
rpm-build |
2ca94e |
|
|
rpm-build |
2ca94e |
Windows Build: [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/HdrHistogram/HdrHistogram_c?svg=true)](https://ci.appveyor.com/project/mikeb01/hdrhistogram-c)
|
|
rpm-build |
2ca94e |
|
|
rpm-build |
2ca94e |
Linux Build: [![Build Status](https://semaphoreci.com/api/v1/mikeb01/hdrhistogram_c/branches/master/badge.svg)](https://semaphoreci.com/mikeb01/hdrhistogram_c)
|
|
rpm-build |
2ca94e |
|
|
rpm-build |
2ca94e |
This port contains a subset of the functionality supported by the Java
|
|
rpm-build |
2ca94e |
implementation. The current supported features are:
|
|
rpm-build |
2ca94e |
|
|
rpm-build |
2ca94e |
* Standard histogram with 64 bit counts (32/16 bit counts not supported)
|
|
rpm-build |
2ca94e |
* All iterator types (all values, recorded, percentiles, linear, logarithmic)
|
|
rpm-build |
2ca94e |
* Histogram serialisation (encoding version 1.2, decoding 1.0-1.2)
|
|
rpm-build |
2ca94e |
* Reader/writer phaser and interval recorder
|
|
rpm-build |
2ca94e |
|
|
rpm-build |
2ca94e |
Features not supported, but planned
|
|
rpm-build |
2ca94e |
|
|
rpm-build |
2ca94e |
* Auto-resizing of histograms
|
|
rpm-build |
2ca94e |
|
|
rpm-build |
2ca94e |
Features unlikely to be implemented
|
|
rpm-build |
2ca94e |
|
|
rpm-build |
2ca94e |
* Double histograms
|
|
rpm-build |
2ca94e |
* Atomic/Concurrent histograms
|
|
rpm-build |
2ca94e |
* 16/32 bit histograms
|
|
rpm-build |
2ca94e |
|
|
rpm-build |
2ca94e |
# Simple Tutorial
|
|
rpm-build |
2ca94e |
|
|
rpm-build |
2ca94e |
## Recording values
|
|
rpm-build |
2ca94e |
|
|
rpm-build |
2ca94e |
```C
|
|
rpm-build |
2ca94e |
#include <hdr_histogram.h>
|
|
rpm-build |
2ca94e |
|
|
rpm-build |
2ca94e |
struct hdr_histogram* histogram;
|
|
rpm-build |
2ca94e |
|
|
rpm-build |
2ca94e |
// Initialise the histogram
|
|
rpm-build |
2ca94e |
hdr_init(
|
|
rpm-build |
2ca94e |
1, // Minimum value
|
|
rpm-build |
2ca94e |
INT64_C(3600000000), // Maximum value
|
|
rpm-build |
2ca94e |
3, // Number of significant figures
|
|
rpm-build |
2ca94e |
&histogram) // Pointer to initialise
|
|
rpm-build |
2ca94e |
|
|
rpm-build |
2ca94e |
// Record value
|
|
rpm-build |
2ca94e |
hdr_record_value(
|
|
rpm-build |
2ca94e |
histogram, // Histogram to record to
|
|
rpm-build |
2ca94e |
value) // Value to record
|
|
rpm-build |
2ca94e |
|
|
rpm-build |
2ca94e |
// Record value n times
|
|
rpm-build |
2ca94e |
hdr_record_values(
|
|
rpm-build |
2ca94e |
histogram, // Histogram to record to
|
|
rpm-build |
2ca94e |
value, // Value to record
|
|
rpm-build |
2ca94e |
10) // Record value 10 times
|
|
rpm-build |
2ca94e |
|
|
rpm-build |
2ca94e |
// Record value with correction for co-ordinated omission.
|
|
rpm-build |
2ca94e |
hdr_record_corrected_value(
|
|
rpm-build |
2ca94e |
histogram, // Histogram to record to
|
|
rpm-build |
2ca94e |
value, // Value to record
|
|
rpm-build |
2ca94e |
1000) // Record with expected interval of 1000.
|
|
rpm-build |
2ca94e |
|
|
rpm-build |
2ca94e |
// Print out the values of the histogram
|
|
rpm-build |
2ca94e |
hdr_percentiles_print(
|
|
rpm-build |
2ca94e |
histogram,
|
|
rpm-build |
2ca94e |
stdout, // File to write to
|
|
rpm-build |
2ca94e |
5, // Granularity of printed values
|
|
rpm-build |
2ca94e |
1.0, // Multiplier for results
|
|
rpm-build |
2ca94e |
CLASSIC); // Format CLASSIC/CSV supported.
|
|
rpm-build |
2ca94e |
```
|
|
rpm-build |
2ca94e |
|
|
rpm-build |
2ca94e |
## More examples
|
|
rpm-build |
2ca94e |
|
|
rpm-build |
2ca94e |
For more detailed examples of recording and logging results look at the
|
|
rpm-build |
2ca94e |
[hdr_decoder](examples/hdr_decoder.c)
|
|
rpm-build |
2ca94e |
and [hiccup](examples/hiccup.c)
|
|
rpm-build |
2ca94e |
examples. You can run hiccup and decoder
|
|
rpm-build |
2ca94e |
and pipe the results of one into the other.
|
|
rpm-build |
2ca94e |
|
|
rpm-build |
2ca94e |
```
|
|
rpm-build |
2ca94e |
$ ./examples/hiccup | ./examples/hdr_decoder
|
|
rpm-build |
2ca94e |
```
|