-
Notifications
You must be signed in to change notification settings - Fork 44
Description
I am trying to create hgrm text output. For this I am using this function: https://gist.github.com/algermissen/9f86fe6051a5e4f89ef92d8f5cfd9637 which aims to be a port of https://github.com/HdrHistogram/HdrHistogram_py/blob/5b9b94a1827a88c4782100dff52dfc7e2578ee87/hdrh/histogram.py#L576
The histogram is created in Rust code with let hist = Histogram::<u32>::new_with_bounds(1, 60 * 60 * 1000, 2), exported as V2+DEFLATE and turned to base64.
The hgrm outputs below are 1. Generated from the Rust histogram using the function in the gist and 2. created by pasting the base64 into https://hdrhistogram.github.io/HdrHistogramJSDemo/decoding-demo.html
What strikes me as odd (besides that they are not the same) is that the Rust version seems to be 'one-off' in some sense. It is as if the last iteration should not be there (the percentile 1.0 appears twice. In the gist I check if v.quantile() < 1.0 and the iteration value seems to indeed return 1.0 twice.
951.00 1.000000000000 10
951.00 1.000000000000 10
Is this an indicator of a bug or am I doing something very wrong here?
I also wonder why there is not better precision for the percentile column shown in the Rust output - is this my formatting or some unwanted rounding going on (note: I am still new to Rust, so might entirely be me, being simply stupid)
Rust-direct-output with Gist-Function:
Value Percentile TotalCount 1/(1-Percentile)
79.00 0.100000000000 1 1.11
79.00 0.100000000000 1 1.11
85.00 0.300000000000 3 1.43
89.00 0.400000000000 4 1.67
89.00 0.400000000000 4 1.67
98.00 0.500000000000 5 2.00
115.00 0.600000000000 6 2.50
133.00 0.700000000000 7 3.33
133.00 0.700000000000 7 3.33
212.00 0.800000000000 8 5.00
212.00 0.800000000000 8 5.00
212.00 0.800000000000 8 5.00
373.00 0.900000000000 9 10.00
373.00 0.900000000000 9 10.00
373.00 0.900000000000 9 10.00
373.00 0.900000000000 9 10.00
373.00 0.900000000000 9 10.00
951.00 1.000000000000 10
951.00 1.000000000000 10
#[Mean = 221.90, StdDeviation = 257.55]
#[Max = 951, TotalCount = 10]
#[Buckets = 15, SubBuckets = 2048]
Converted from base64 using JS-demo page:
Value Percentile TotalCount 1/(1-Percentile)
79.00 0.000000000000 1 1.00
79.00 0.100000000000 1 1.11
85.00 0.200000000000 3 1.25
85.00 0.300000000000 3 1.43
89.00 0.400000000000 4 1.67
98.00 0.500000000000 5 2.00
115.00 0.550000000000 6 2.22
115.00 0.600000000000 6 2.50
133.00 0.650000000000 7 2.86
133.00 0.700000000000 7 3.33
212.00 0.750000000000 8 4.00
212.00 0.775000000000 8 4.44
212.00 0.800000000000 8 5.00
373.00 0.825000000000 9 5.71
373.00 0.850000000000 9 6.67
373.00 0.875000000000 9 8.00
373.00 0.887500000000 9 8.89
373.00 0.900000000000 9 10.00
951.00 0.912500000000 10 11.43
951.00 1.000000000000 10
#[Mean = 221.90, StdDeviation = 257.55]
#[Max = 951.00, Total count = 10]
#[Buckets = 15, SubBuckets = 256]