valkey/deps/hdr_histogram
yoav-steinberg cb6933e346
Updated HDR histogram from upsteam after they merged our fix in #10606. (#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: https://github.com/HdrHistogram/HdrHistogram_c/pull/107.
2022-05-22 13:44:29 +03:00
..
COPYING.txt Extended redis-benchmark instant metrics and overall latency report (#7600) 2020-08-25 21:21:29 +03:00
hdr_atomic.h Extended redis-benchmark instant metrics and overall latency report (#7600) 2020-08-25 21:21:29 +03:00
hdr_histogram.c Updated HDR histogram from upsteam after they merged our fix in #10606. (#10755) 2022-05-22 13:44:29 +03:00
hdr_histogram.h Optimized hdr_value_at_percentile (#10606) 2022-04-20 09:38:20 +03:00
hdr_redis_malloc.h Optimized hdr_value_at_percentile (#10606) 2022-04-20 09:38:20 +03:00
hdr_tests.h Optimized hdr_value_at_percentile (#10606) 2022-04-20 09:38:20 +03:00
LICENSE.txt Extended redis-benchmark instant metrics and overall latency report (#7600) 2020-08-25 21:21:29 +03:00
Makefile Optimized hdr_value_at_percentile (#10606) 2022-04-20 09:38:20 +03:00
README.md Updated HDR histogram from upsteam after they merged our fix in #10606. (#10755) 2022-05-22 13:44:29 +03:00

HdrHistogram_c: 'C' port of High Dynamic Range (HDR) Histogram

HdrHistogram

Gitter chat

This port contains a subset of the functionality supported by the Java implementation. The current supported features are:

  • 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

#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 and hiccup examples. You can run hiccup and decoder and pipe the results of one into the other.

$ ./examples/hiccup | ./examples/hdr_decoder