Class Measure


  • public class Measure
    extends Object
    Measures invokation of Runnables/Callables in milliseconds. Average of n-invocations can also be calculated (using the '.every(n)' builder method). A total can be logged using finish() on the Measure object. Thread-safe.
    • Method Detail

      • measure

        public static Measure measure​(String what)
        Builds a new Measure object to measure invokations of runnables/callables.
      • every

        public Measure every​(Integer iterations)
        If provided, the average on a single invokation will be calculated/logged after every n-iterations.
      • finish

        public void finish()
        This method can be called to print the total amount of time taken until that point in time.
      • total

        public Measure total​(boolean total)
      • runnable

        public void runnable​(Runnable runnable)
        Measure the invokation time of the given Runnable (without Exception).
      • call

        public <V> V call​(Callable<V> callable)
                   throws Exception
        Measure the invokation time of the given Callable.
        Throws:
        Exception