VistALink v1.5.0.026

gov.va.med.monitor.time
Class AuditTimer

java.lang.Object
  extended bygov.va.med.monitor.time.AuditTimer

public class AuditTimer
extends java.lang.Object

This class gives an easy way to capture performance statistics and log them to a log file. Internally System.currentTimeMillis() is used.

Typical steps for using this class:

  1. Create an instance: auditTimer = new AutitTimer()
  2. auditTimer.start()
  3. auditTimer.stop()
  4. auditTimer.getTimeElapsedMillis()
autitTimer.start() should be called before auditTimer.stop()is called.

Version:
1.5.0.026
Author:
Application Modernization - Foundations Team

Constructor Summary
AuditTimer()
          Default constructor.
AuditTimer(org.apache.log4j.Logger logger)
          Constructor that accepts logger to be used for output.
 
Method Summary
 long getTimeElapsedMillis()
           
static boolean isAuditTimerEnabled()
           
static boolean isAuditTimerEnabled(org.apache.log4j.Logger logger)
           
 void log()
          The same as log(String).
 void log(java.lang.String message)
          Logs a message to the log4j logger in a following format: your_message elapsed_time_milliseconds
 void start()
          Starts the timer.
 long stop()
          Stops the timer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuditTimer

public AuditTimer()
Default constructor. Default logger gov.va.med.foundations.utilities.AuditTimer will be used.


AuditTimer

public AuditTimer(org.apache.log4j.Logger logger)
Constructor that accepts logger to be used for output. Application can pass in their own loggers to have granual control over logging.

Parameters:
logger -
Method Detail

start

public void start()
Starts the timer.


stop

public long stop()
Stops the timer. If start() was not called at least once before stop() is called timeElapsedMillis is set to -1.

This method does not through Exception to keep client code simple.

Returns:
long

getTimeElapsedMillis

public long getTimeElapsedMillis()
Returns:
long

log

public void log()
The same as log(String).


log

public void log(java.lang.String message)
Logs a message to the log4j logger in a following format:

your_message elapsed_time_milliseconds

Parameters:
message -

isAuditTimerEnabled

public static boolean isAuditTimerEnabled(org.apache.log4j.Logger logger)

isAuditTimerEnabled

public static boolean isAuditTimerEnabled()

VistALink v1.5.0.026

VistALink v1.5.0.026