Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.

public final class RealtimeStatistics

  1. Object
  2. RealtimeStatistics

A snapshot of how a RealtimeThread’s periods went: how late each release woke the thread (latency), how long its cycles ran, and how many releases it missed.

Latency is the number to watch. Its maximum is the loop’s real worst case on this device, under whatever load ran beside it; getLatencyHistogram() shows how the rest are spread. Taken with RealtimeThread.getStatistics().

Fields

public static final int HISTOGRAM_BUCKETS = 16The number of buckets in getLatencyHistogram().

Methods

public long getCycles()The number of cycles run.
public long getMissedPeriods()The number of releases skipped because a cycle ran past them.
public long getMaxLatencyNanos()The latest any release woke the thread, in nanoseconds.
public long getMeanLatencyNanos()The mean wake-up latency, in nanoseconds.
public long getMaxExecutionNanos()The longest a cycle ran, in nanoseconds: from its wake-up to its next wait.
public long getMeanExecutionNanos()The mean time a cycle ran, in nanoseconds.
public long getAllocationViolations()The number of allocations that ended a steady state on this thread.
public long[] getLatencyHistogram()Wake-up latencies counted by powers of two of a microsecond: index 0 is under one microsecond, index 1 under two, index i under 2^i microseconds, and the last bucket everything from about 16 milliseconds up.
public long getLatencyPercentileNanos(double fraction)The latency, in nanoseconds, under which at least fraction of the wake-ups fell, read from the histogram – so it is the upper edge of a power-of-two bucket, an over-estimate by at most a factor of two.
public String toString()One line, for a log.

Inherited methods

Field details

HISTOGRAM_BUCKETS

public static final int HISTOGRAM_BUCKETS = 16
The number of buckets in getLatencyHistogram().

Method details

getCycles

public long getCycles()
The number of cycles run.

getMissedPeriods

public long getMissedPeriods()
The number of releases skipped because a cycle ran past them.

getMaxLatencyNanos

public long getMaxLatencyNanos()
The latest any release woke the thread, in nanoseconds.

getMeanLatencyNanos

public long getMeanLatencyNanos()
The mean wake-up latency, in nanoseconds.

getMaxExecutionNanos

public long getMaxExecutionNanos()
The longest a cycle ran, in nanoseconds: from its wake-up to its next wait.

getMeanExecutionNanos

public long getMeanExecutionNanos()
The mean time a cycle ran, in nanoseconds.

getAllocationViolations

public long getAllocationViolations()
The number of allocations that ended a steady state on this thread.

getLatencyHistogram

public long[] getLatencyHistogram()
Wake-up latencies counted by powers of two of a microsecond: index 0 is under one microsecond, index 1 under two, index i under 2^i microseconds, and the last bucket everything from about 16 milliseconds up.

getLatencyPercentileNanos

public long getLatencyPercentileNanos(double fraction)
The latency, in nanoseconds, under which at least fraction of the wake-ups fell, read from the histogram – so it is the upper edge of a power-of-two bucket, an over-estimate by at most a factor of two.

Parameters

fraction double
between 0 and 1, for example 0.9999

toString

public String toString()
One line, for a log.