com.jfw.util
Class Profiler

java.lang.Object
  extended by com.jfw.util.Profiler

public class Profiler
extends java.lang.Object

A simply profiler.

Example

 Profiler profiler = new Profiler();
 profiler.start();
 
 //your code here
 
 profiler.stop();
 long executionTime = profiler.getExecutionTime();
 


Constructor Summary
Profiler()
           
 
Method Summary
 long getExecutionTime()
          Get the difference in ms between stopTime and startTime.
 java.util.Date getStartTime()
          Get attribute startTime.
 java.util.Date getStopTime()
          Get attribute stopTime.
 void reset()
          Set at null attributes startTime and stopTime.
 void start()
          Set attribute startTime with the date-time when called this method.
 void stop()
          Set attribute stopTime with the date-time when called this method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Profiler

public Profiler()
Method Detail

start

public void start()
Set attribute startTime with the date-time when called this method.


stop

public void stop()
Set attribute stopTime with the date-time when called this method.


getStartTime

public java.util.Date getStartTime()
Get attribute startTime.

Returns:
attribute startTime.

getStopTime

public java.util.Date getStopTime()
Get attribute stopTime.

Returns:
attribute stopTime.

reset

public void reset()
Set at null attributes startTime and stopTime.


getExecutionTime

public long getExecutionTime()
Get the difference in ms between stopTime and startTime.
if stopTime is null is valorized now.

Returns:
  1. the difference in ms between stopTime and startTime.
  2. If startTime is null return -1.
  3. -2 if an error occur.