PerInterpreterStatistic

A PerInterpreterStatistic is an incremental, summarized recording of a set of integral values and times. It is synchronized, although the typical usage is that it will only be written by a single Thread at a time, and read by another Thread only rarely.

If you want to record samples from multiple processes, use a Statistic, which holds a PerInterpreterStatistic for up to AvailRuntimeConfiguration.maxInterpreters separate Threads to access, without any locks.

Author

Mark van Gulik

Parameters

count

The number of samples.

min

The minimum sample.

max

The maximum sample.

mean

The mean of the samples.

sumOfDeltaSquares

The sum of squares of differences of the samples from the mean.

Functions

Link copied to clipboard
fun clear()

Reset this statistic as though no samples had ever been recorded.

Link copied to clipboard
open operator override fun compareTo(other: PerInterpreterStatistic): Int

Default sort is descending by sum.

Link copied to clipboard

Describe this statistic as though its samples are durations in nanoseconds.

Link copied to clipboard
fun record(sample: Double)

Record a new sample, updating any cumulative statistical values. This is thread-safe. However, the locking cost is very low due to a spinlock, as long as there's very low contention. Since Statistic partitions use of PerInterpreterStatistics by Interpreter (and hence by Thread), the contention is non-existent, except when accumulating stats to print.