ca.jimr.gae.profiler
Class MiniProfiler

java.lang.Object
  extended by ca.jimr.gae.profiler.MiniProfiler

public class MiniProfiler
extends Object

Simple step instrumentation that can be used to profile Java code in the context of the MiniProfilerFilter.

To start a step, use the step(String) method. To finish a step, call the close method on the MiniProfiler.Step object returned.

Typically you will do this in a try/finally block like:

 Step s = MiniProfiler.step("My Step");
 try
 {
   // Do Stuff
 } finally
 {
   s.close();
 }
 
Steps can be nested (e.g. starting a step while inside another step)

Profiling data is stored in a ThreadLocal.


Nested Class Summary
protected static class MiniProfiler.Profile
          Contains information about a profiling step
static class MiniProfiler.Step
          Used to control the starting and stopping of profiling steps.
 
Constructor Summary
MiniProfiler()
           
 
Method Summary
protected static void start()
          Start the profiler.
static MiniProfiler.Step step(String stepName)
          Start a profiling step.
protected static MiniProfiler.Profile stop()
          Stop the profiler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MiniProfiler

public MiniProfiler()
Method Detail

start

protected static void start()
Start the profiler.


stop

protected static MiniProfiler.Profile stop()
Stop the profiler.

This should be called in a finally block to avoid leaving data on the thread.

Returns:
The profiling data.

step

public static MiniProfiler.Step step(String stepName)
Start a profiling step.

Parameters:
stepName - The name of the step.
Returns:
A Step object whose MiniProfiler.Step.close() method should be called to finish the step.


Copyright © 2011-2013. All Rights Reserved.