On this page

C

SlidingWindowHistogram

History

Records values into a lazily rotated ring of histogram chunks. Instances are created using perf_hooks.createSlidingWindowHistogram() and cannot be constructed directly. A SlidingWindowHistogram does not extend Histogram; call snapshot() to materialize the current window as a Histogram.

SlidingWindowHistogram instances cannot be cloned or transferred through a MessagePort.

M

slidingWindowHistogram.record

History
slidingWindowHistogram.record(val): void
Attributes
The amount to record.

Records val in the current chunk. For a count-based window, every call that reaches the native histogram counts toward rotation, including values which exceed the configured highest value.

M

slidingWindowHistogram.reset

History
slidingWindowHistogram.reset(): void

Invalidates all chunks in the current window. Allocated chunks are reset lazily when reused.

M

slidingWindowHistogram.snapshot

History
slidingWindowHistogram.snapshot(): Histogram
Returns:Histogram

Materializes the current window as a new, independent Histogram. Values recorded or expired after this method returns do not change the returned histogram. Materialization allocates one histogram and merges every retained chunk.