tuffy.util
Class Timer

java.lang.Object
  extended by tuffy.util.Timer

public class Timer
extends java.lang.Object

Container of time related utilities.


Nested Class Summary
static class Timer.RunStat
           
 
Field Summary
private static long birth
           
private static long minuteInMillis
           
private static java.util.Hashtable<java.lang.String,java.lang.Long> points
           
static Timer.RunStat runStat
           
private static long secondInMillis
           
 
Constructor Summary
Timer()
           
 
Method Summary
static java.lang.String elapsed()
          Returns a string of elapsed time.
static java.lang.String elapsed(java.lang.String name)
          Returns the elapsed time of the timer with the given name.
static double elapsedMilliSeconds(java.lang.String name)
           
static double elapsedSeconds()
          Returns the number of elapsed seconds since last clock reset.
static double elapsedSeconds(java.lang.String name)
          Returns the number of elapsed seconds of a given timer; -1 if the timer is unknown.
static java.lang.String getDateTime()
           
private static long now()
           
static void printElapsed()
          Prints the elapsed time since last clock reset.
static void printElapsed(java.lang.String name)
          Prints the elapsed time of the timer with the given name.
private static java.lang.String readTime(long timeIntervalInMS)
           
static void resetClock()
          Resets the global starting point of the Timer.
static void start(java.lang.String name)
          Kicks off a timer with the given name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

birth

private static long birth

points

private static java.util.Hashtable<java.lang.String,java.lang.Long> points

secondInMillis

private static long secondInMillis

minuteInMillis

private static long minuteInMillis

runStat

public static Timer.RunStat runStat
Constructor Detail

Timer

public Timer()
Method Detail

resetClock

public static void resetClock()
Resets the global starting point of the Timer.


getDateTime

public static java.lang.String getDateTime()

start

public static void start(java.lang.String name)
Kicks off a timer with the given name.


elapsed

public static java.lang.String elapsed(java.lang.String name)
Returns the elapsed time of the timer with the given name. The format is [XX minutes, YYseconds].


elapsedSeconds

public static double elapsedSeconds(java.lang.String name)
Returns the number of elapsed seconds of a given timer; -1 if the timer is unknown.

Parameters:
name - the name of the timer

elapsedMilliSeconds

public static double elapsedMilliSeconds(java.lang.String name)

elapsedSeconds

public static double elapsedSeconds()
Returns the number of elapsed seconds since last clock reset.


printElapsed

public static void printElapsed()
Prints the elapsed time since last clock reset. The format is TIMER: [XX minutes, YYseconds].


printElapsed

public static void printElapsed(java.lang.String name)
Prints the elapsed time of the timer with the given name. The format is TIMER name: [XX minutes, YYseconds].


now

private static long now()

elapsed

public static java.lang.String elapsed()
Returns a string of elapsed time.


readTime

private static java.lang.String readTime(long timeIntervalInMS)