forked from Percona-Lab/redis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated HDR histogram from upsteam after they merged our fix in redis…
…#10606. (redis#10755) The code is based on upstream https://github.com/HdrHistogram/HdrHistogram_c master branch latest commit (e4448cf6d1cd08fff519812d3b1e58bd5a94ac42). The reason to pull this in now is that their final version of our optimization is even faster. See: HdrHistogram/HdrHistogram_c#107.
- Loading branch information
1 parent
18cb4a7
commit cb6933e
Showing
3 changed files
with
83 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,78 @@ | ||
HdrHistogram_c v0.11.5 | ||
HdrHistogram_c: 'C' port of High Dynamic Range (HDR) Histogram | ||
|
||
HdrHistogram | ||
---------------------------------------------- | ||
|
||
This port contains a subset of the 'C' version of High Dynamic Range (HDR) Histogram available at [github.com/HdrHistogram/HdrHistogram_c](https://github.com/HdrHistogram/HdrHistogram_c). | ||
[](https://gitter.im/HdrHistogram/HdrHistogram) | ||
|
||
This port contains a subset of the functionality supported by the Java | ||
implementation. The current supported features are: | ||
|
||
The code present on `hdr_histogram.c`, `hdr_histogram.h`, and `hdr_atomic.c` was Written by Gil Tene, Michael Barker, | ||
and Matt Warren, and released to the public domain, as explained at | ||
http://creativecommons.org/publicdomain/zero/1.0/. | ||
* Standard histogram with 64 bit counts (32/16 bit counts not supported) | ||
* All iterator types (all values, recorded, percentiles, linear, logarithmic) | ||
* Histogram serialisation (encoding version 1.2, decoding 1.0-1.2) | ||
* Reader/writer phaser and interval recorder | ||
|
||
Features not supported, but planned | ||
|
||
* Auto-resizing of histograms | ||
|
||
Features unlikely to be implemented | ||
|
||
* Double histograms | ||
* Atomic/Concurrent histograms | ||
* 16/32 bit histograms | ||
|
||
# Simple Tutorial | ||
|
||
## Recording values | ||
|
||
```C | ||
#include <hdr_histogram.h> | ||
|
||
struct hdr_histogram* histogram; | ||
|
||
// Initialise the histogram | ||
hdr_init( | ||
1, // Minimum value | ||
INT64_C(3600000000), // Maximum value | ||
3, // Number of significant figures | ||
&histogram) // Pointer to initialise | ||
|
||
// Record value | ||
hdr_record_value( | ||
histogram, // Histogram to record to | ||
value) // Value to record | ||
|
||
// Record value n times | ||
hdr_record_values( | ||
histogram, // Histogram to record to | ||
value, // Value to record | ||
10) // Record value 10 times | ||
|
||
// Record value with correction for co-ordinated omission. | ||
hdr_record_corrected_value( | ||
histogram, // Histogram to record to | ||
value, // Value to record | ||
1000) // Record with expected interval of 1000. | ||
|
||
// Print out the values of the histogram | ||
hdr_percentiles_print( | ||
histogram, | ||
stdout, // File to write to | ||
5, // Granularity of printed values | ||
1.0, // Multiplier for results | ||
CLASSIC); // Format CLASSIC/CSV supported. | ||
``` | ||
## More examples | ||
For more detailed examples of recording and logging results look at the | ||
[hdr_decoder](examples/hdr_decoder.c) | ||
and [hiccup](examples/hiccup.c) | ||
examples. You can run hiccup and decoder | ||
and pipe the results of one into the other. | ||
``` | ||
$ ./examples/hiccup | ./examples/hdr_decoder | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters