org.h2.util
Class Profiler

java.lang.Object
  extended by org.h2.util.Profiler
All Implemented Interfaces:
java.lang.Runnable

public class Profiler
extends java.lang.Object
implements java.lang.Runnable

A simple CPU profiling tool similar to java -Xrunhprof.


Field Summary
 int depth
           
 int interval
           
 boolean paused
           
 
Constructor Summary
Profiler()
           
 
Method Summary
static java.lang.instrument.Instrumentation getInstrumentation()
          Get the instrumentation object if started as an agent.
 java.lang.String getTop(int count)
          Get the top stack traces.
static void premain(java.lang.String agentArgs, java.lang.instrument.Instrumentation inst)
          This method is called when the agent is installed.
 void run()
           
 void startCollecting()
          Start collecting profiling data.
 void stopCollecting()
          Stop collecting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

interval

public int interval

depth

public int depth

paused

public boolean paused
Constructor Detail

Profiler

public Profiler()
Method Detail

premain

public static void premain(java.lang.String agentArgs,
                           java.lang.instrument.Instrumentation inst)
This method is called when the agent is installed.

Parameters:
agentArgs - the agent arguments
inst - the instrumentation object

getInstrumentation

public static java.lang.instrument.Instrumentation getInstrumentation()
Get the instrumentation object if started as an agent.

Returns:
the instrumentation, or null

startCollecting

public void startCollecting()
Start collecting profiling data.


stopCollecting

public void stopCollecting()
Stop collecting.


run

public void run()
Specified by:
run in interface java.lang.Runnable

getTop

public java.lang.String getTop(int count)
Get the top stack traces.

Parameters:
count - the maximum number of stack traces
Returns:
the stack traces.