source: trip-planner-front/node_modules/hdr-histogram-js/dist/JsHistogram.d.ts@ fa375fe

Last change on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 16.4 KB
Line 
1import RecordedValuesIterator from "./RecordedValuesIterator";
2import PercentileIterator from "./PercentileIterator";
3import Histogram, { HistogramSummary } from "./Histogram";
4export declare abstract class JsHistogram implements Histogram {
5 static identityBuilder: number;
6 identity: number;
7 autoResize: boolean;
8 highestTrackableValue: number;
9 lowestDiscernibleValue: number;
10 numberOfSignificantValueDigits: number;
11 bucketCount: number;
12 /**
13 * Power-of-two length of linearly scaled array slots in the counts array. Long enough to hold the first sequence of
14 * entries that must be distinguished by a single unit (determined by configured precision).
15 */
16 subBucketCount: number;
17 countsArrayLength: number;
18 wordSizeInBytes: number;
19 startTimeStampMsec: number;
20 endTimeStampMsec: number;
21 tag: string;
22 percentileIterator: PercentileIterator;
23 recordedValuesIterator: RecordedValuesIterator;
24 /**
25 * Number of leading zeros in the largest value that can fit in bucket 0.
26 */
27 leadingZeroCountBase: number;
28 subBucketHalfCountMagnitude: number;
29 /**
30 * Largest k such that 2^k &lt;= lowestDiscernibleValue
31 */
32 unitMagnitude: number;
33 subBucketHalfCount: number;
34 lowestDiscernibleValueRounded: number;
35 /**
36 * Biggest value that can fit in bucket 0
37 */
38 subBucketMask: number;
39 /**
40 * Lowest unitMagnitude bits are set
41 */
42 unitMagnitudeMask: number;
43 maxValue: number;
44 minNonZeroValue: number;
45 _totalCount: number;
46 incrementTotalCount(): void;
47 addToTotalCount(value: number): void;
48 setTotalCount(value: number): void;
49 /**
50 * Get the total count of all recorded values in the histogram
51 * @return the total count of all recorded values in the histogram
52 */
53 get totalCount(): number;
54 abstract getCountAtIndex(index: number): number;
55 abstract incrementCountAtIndex(index: number): void;
56 abstract addToCountAtIndex(index: number, value: number): void;
57 abstract setCountAtIndex(index: number, value: number): void;
58 abstract clearCounts(): void;
59 protected abstract _getEstimatedFootprintInBytes(): number;
60 abstract resize(newHighestTrackableValue: number): void;
61 private updatedMaxValue;
62 private updateMinNonZeroValue;
63 constructor(lowestDiscernibleValue: number, highestTrackableValue: number, numberOfSignificantValueDigits: number);
64 init(lowestDiscernibleValue: number, highestTrackableValue: number, numberOfSignificantValueDigits: number): void;
65 /**
66 * The buckets (each of which has subBucketCount sub-buckets, here assumed to be 2048 as an example) overlap:
67 *
68 * <pre>
69 * The 0'th bucket covers from 0...2047 in multiples of 1, using all 2048 sub-buckets
70 * The 1'th bucket covers from 2048..4097 in multiples of 2, using only the top 1024 sub-buckets
71 * The 2'th bucket covers from 4096..8191 in multiple of 4, using only the top 1024 sub-buckets
72 * ...
73 * </pre>
74 *
75 * Bucket 0 is "special" here. It is the only one that has 2048 entries. All the rest have 1024 entries (because
76 * their bottom half overlaps with and is already covered by the all of the previous buckets put together). In other
77 * words, the k'th bucket could represent 0 * 2^k to 2048 * 2^k in 2048 buckets with 2^k precision, but the midpoint
78 * of 1024 * 2^k = 2048 * 2^(k-1) = the k-1'th bucket's end, so we would use the previous bucket for those lower
79 * values as it has better precision.
80 */
81 establishSize(newHighestTrackableValue: number): void;
82 determineArrayLengthNeeded(highestTrackableValue: number): number;
83 /**
84 * If we have N such that subBucketCount * 2^N > max value, we need storage for N+1 buckets, each with enough
85 * slots to hold the top half of the subBucketCount (the lower half is covered by previous buckets), and the +1
86 * being used for the lower half of the 0'th bucket. Or, equivalently, we need 1 more bucket to capture the max
87 * value if we consider the sub-bucket length to be halved.
88 */
89 getLengthForNumberOfBuckets(numberOfBuckets: number): number;
90 getBucketsNeededToCoverValue(value: number): number;
91 /**
92 * Record a value in the histogram
93 *
94 * @param value The value to be recorded
95 * @throws may throw Error if value is exceeds highestTrackableValue
96 */
97 recordValue(value: number): void;
98 recordSingleValue(value: number): void;
99 handleRecordException(count: number, value: number): void;
100 countsArrayIndex(value: number): number;
101 private computeCountsArrayIndex;
102 /**
103 * @return the lowest (and therefore highest precision) bucket index that can represent the value
104 */
105 getBucketIndex(value: number): number;
106 getSubBucketIndex(value: number, bucketIndex: number): number;
107 updateMinAndMax(value: number): void;
108 /**
109 * Get the value at a given percentile.
110 * When the given percentile is &gt; 0.0, the value returned is the value that the given
111 * percentage of the overall recorded value entries in the histogram are either smaller than
112 * or equivalent to. When the given percentile is 0.0, the value returned is the value that all value
113 * entries in the histogram are either larger than or equivalent to.
114 * <p>
115 * Note that two values are "equivalent" in this statement if
116 * {@link org.HdrHistogram.JsHistogram#valuesAreEquivalent} would return true.
117 *
118 * @param percentile The percentile for which to return the associated value
119 * @return The value that the given percentage of the overall recorded value entries in the
120 * histogram are either smaller than or equivalent to. When the percentile is 0.0, returns the
121 * value that all value entries in the histogram are either larger than or equivalent to.
122 */
123 getValueAtPercentile(percentile: number): number;
124 valueFromIndexes(bucketIndex: number, subBucketIndex: number): number;
125 valueFromIndex(index: number): number;
126 /**
127 * Get the lowest value that is equivalent to the given value within the histogram's resolution.
128 * Where "equivalent" means that value samples recorded for any two
129 * equivalent values are counted in a common total count.
130 *
131 * @param value The given value
132 * @return The lowest value that is equivalent to the given value within the histogram's resolution.
133 */
134 lowestEquivalentValue(value: number): number;
135 /**
136 * Get the highest value that is equivalent to the given value within the histogram's resolution.
137 * Where "equivalent" means that value samples recorded for any two
138 * equivalent values are counted in a common total count.
139 *
140 * @param value The given value
141 * @return The highest value that is equivalent to the given value within the histogram's resolution.
142 */
143 highestEquivalentValue(value: number): number;
144 /**
145 * Get the next value that is not equivalent to the given value within the histogram's resolution.
146 * Where "equivalent" means that value samples recorded for any two
147 * equivalent values are counted in a common total count.
148 *
149 * @param value The given value
150 * @return The next value that is not equivalent to the given value within the histogram's resolution.
151 */
152 nextNonEquivalentValue(value: number): number;
153 /**
154 * Get the size (in value units) of the range of values that are equivalent to the given value within the
155 * histogram's resolution. Where "equivalent" means that value samples recorded for any two
156 * equivalent values are counted in a common total count.
157 *
158 * @param value The given value
159 * @return The size of the range of values equivalent to the given value.
160 */
161 sizeOfEquivalentValueRange(value: number): number;
162 /**
163 * Get a value that lies in the middle (rounded up) of the range of values equivalent the given value.
164 * Where "equivalent" means that value samples recorded for any two
165 * equivalent values are counted in a common total count.
166 *
167 * @param value The given value
168 * @return The value lies in the middle (rounded up) of the range of values equivalent the given value.
169 */
170 medianEquivalentValue(value: number): number;
171 /**
172 * Get the computed mean value of all recorded values in the histogram
173 *
174 * @return the mean value (in value units) of the histogram data
175 */
176 get mean(): number;
177 private getStdDeviation;
178 /**
179 * Get the computed standard deviation of all recorded values in the histogram
180 *
181 * @return the standard deviation (in value units) of the histogram data
182 */
183 get stdDeviation(): number;
184 /**
185 * Produce textual representation of the value distribution of histogram data by percentile. The distribution is
186 * output with exponentially increasing resolution, with each exponentially decreasing half-distance containing
187 * <i>dumpTicksPerHalf</i> percentile reporting tick points.
188 *
189 * @param printStream Stream into which the distribution will be output
190 * <p>
191 * @param percentileTicksPerHalfDistance The number of reporting points per exponentially decreasing half-distance
192 * <p>
193 * @param outputValueUnitScalingRatio The scaling factor by which to divide histogram recorded values units in
194 * output
195 * @param useCsvFormat Output in CSV format if true. Otherwise use plain text form.
196 */
197 outputPercentileDistribution(percentileTicksPerHalfDistance?: number, outputValueUnitScalingRatio?: number, useCsvFormat?: boolean): string;
198 get summary(): HistogramSummary;
199 toJSON(): HistogramSummary;
200 inspect(): string;
201 /**
202 * Provide a (conservatively high) estimate of the Histogram's total footprint in bytes
203 *
204 * @return a (conservatively high) estimate of the Histogram's total footprint in bytes
205 */
206 get estimatedFootprintInBytes(): number;
207 recordSingleValueWithExpectedInterval(value: number, expectedIntervalBetweenValueSamples: number): void;
208 private recordCountAtValue;
209 /**
210 * Record a value in the histogram (adding to the value's current count)
211 *
212 * @param value The value to be recorded
213 * @param count The number of occurrences of this value to record
214 * @throws ArrayIndexOutOfBoundsException (may throw) if value is exceeds highestTrackableValue
215 */
216 recordValueWithCount(value: number, count: number): void;
217 /**
218 * Record a value in the histogram.
219 * <p>
220 * To compensate for the loss of sampled values when a recorded value is larger than the expected
221 * interval between value samples, Histogram will auto-generate an additional series of decreasingly-smaller
222 * (down to the expectedIntervalBetweenValueSamples) value records.
223 * <p>
224 * Note: This is a at-recording correction method, as opposed to the post-recording correction method provided
225 * by {@link #copyCorrectedForCoordinatedOmission(long)}.
226 * The two methods are mutually exclusive, and only one of the two should be be used on a given data set to correct
227 * for the same coordinated omission issue.
228 * <p>
229 * See notes in the description of the Histogram calls for an illustration of why this corrective behavior is
230 * important.
231 *
232 * @param value The value to record
233 * @param expectedIntervalBetweenValueSamples If expectedIntervalBetweenValueSamples is larger than 0, add
234 * auto-generated value records as appropriate if value is larger
235 * than expectedIntervalBetweenValueSamples
236 * @throws ArrayIndexOutOfBoundsException (may throw) if value is exceeds highestTrackableValue
237 */
238 recordValueWithExpectedInterval(value: number, expectedIntervalBetweenValueSamples: number): void;
239 private recordValueWithCountAndExpectedInterval;
240 /**
241 * Add the contents of another histogram to this one, while correcting the incoming data for coordinated omission.
242 * <p>
243 * To compensate for the loss of sampled values when a recorded value is larger than the expected
244 * interval between value samples, the values added will include an auto-generated additional series of
245 * decreasingly-smaller (down to the expectedIntervalBetweenValueSamples) value records for each count found
246 * in the current histogram that is larger than the expectedIntervalBetweenValueSamples.
247 *
248 * Note: This is a post-recording correction method, as opposed to the at-recording correction method provided
249 * by {@link #recordValueWithExpectedInterval(long, long) recordValueWithExpectedInterval}. The two
250 * methods are mutually exclusive, and only one of the two should be be used on a given data set to correct
251 * for the same coordinated omission issue.
252 * by
253 * <p>
254 * See notes in the description of the Histogram calls for an illustration of why this corrective behavior is
255 * important.
256 *
257 * @param otherHistogram The other histogram. highestTrackableValue and largestValueWithSingleUnitResolution must match.
258 * @param expectedIntervalBetweenValueSamples If expectedIntervalBetweenValueSamples is larger than 0, add
259 * auto-generated value records as appropriate if value is larger
260 * than expectedIntervalBetweenValueSamples
261 * @throws ArrayIndexOutOfBoundsException (may throw) if values exceed highestTrackableValue
262 */
263 addWhileCorrectingForCoordinatedOmission(otherHistogram: JsHistogram, expectedIntervalBetweenValueSamples: number): void;
264 /**
265 * Get a copy of this histogram, corrected for coordinated omission.
266 * <p>
267 * To compensate for the loss of sampled values when a recorded value is larger than the expected
268 * interval between value samples, the new histogram will include an auto-generated additional series of
269 * decreasingly-smaller (down to the expectedIntervalBetweenValueSamples) value records for each count found
270 * in the current histogram that is larger than the expectedIntervalBetweenValueSamples.
271 *
272 * Note: This is a post-correction method, as opposed to the at-recording correction method provided
273 * by {@link #recordValueWithExpectedInterval(long, long) recordValueWithExpectedInterval}. The two
274 * methods are mutually exclusive, and only one of the two should be be used on a given data set to correct
275 * for the same coordinated omission issue.
276 * by
277 * <p>
278 * See notes in the description of the Histogram calls for an illustration of why this corrective behavior is
279 * important.
280 *
281 * @param expectedIntervalBetweenValueSamples If expectedIntervalBetweenValueSamples is larger than 0, add
282 * auto-generated value records as appropriate if value is larger
283 * than expectedIntervalBetweenValueSamples
284 * @return a copy of this histogram, corrected for coordinated omission.
285 */
286 abstract copyCorrectedForCoordinatedOmission(expectedIntervalBetweenValueSamples: number): JsHistogram;
287 /**
288 * Add the contents of another histogram to this one.
289 * <p>
290 * As part of adding the contents, the start/end timestamp range of this histogram will be
291 * extended to include the start/end timestamp range of the other histogram.
292 *
293 * @param otherHistogram The other histogram.
294 * @throws (may throw) if values in fromHistogram's are
295 * higher than highestTrackableValue.
296 */
297 add(otherHistogram: JsHistogram): void;
298 /**
299 * Get the count of recorded values at a specific value (to within the histogram resolution at the value level).
300 *
301 * @param value The value for which to provide the recorded count
302 * @return The total count of values recorded in the histogram within the value range that is
303 * {@literal >=} lowestEquivalentValue(<i>value</i>) and {@literal <=} highestEquivalentValue(<i>value</i>)
304 */
305 private getCountAtValue;
306 /**
307 * Subtract the contents of another histogram from this one.
308 * <p>
309 * The start/end timestamps of this histogram will remain unchanged.
310 *
311 * @param otherHistogram The other histogram.
312 * @throws ArrayIndexOutOfBoundsException (may throw) if values in otherHistogram's are higher than highestTrackableValue.
313 *
314 */
315 subtract(otherHistogram: JsHistogram): void;
316 establishInternalTackingValues(lengthToCover?: number): void;
317 reset(): void;
318 destroy(): void;
319}
320export { JsHistogram as default };
Note: See TracBrowser for help on using the repository browser.