source: trip-planner-front/node_modules/hdr-histogram-js/dist/Recorder.d.ts@ 6a80231

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

initial commit

  • Property mode set to 100644
File size: 5.5 KB
Line 
1import Histogram from "./Histogram";
2import { BuildRequest } from "./HistogramBuilder";
3/**
4 * Records integer values, and provides stable interval {@link Histogram} samples from
5 * live recorded data without interrupting or stalling active recording of values. Each interval
6 * histogram provided contains all value counts accumulated since the previous interval histogram
7 * was taken.
8 * <p>
9 * This pattern is commonly used in logging interval histogram information while recording is ongoing.
10 * <p>
11 * {@link Recorder} supports concurrent
12 * {@link Recorder#recordValue} or
13 * {@link Recorder#recordValueWithExpectedInterval} calls.
14 *
15 */
16declare class Recorder {
17 private histogramBuildRequest;
18 private clock;
19 static idGenerator: number;
20 private activeHistogram;
21 private inactiveHistogram;
22 /**
23 * Construct an auto-resizing {@link Recorder} with a lowest discernible value of
24 * 1 and an auto-adjusting highestTrackableValue. Can auto-resize up to track values up to Number.MAX_SAFE_INTEGER.
25 *
26 * @param histogramBuildRequest parameters used to build histograms while using this recorder.
27 * @param clock (for testing purpose) an action that give current time in ms since 1970
28 */
29 constructor(histogramBuildRequest?: BuildRequest, clock?: () => number);
30 /**
31 * Record a value in the histogram
32 *
33 * @param value The value to be recorded
34 * @throws may throw Error if value is exceeds highestTrackableValue
35 */
36 recordValue(value: number): void;
37 /**
38 * Record a value in the histogram (adding to the value's current count)
39 *
40 * @param value The value to be recorded
41 * @param count The number of occurrences of this value to record
42 * @throws ArrayIndexOutOfBoundsException (may throw) if value is exceeds highestTrackableValue
43 */
44 recordValueWithCount(value: number, count: number): void;
45 /**
46 * Record a value
47 * <p>
48 * To compensate for the loss of sampled values when a recorded value is larger than the expected
49 * interval between value samples, Histogram will auto-generate an additional series of decreasingly-smaller
50 * (down to the expectedIntervalBetweenValueSamples) value records.
51 * <p>
52 * See related notes {@link Histogram#recordValueWithExpectedInterval(long, long)}
53 * for more explanations about coordinated omission and expected interval correction.
54 * *
55 * @param value The value to record
56 * @param expectedIntervalBetweenValueSamples If expectedIntervalBetweenValueSamples is larger than 0, add
57 * auto-generated value records as appropriate if value is larger
58 * than expectedIntervalBetweenValueSamples
59 * @throws ArrayIndexOutOfBoundsException (may throw) if value is exceeds highestTrackableValue
60 */
61 recordValueWithExpectedInterval(value: number, expectedIntervalBetweenValueSamples: number): void;
62 /**
63 * Get an interval histogram, which will include a stable, consistent view of all value counts
64 * accumulated since the last interval histogram was taken.
65 * <p>
66 * {@link Recorder#getIntervalHistogram(Histogram histogramToRecycle)
67 * getIntervalHistogram(histogramToRecycle)}
68 * accepts a previously returned interval histogram that can be recycled internally to avoid allocation
69 * and content copying operations, and is therefore significantly more efficient for repeated use than
70 * {@link Recorder#getIntervalHistogram()} and
71 * {@link Recorder#getIntervalHistogramInto getIntervalHistogramInto()}. The provided
72 * {@code histogramToRecycle} must
73 * be either be null or an interval histogram returned by a previous call to
74 * {@link Recorder#getIntervalHistogram(Histogram histogramToRecycle)
75 * getIntervalHistogram(histogramToRecycle)} or
76 * {@link Recorder#getIntervalHistogram()}.
77 * <p>
78 * NOTE: The caller is responsible for not recycling the same returned interval histogram more than once. If
79 * the same interval histogram instance is recycled more than once, behavior is undefined.
80 * <p>
81 * Calling {@link Recorder#getIntervalHistogram(Histogram histogramToRecycle)
82 * getIntervalHistogram(histogramToRecycle)} will reset the value counts, and start accumulating value
83 * counts for the next interval
84 *
85 * @param histogramToRecycle a previously returned interval histogram that may be recycled to avoid allocation and
86 * copy operations.
87 * @return a histogram containing the value counts accumulated since the last interval histogram was taken.
88 */
89 getIntervalHistogram(histogramToRecycle?: Histogram): Histogram;
90 /**
91 * Place a copy of the value counts accumulated since accumulated (since the last interval histogram
92 * was taken) into {@code targetHistogram}.
93 *
94 * Calling {@link Recorder#getIntervalHistogramInto getIntervalHistogramInto()} will reset
95 * the value counts, and start accumulating value counts for the next interval.
96 *
97 * @param targetHistogram the histogram into which the interval histogram's data should be copied
98 */
99 getIntervalHistogramInto(targetHistogram: Histogram): void;
100 /**
101 * Reset any value counts accumulated thus far.
102 */
103 reset(): void;
104 private performIntervalSample;
105 /**
106 * Release memory associated to this recorder by destroying
107 * histograms used under the cover.
108 * Useful when webassembly histograms are used.
109 */
110 destroy(): void;
111}
112export default Recorder;
Note: See TracBrowser for help on using the repository browser.