Print Page as PDF
gov.va.med.monitor.time.AuditTimer ICR (5170)

gov.va.med.monitor.time.AuditTimer    ICR (5170)

Name Value
NUMBER 5170
IA # 5170
DATE CREATED 2008/04/11
CUSTODIAL PACKAGE FOUNDATIONS
USAGE Supported
TYPE Other
DBIC APPROVAL STATUS APPROVED
NAME gov.va.med.monitor.time.AuditTimer
GENERAL DESCRIPTION
public class AuditTimer extends java.lang.Object:

The AuditTimer 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.
STATUS Active
KEYWORDS
  • AuditTimer
  • Foundations
  • FoundationsLib
DURATION Till Otherwise Agreed
COMPONENT/ENTRY POINT
COMPONENT/ENTRY POINT COMPONENT DESCRIPTION VARIABLES
constructor
public AuditTimer(): Default constructor. Default
logger gov.va.med.foundations.utilities.AuditTimer will be used.

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.
VARIABLES TYPE VARIABLES DESCRIPTION
logger Input
(optional) org.apache.log4j.Logger: logger to use to
write AuditTimer output to.
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 throw Exceptions, to keep client code simple.
VARIABLES TYPE VARIABLES DESCRIPTION
return Output
returns long: elapsed time since timer start in
milliseconds (or -1 if timer not started.)
getTimeElapsedMillis()
public long getTimeElapsedMillis(): returns the
elapsed milliseconds between the last start()/stop() cycle.
VARIABLES TYPE VARIABLES DESCRIPTION
return Output
returns long: # of elapsed milliseconds between last
start()/stop() cycle.
log
public void log(): Logs a message to the log4j logger
in a following format: elapsed_time_milliseconds

public void log(java.lang.String message): Logs a message to the log4j logger
in a following format: your_message elapsed_time_milliseconds
VARIABLES TYPE VARIABLES DESCRIPTION
message Input
(optional) java.lang.String message: message to
prepend to output.
isAuditTimerEnabled()
public static boolean isAuditTimerEnabled(): returns
whether info-level is currently enabled on the default logger.

public static boolean isAuditTimerEnabled(org.apache.log4j.Logger logger):
returns whether info-level logging is currently enabled for the specified
logger (AuditTimer log writes use info-level loggers).
VARIABLES TYPE VARIABLES DESCRIPTION
return Output
returns boolean: true if info-level logging is on,
false if not.
logger Input
(optional) org.apache.log4j.Logger: the logger to
check. If not passed, the default logger is checked.
DATE ACTIVATED 2008/07/11