Class SingleValueSnapshot

java.lang.Object
org.jppf.utils.stats.AbstractBaseJPPFSnapshot
org.jppf.utils.stats.SingleValueSnapshot
All Implemented Interfaces:
Serializable, JPPFSnapshot

public class SingleValueSnapshot extends AbstractBaseJPPFSnapshot
Instances of this class simply accumulate the values provided via calls to addValues(double, long). The min, max, avg and latest values are never computed and thus have a constant value of 0.

This is intended for monitoring snapshots that only handle one value and to avoid excessive overhead during serialization and deserialization.

Author:
Laurent Cohen
See Also:
  • Constructor Details

    • SingleValueSnapshot

      public SingleValueSnapshot(String label)
      Initialize this time snapshot with a specified title.
      Parameters:
      label - the title for this snapshot.
  • Method Details

    • addValues

      public void addValues(double accumulatedValues, long count)
      Add a set of aggregated values to this snapshot.
      Parameters:
      accumulatedValues - the accumulated sum of the values to add.
      count - the number of values in the accumalated values.
    • copy

      public JPPFSnapshot copy()
      Make a copy of this time snapshot object.
      Returns:
      a TimeSnapshot instance.
    • reset

      public void reset()
      Reset all counters to their initial values.
    • getValueCount

      public long getValueCount()
      Description copied from interface: JPPFSnapshot
      Get the count of values added to this snapshot.
      Returns:
      the count of values as a long.
    • getLatest

      public double getLatest()
      Description copied from interface: JPPFSnapshot
      Get the latest observed value.
      Returns:
      the latest value as a double.
    • getMin

      public double getMin()
      Description copied from interface: JPPFSnapshot
      Get the smallest observed value.
      Returns:
      the minimum value as a double.
    • getMax

      public double getMax()
      Description copied from interface: JPPFSnapshot
      Get the peak observed value.
      Returns:
      the peak value double.
    • getAvg

      public double getAvg()
      Description copied from interface: JPPFSnapshot
      Get the average value.
      Returns:
      the average value as a double.
    • toString

      public String toString()
      Overrides:
      toString in class Object