org.alfresco.util.perf
Class PerformanceMonitor

java.lang.Object
  extended by org.alfresco.util.perf.AbstractPerformanceMonitor
      extended by org.alfresco.util.perf.PerformanceMonitor

public class PerformanceMonitor
extends AbstractPerformanceMonitor

Enables begin ... end style performance monitoring with summarisation using the performance logging category. It is designed to only incur a minor cost when performance logging is turned on using the DEBUG logging mechanism. See base class for details on enabling the performance logging categories.

This class is thread safe.

Usage:

 private PerformanceMonitor somethingTimer = new PerformanceMonitor("mytest", "doSomething");
 ...
 ...
 private void doSomething()
 {
    somethingTimer.start();
    ...
    ...
    somethingTimer.stop();
 }
 


Constructor Summary
PerformanceMonitor(java.lang.String entityName, java.lang.String methodName)
           
 
Method Summary
 void start()
          Threadsafe method to start the timer.
 void stop()
          Threadsafe method to stop the timer.
 
Methods inherited from class org.alfresco.util.perf.AbstractPerformanceMonitor
isDebugEnabled, recordStats
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PerformanceMonitor

public PerformanceMonitor(java.lang.String entityName,
                          java.lang.String methodName)
Parameters:
entityName - name of the entity, e.g. a test name or a bean name against which to log the performance
methodName - the method for which the performance will be logged
Method Detail

start

public void start()
Threadsafe method to start the timer.

The timer is only started if the logging levels are enabled.

See Also:
PerformanceMonitor.stop()

stop

public void stop()
Threadsafe method to stop the timer.

See Also:
PerformanceMonitor.start()


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.