org.opends.server.plugins.profiler
Class ProfilerThread

java.lang.Object
  extended by java.lang.Thread
      extended by org.opends.server.api.DirectoryThread
          extended by org.opends.server.plugins.profiler.ProfilerThread
All Implemented Interfaces:
java.lang.Runnable

public class ProfilerThread
extends DirectoryThread

This class defines a thread that may be used to actually perform profiling in the Directory Server. When activated, it will repeatedly retrieve thread stack traces and store them so that they can be written out and analyzed with a separate utility.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ProfilerThread(long sampleInterval)
          Creates a new profiler thread that will obtain stack traces at the specified interval.
 
Method Summary
 void run()
          Runs in a loop, periodically capturing a list of the stack traces for all active threads.
 void stopProfiling()
          Causes the profiler thread to stop capturing stack traces.
 void writeCaptureData(java.lang.String filename)
          Writes the information captured by this profiler thread to the specified file.
 
Methods inherited from class org.opends.server.api.DirectoryThread
getAssociatedTask, getCreationStackTrace, getDebugProperties, getParentThread, setAssociatedTask
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProfilerThread

public ProfilerThread(long sampleInterval)
Creates a new profiler thread that will obtain stack traces at the specified interval.

Parameters:
sampleInterval - The length of time in milliseconds between polls for stack trace information.
Method Detail

run

public void run()
Runs in a loop, periodically capturing a list of the stack traces for all active threads.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

stopProfiling

public void stopProfiling()
Causes the profiler thread to stop capturing stack traces. This method will not return until the thread has stopped.


writeCaptureData

public void writeCaptureData(java.lang.String filename)
                      throws java.io.IOException
Writes the information captured by this profiler thread to the specified file. This should only be called after

Parameters:
filename - The path and name of the file to write.
Throws:
java.io.IOException - If a problem occurs while trying to write the capture data.