[6a3a178] | 1 | /*
|
---|
| 2 | * This is a AssemblyScript port of the original Java version, which was written by
|
---|
| 3 | * Gil Tene as described in
|
---|
| 4 | * https://github.com/HdrHistogram/HdrHistogram
|
---|
| 5 | * and released to the public domain, as explained at
|
---|
| 6 | * http://creativecommons.org/publicdomain/zero/1.0/
|
---|
| 7 | */
|
---|
| 8 |
|
---|
| 9 | /**
|
---|
| 10 | * Represents a value point iterated through in a Histogram, with associated stats.
|
---|
| 11 | * <ul>
|
---|
| 12 | * <li><b><code>valueIteratedTo</code></b> :<br> The actual value level that was iterated to by the iterator</li>
|
---|
| 13 | * <li><b><code>prevValueIteratedTo</code></b> :<br> The actual value level that was iterated from by the iterator</li>
|
---|
| 14 | * <li><b><code>countAtValueIteratedTo</code></b> :<br> The count of recorded values in the histogram that
|
---|
| 15 | * exactly match this [lowestEquivalentValue(valueIteratedTo)...highestEquivalentValue(valueIteratedTo)] value
|
---|
| 16 | * range.</li>
|
---|
| 17 | * <li><b><code>countAddedInThisIterationStep</code></b> :<br> The count of recorded values in the histogram that
|
---|
| 18 | * were added to the totalCountToThisValue (below) as a result on this iteration step. Since multiple iteration
|
---|
| 19 | * steps may occur with overlapping equivalent value ranges, the count may be lower than the count found at
|
---|
| 20 | * the value (e.g. multiple linear steps or percentile levels can occur within a single equivalent value range)</li>
|
---|
| 21 | * <li><b><code>totalCountToThisValue</code></b> :<br> The total count of all recorded values in the histogram at
|
---|
| 22 | * values equal or smaller than valueIteratedTo.</li>
|
---|
| 23 | * <li><b><code>totalValueToThisValue</code></b> :<br> The sum of all recorded values in the histogram at values
|
---|
| 24 | * equal or smaller than valueIteratedTo.</li>
|
---|
| 25 | * <li><b><code>percentile</code></b> :<br> The percentile of recorded values in the histogram at values equal
|
---|
| 26 | * or smaller than valueIteratedTo.</li>
|
---|
| 27 | * <li><b><code>percentileLevelIteratedTo</code></b> :<br> The percentile level that the iterator returning this
|
---|
| 28 | * HistogramIterationValue had iterated to. Generally, percentileLevelIteratedTo will be equal to or smaller than
|
---|
| 29 | * percentile, but the same value point can contain multiple iteration levels for some iterators. E.g. a
|
---|
| 30 | * PercentileIterator can stop multiple times in the exact same value point (if the count at that value covers a
|
---|
| 31 | * range of multiple percentiles in the requested percentile iteration points).</li>
|
---|
| 32 | * </ul>
|
---|
| 33 | */
|
---|
| 34 | class HistogramIterationValue {
|
---|
| 35 | valueIteratedTo: u64;
|
---|
| 36 | valueIteratedFrom: u64;
|
---|
| 37 | countAtValueIteratedTo: u64;
|
---|
| 38 | countAddedInThisIterationStep: u64;
|
---|
| 39 | totalCountToThisValue: u64;
|
---|
| 40 | totalValueToThisValue: u64;
|
---|
| 41 | percentile: f64;
|
---|
| 42 | percentileLevelIteratedTo: f64;
|
---|
| 43 |
|
---|
| 44 | constructor() {
|
---|
| 45 | this.reset();
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | reset(): void {
|
---|
| 49 | this.valueIteratedTo = 0;
|
---|
| 50 | this.valueIteratedFrom = 0;
|
---|
| 51 | this.countAtValueIteratedTo = 0;
|
---|
| 52 | this.countAddedInThisIterationStep = 0;
|
---|
| 53 | this.totalCountToThisValue = 0;
|
---|
| 54 | this.totalValueToThisValue = 0;
|
---|
| 55 | this.percentile = 0.0;
|
---|
| 56 | this.percentileLevelIteratedTo = 0.0;
|
---|
| 57 | }
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | export default HistogramIterationValue;
|
---|