org.scijava.util
Class Timing

java.lang.Object
  extended by org.scijava.util.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 Summary
Timing()
           
 
Method Summary
 void addTiming(long duration, Object message)
           
 void addTiming(Object message)
           
 void report(String description)
           
 void reset()
           
static Timing start(boolean condition)
           
static void stop(Timing timing)
           
static void tick(Timing timing)
           
static void tick(Timing timing, Object message)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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)


Copyright © 2009–2014 SciJava. All rights reserved.