jklustor-overlap-0.0.2-20140619012940 (ChemAxon)


com.chemaxon.calculations.common
Class Timer

Object
  extended by com.chemaxon.calculations.common.Timer

@Beta
public class Timer
extends Object

Simple timer to measure elapsed times, invocation counts.

Invocation counts are represented as long values.

Please note that this class is marked with Beta annotation, so it can be subject of incompatible changes or removal in later releases.

Author:
Gabor Imre

Constructor Summary
Timer(String name)
          Construct started timer.
 
Method Summary
 long getElapsedTime()
          Elapsed time.
 long getInvocationCount()
          Get total invocation count.
 long invoke()
          Register one invoceation.
 long invoke(long invocations)
          Register one or multiple invocations.
 void stop()
          Stop.
static String toHumanReadableTimeUnit(double ms)
          Format to nicely interpretable time unit.
static String toSiPrefixedString(long measure)
          Format nicely with SI unit prefixes.
 String toString()
           
 String toString(boolean appendInvocations)
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Timer

public Timer(String name)
Construct started timer.

Parameters:
name - Timer name
Method Detail

invoke

public long invoke(long invocations)
Register one or multiple invocations.

Parameters:
invocations - Invocation number to register
Returns:
Total invocations count.
Throws:
IllegalStateException - when invoked in stopped state

invoke

public long invoke()
Register one invoceation.

Returns:
Total invocations count

stop

public void stop()
Stop.


getInvocationCount

public long getInvocationCount()
Get total invocation count.

Returns:
total invocation count

getElapsedTime

public long getElapsedTime()
Elapsed time.

Returns:
running time up to this point or up to signalling stop

toHumanReadableTimeUnit

public static String toHumanReadableTimeUnit(double ms)
Format to nicely interpretable time unit.

Parameters:
ms - Time in ms
Returns:
Human readable unit

toSiPrefixedString

public static String toSiPrefixedString(long measure)
Format nicely with SI unit prefixes.

Parameters:
measure - Value to format
Returns:
value with optionally k, M, G, T, P unit prefixes attached.
See Also:
http://en.wikipedia.org/wiki/Metric_prefix

toString

public String toString(boolean appendInvocations)

toString

public String toString()
Overrides:
toString in class Object

jklustor-overlap-0.0.2-20140619012940 (ChemAxon)