com.ibm.commons.util.profiler
Class Profiler

java.lang.Object
  extended by com.ibm.commons.util.profiler.Profiler

public class Profiler
extends java.lang.Object

This class is used to enable/disable the profiler. if( Profiler.enabled ) { startProfiling(type,param); try { // Do stuff... } finally { endProfiling(); } } else { // Do stuff... }


Constructor Summary
Profiler()
           
 
Method Summary
static void disableProfiler()
          Globally disable the profiler.
static void dump()
          Method that dumps the main aggregator (root).
static void enableProfiler(com.ibm.commons.util.profiler.HighResolutionTimer timer)
          Globally enable the profiler.
static void endProfileBlock(ProfilerAggregator aggregator, long startTime)
          Method that should be called at the end of a profiled block.
static void endProfiler()
          Profiler end.
static long getCurrentTime()
          Get the current time in micros.
static com.ibm.commons.util.profiler.HighResolutionTimer getCurrentTimer()
          Get the current timer.
static ProfilerAggregator getMainAggregator()
          Method that returns the main aggregator (root).
static boolean isEnabled()
          Check if the profiler is enabled for the current thread
static void profileRunnable(ProfilerType type, java.lang.String id, java.lang.Runnable runnable)
          Method used to execute and profile a Runnable.
static void resetProfiler()
          Method that should be called to reset the profiler.
static ProfilerAggregator startProfileBlock(ProfilerType type, java.lang.String param)
          Method that should be called when a block should be profiled.
static ProfilerAggregator startProfileBlock(ProfilerType type, java.lang.String param, int detailLevel)
          Method that should be called when a block should be profiled.
static ProfilerAggregator startProfileBlock(java.lang.String type, java.lang.String param)
          Method that should be called when a block should be profiled.
static void startProfiler()
          Profiler start.
 
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

enableProfiler

public static void enableProfiler(com.ibm.commons.util.profiler.HighResolutionTimer timer)
Globally enable the profiler.


disableProfiler

public static void disableProfiler()
Globally disable the profiler.


startProfiler

public static void startProfiler()
Profiler start. This method initialize and starts the profiler for the current thread.


endProfiler

public static void endProfiler()
Profiler end. This method ends the profiler for the current thread.


isEnabled

public static boolean isEnabled()
Check if the profiler is enabled for the current thread


getCurrentTimer

public static com.ibm.commons.util.profiler.HighResolutionTimer getCurrentTimer()
Get the current timer.


startProfileBlock

public static ProfilerAggregator startProfileBlock(ProfilerType type,
                                                   java.lang.String param)
Method that should be called when a block should be profiled.


startProfileBlock

public static ProfilerAggregator startProfileBlock(ProfilerType type,
                                                   java.lang.String param,
                                                   int detailLevel)
Method that should be called when a block should be profiled.


startProfileBlock

public static ProfilerAggregator startProfileBlock(java.lang.String type,
                                                   java.lang.String param)
Method that should be called when a block should be profiled.


endProfileBlock

public static void endProfileBlock(ProfilerAggregator aggregator,
                                   long startTime)
Method that should be called at the end of a profiled block.


resetProfiler

public static void resetProfiler()
Method that should be called to reset the profiler.


getMainAggregator

public static ProfilerAggregator getMainAggregator()
Method that returns the main aggregator (root).


dump

public static void dump()
Method that dumps the main aggregator (root).


profileRunnable

public static void profileRunnable(ProfilerType type,
                                   java.lang.String id,
                                   java.lang.Runnable runnable)
Method used to execute and profile a Runnable.


getCurrentTime

public static long getCurrentTime()
Get the current time in micros.