Class RealtimeStatistics

java.lang.Object
com.codename1.realtime.RealtimeStatistics

public final class RealtimeStatistics extends Object

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().

  • Field Details

  • 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: between 0 and 1, for example 0.9999
    • toString

      public String toString()
      One line, for a log.
      Overrides:
      toString in class Object