PackedHistogram.d.ts 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import JsHistogram from "./JsHistogram";
  2. import { PackedArray } from "./packedarray/PackedArray";
  3. /**
  4. * <h3>A High Dynamic Range (HDR) Histogram that uses a packed internal representation</h3>
  5. * <p>
  6. * {@link PackedHistogram} supports the recording and analyzing sampled data value counts across a configurable
  7. * integer value range with configurable value precision within the range. Value precision is expressed as the
  8. * number of significant digits in the value recording, and provides control over value quantization behavior
  9. * across the value range and the subsequent value resolution at any given level.
  10. * <p>
  11. * {@link PackedHistogram} tracks value counts in a packed internal representation optimized
  12. * for typical histogram recoded values are sparse in the value range and tend to be incremented in small unit counts.
  13. * This packed representation tends to require significantly smaller amounts of stoarge when compared to unpacked
  14. * representations, but can incur additional recording cost due to resizing and repacking operations that may
  15. * occur as previously unrecorded values are encountered.
  16. * <p>
  17. * For example, a {@link PackedHistogram} could be configured to track the counts of observed integer values between 0 and
  18. * 3,600,000,000,000 while maintaining a value precision of 3 significant digits across that range. Value quantization
  19. * within the range will thus be no larger than 1/1,000th (or 0.1%) of any value. This example Histogram could
  20. * be used to track and analyze the counts of observed response times ranging between 1 nanosecond and 1 hour
  21. * in magnitude, while maintaining a value resolution of 1 microsecond up to 1 millisecond, a resolution of
  22. * 1 millisecond (or better) up to one second, and a resolution of 1 second (or better) up to 1,000 seconds. At its
  23. * maximum tracked value (1 hour), it would still maintain a resolution of 3.6 seconds (or better).
  24. * <p>
  25. * Auto-resizing: When constructed with no specified value range range (or when auto-resize is turned on with {@link
  26. * Histogram#setAutoResize}) a {@link PackedHistogram} will auto-resize its dynamic range to include recorded values as
  27. * they are encountered. Note that recording calls that cause auto-resizing may take longer to execute, as resizing
  28. * incurs allocation and copying of internal data structures.
  29. * <p>
  30. */
  31. declare class PackedHistogram extends JsHistogram {
  32. packedCounts: PackedArray;
  33. constructor(lowestDiscernibleValue: number, highestTrackableValue: number, numberOfSignificantValueDigits: number);
  34. clearCounts(): void;
  35. incrementCountAtIndex(index: number): void;
  36. addToCountAtIndex(index: number, value: number): void;
  37. setCountAtIndex(index: number, value: number): void;
  38. resize(newHighestTrackableValue: number): void;
  39. getCountAtIndex(index: number): number;
  40. protected _getEstimatedFootprintInBytes(): number;
  41. copyCorrectedForCoordinatedOmission(expectedIntervalBetweenValueSamples: number): PackedHistogram;
  42. toString(): string;
  43. }
  44. export default PackedHistogram;