Class Statistics

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<Statistics.Item>

    public class Statistics
    extends java.lang.Object
    implements java.io.Serializable, java.lang.Iterable<Statistics.Item>
    This class represents a set of statistics, that can be updated incrementally sample by sample. Each item has a name; min/max/avg values are recorded. It is mostly used for measuring execution time, but can be used for any value of type long.
    Author:
    Fabrizio Giudici
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Statistics.Item
      This class represents a single statistics item with name, min/max/avg value.
    • Constructor Summary

      Constructors 
      Constructor Description
      Statistics()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addSample​(java.lang.String name, long value)
      Adds a new sample to these statistics.
      void dump()  
      void dump​(java.io.PrintWriter pw)  
      java.util.Iterator<Statistics.Item> iterator()
      void merge​(Statistics statistics)
      Merges these statistics with others.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • Statistics

        public Statistics()
    • Method Detail

      • addSample

        public void addSample​(java.lang.String name,
                              long value)
        Adds a new sample to these statistics.
        Parameters:
        name - the name
        value - the value
      • merge

        public void merge​(Statistics statistics)
        Merges these statistics with others.
        Parameters:
        statistics - the other statistics
      • dump

        public void dump()
      • dump

        public void dump​(java.io.PrintWriter pw)