Class Timing


  • public class Timing
    extends Object
    A helper class to help with optimizing the performance of a list of operations.

    For example, when trying to figure out which Service would be the best candidate to speed up Context initialization, this helper comes in real handy: it accumulates a list of operations with their duration and prints out a sorted list when asked to.

    Use this class as following:

     private static Timing timing = new Timing();
     ...
     private void oneOperation() {
      final long t1 = System.nanoTime();
      ...
      timing.add(System.nanoTime() - t1, "Operation #1");
     }
     ...
     private void atEnd() {
      ...
      timing.report("Operations");
     }
     
    Author:
    Johannes Schindelin
    • Constructor Detail

      • Timing

        public Timing()
    • Method Detail

      • reset

        public void reset()
      • addTiming

        public void addTiming​(Object message)
      • addTiming

        public void addTiming​(long duration,
                              Object message)
      • report

        public void report​(String description)
      • start

        public static Timing start​(boolean condition)
      • tick

        public static void tick​(Timing timing)
      • tick

        public static void tick​(Timing timing,
                                Object message)
      • stop

        public static void stop​(Timing timing)