UNPKG

toofast

Version:

The Node.js performance testing tool with unit-test-like API.

84 lines (83 loc) 2.28 kB
/** * Population statistics passed between master and fork processes. */ export interface HistogramStats { /** * The total number of measurements in the population. */ readonly size: number; /** * The mean value. */ readonly mean: number; /** * The expectation of the squared deviation of a random variable from its mean. * * @see {@link https://en.wikipedia.org/wiki/Variance Variance} * @see {@link https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance Algorithms for calculating variance} */ readonly variance: number; /** * The standard deviation is a measure of the amount of variation or dispersion of a set of values. * * @see {@link https://en.wikipedia.org/wiki/Standard_deviation Standard deviation} */ readonly sd: number; /** * The standard error of the mean. * * @see {@link https://en.wikipedia.org/wiki/Standard_error Standard error} */ readonly sem: number; /** * The margin of error. */ readonly moe: number; /** * The relative margin of error [0, 1]. * * @see {@link https://en.wikipedia.org/wiki/Margin_of_error Margin of error} */ readonly rme: number; /** * The number of executions per second. */ readonly hz: number; } /** * Provides access to mutable population statistics. */ export declare class Histogram implements HistogramStats { size: number; /** * Total sum of all values added to the histogram. */ private readonly _adder; /** * Total sum of all squared values added to the histogram. */ private readonly _sqAdder; get mean(): number; get variance(): number; get sd(): number; get sem(): number; get moe(): number; get rme(): number; get hz(): number; /** * Add a new measurement to the histogram. * * @param value The value to add. */ add(value: number): void; /** * Adds all measurements from another histogram. * * @param histogram The histogram to add measurements from. */ add(histogram: Histogram): void; /** * Returns the snapshot of the current histogram stats. */ getStats(): HistogramStats; }