Skip to content

mikefero/hdrhistogram-php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hdrhistogram-php

A PHP extension wrapping the HdrHistogram C API.

License: New-BSD 2 Clause

Description

HdrHistogram: A High Dynamic Range Histogram.

A Histogram that supports recording and analyzing sampled data value counts across a configurable integer value range with configurable value precision within the range. Value precision is expressed as the number of significant digits in the value recording, and provides control over value quantization behavior across the value range and the subsequent value resolution at any given level.

Website/Documentation

API

The API is very similar to the C code:

<?php

$hdr = hdr_init(1, 3600000, 3);
hdr_record_value($hdr, 1337);
hdr_record_values($hdr, 42, 100);

printf(
    'Mean: %d Min: %d Max: %d Count(42): %d Perc(95): %d',
    hdr_mean($hdr),
    hdr_min($hdr),
    hdr_max($hdr),
    hdr_count_at_value($hdr, 42),
    hdr_value_at_percentile($hdr, 95)
);

$iter = hdr_iter_create($hdr);

while ($data = hdr_iter_next($iter)) {
    printf(
        'Value: %d-%d Count: %d, CountTo: %d',
        $data['value'],
        $data['highest_equivalent_value'],
        $data['count_at_index'],
        $data['count_to_index']
    );
}

TODO

  • Missing Iterators
    • LinearIterator
    • LogIterator
    • RecordedIterator
  • Serialization/Unserialization

About

A PHP extension wrapper for the C hdrhistogram API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 60.5%
  • PHP 39.5%