de.enough.polish.benchmark
Class Benchmark

java.lang.Object
  extended by de.enough.polish.benchmark.Benchmark

public class Benchmark
extends Object

A benchmark class to time processes in an application.

Author:
Ovidiu Iliescu, Andre Schmidt

Constructor Summary
Benchmark()
           
 
Method Summary
static void check()
          Check if enough time has elapsed since this method was last called.
static void check(long desiredElapsedTime)
          Check if enough time has elapsed since this method was last called.
static void haltOutput()
          Prevents smart timers from outputing their values
static void incrementSmartTimer(Object name)
          Increment a certain timer by 1.
static void pauseSmartTimer(Object name)
          Pause the clock on a certain smart timer
static void resumeOutput()
          Resumes output for smart timers
static void setSmartTimerCheckInterval(long value)
          Sets the default "time elapsed interval" for the check() method.
static void setSmartTimerDescription(Object timerName, String description)
          Set the description text of a certain smart timer
static void start(String key)
          Starts a benchmark with the given key
static void startSmartTimer(Object name)
          Start the clock on a certain smart timer
static long stop(String key, String name)
          Stops the benchmark with the given key
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Benchmark

public Benchmark()
Method Detail

start

public static void start(String key)
Starts a benchmark with the given key

Parameters:
key - the key

stop

public static long stop(String key,
                        String name)
Stops the benchmark with the given key

Parameters:
key - the key
name - the name
Returns:
the used time in that benchmark

setSmartTimerDescription

public static void setSmartTimerDescription(Object timerName,
                                            String description)
Set the description text of a certain smart timer

Parameters:
timerName -
description -

startSmartTimer

public static void startSmartTimer(Object name)
Start the clock on a certain smart timer

Parameters:
name -

incrementSmartTimer

public static void incrementSmartTimer(Object name)
Increment a certain timer by 1. Useful for measuring how many times a certain piece of code was executed.

Parameters:
name -

pauseSmartTimer

public static void pauseSmartTimer(Object name)
Pause the clock on a certain smart timer

Parameters:
name -

check

public static void check()
Check if enough time has elapsed since this method was last called. If enough time has passed, output the smart timer values.


setSmartTimerCheckInterval

public static void setSmartTimerCheckInterval(long value)
Sets the default "time elapsed interval" for the check() method.


check

public static void check(long desiredElapsedTime)
Check if enough time has elapsed since this method was last called. If enough time has passed, output the smart timer values.

Parameters:
desiredElapsedTime -

haltOutput

public static void haltOutput()
Prevents smart timers from outputing their values


resumeOutput

public static void resumeOutput()
Resumes output for smart timers