TPTP 4.1.0 Platform Project
Public API Specification

org.eclipse.hyades.collection.profiler
Class Profiler

java.lang.Object
  extended byorg.eclipse.hyades.collection.profiler.Profiler

public final class Profiler
extends java.lang.Object

This is a singleton class that is used by the application to manage the Java Profiling Agent. This class is a singleton and cannot be instantiated by the user. In order to access the singleton the application must use Profiler.getProfiler()


Field Summary
static int EMIT_XML_FAIL
           
static int EMIT_XML_SUCCESS
           
static int EMIT_XML_SUSPENDED_IO
           
static int PROFILER_EXECUTION_AND_HEAP
           
static int PROFILER_EXECUTION_ONLY
           
static int PROFILER_HEAP_ONLY
           
static int PROFILER_OPTIMIZED_HEAP_ONLY
           
 
Method Summary
 void analyzeHeap(java.lang.String name)
          Analyze the heap to determine what new objects have been created in the heap since the last time the heap was marked or the last time it was analyzed.
 void disableGC()
          Disable garbage collection.
static int emitXMLFragment(byte[] arr, int offset, int len)
          emitXMLFragment
static int emitXMLFragment(java.lang.String xmlFragment)
          emitXMLFragment
 void enableGC()
          Enable garbage collection after previously disabling it
static double getCurrentThreadCpuTime()
          getCurrentThreadCpuTime returns thread cpu time converted in seconds (see JVMPI GetCurrentThreadCpuTime).
static double getCurrentTime()
          getCurrentTime Returns current time (in seconds) more accurately than System.currentTimeMillis()
static Profiler getProfiler()
          Getter to retieve the singleton Profiler.
 boolean isProfiling()
          Is the profiler actively collecting data.
 void markHeap()
          Mark the heap.
 java.util.List optimizedHeapInfoSnapshot()
          Take a optimized heap dump of the application.
 void release()
          Release the profiler so that all of the session data is cleaned up.
 void runGC()
           
 void setMode(int mode)
          Once a handle to the profiler is established the mode in which it is running can be set.
 void startProfiling(boolean currentThreadOnly)
          Start a profiling session.
 void startProfiling(boolean currentThreadOnly, int boundaryDepth)
          Start a profiling session.
 java.util.List stopOptimizedHeapInfoSnapshot()
           
 void stopProfiling()
          Stop profiling the information requested in a previous call to startProfiling.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROFILER_EXECUTION_ONLY

public static final int PROFILER_EXECUTION_ONLY
See Also:
Constant Field Values

PROFILER_HEAP_ONLY

public static final int PROFILER_HEAP_ONLY
See Also:
Constant Field Values

PROFILER_EXECUTION_AND_HEAP

public static final int PROFILER_EXECUTION_AND_HEAP
See Also:
Constant Field Values

PROFILER_OPTIMIZED_HEAP_ONLY

public static final int PROFILER_OPTIMIZED_HEAP_ONLY
See Also:
Constant Field Values

EMIT_XML_SUCCESS

public static final int EMIT_XML_SUCCESS
See Also:
Constant Field Values

EMIT_XML_SUSPENDED_IO

public static final int EMIT_XML_SUSPENDED_IO
See Also:
Constant Field Values

EMIT_XML_FAIL

public static final int EMIT_XML_FAIL
See Also:
Constant Field Values
Method Detail

getProfiler

public static Profiler getProfiler()
                            throws ProfilerNotAvailableException
Getter to retieve the singleton Profiler.

Throws:
ProfilerNotAvailableException

setMode

public void setMode(int mode)
             throws ProfilerNotAvailableException
Once a handle to the profiler is established the mode in which it is running can be set. The default is PROFILER_EXECUTION_AND_HEAP.

Parameters:
mode -
Throws:
ProfilerNotAvailableException

startProfiling

public void startProfiling(boolean currentThreadOnly)
Start a profiling session. If a profiling session is currently executing the call is ignored.

Parameters:
currentThreadOnly - - the profiling information is by default for the entire process. If currentThreadOnly is true profiling information will be restricted to the thread that is currently executing the startProfiling method.

startProfiling

public void startProfiling(boolean currentThreadOnly,
                           int boundaryDepth)
Start a profiling session. If a profiling session is currently executing the call is ignored.

Parameters:
currentThreadOnly - - the profiling information is by default for the entire process. If currentThreadOnly is true profiling information will be restricted to the thread that is currently executing the startProfiling method.
boundaryDepth - - the profiling information does not extend beyond the number of frames indicated by boundaryDepth. If the boundary depth is zero or negative then the number of frames is unlimited.

stopProfiling

public void stopProfiling()
Stop profiling the information requested in a previous call to startProfiling. If there is no current profiling session the call is ignored. This call need not be on the same thread as the startProfiling call irregardless of whether singlethreaded profiling was requested.


markHeap

public void markHeap()
Mark the heap. Marking the heap causes all the objects currently in the heap to be marked so that a subsequent call to analyzeHeap will only apply to the newly created objects between the two calls.


analyzeHeap

public void analyzeHeap(java.lang.String name)
Analyze the heap to determine what new objects have been created in the heap since the last time the heap was marked or the last time it was analyzed.

Parameters:
name - - a label that will be applied to this analysis session so that it can be identified amongst several analysis sessions. THIS IS CURRENTLY NOT SUPPORTED.

optimizedHeapInfoSnapshot

public java.util.List optimizedHeapInfoSnapshot()
Take a optimized heap dump of the application. Each snapshot will be placed in a series of files. These files must be retrieved by the tooling for analysis. This retrieval is beyond the scope of this profiler.

Returns:
- the list of files that contain optimized heap dump information.

stopOptimizedHeapInfoSnapshot

public java.util.List stopOptimizedHeapInfoSnapshot()

disableGC

public void disableGC()
Disable garbage collection. A subsequent call to enableGC() will be required to reenable GC.


enableGC

public void enableGC()
Enable garbage collection after previously disabling it


runGC

public void runGC()

isProfiling

public boolean isProfiling()
Is the profiler actively collecting data.


release

public void release()
Release the profiler so that all of the session data is cleaned up.


emitXMLFragment

public static int emitXMLFragment(java.lang.String xmlFragment)
emitXMLFragment

Parameters:
xmlFragment - - the xmlFragment string to emit
Returns:
EMIT_XML_SUCCESS if xmlFragment was successfully written; EMIT_XML_SUSPENDED_IO if xmlFragment failed to be written because monitoring was off EMIT_XML_FAIL if xmlFragment failed to be written for other reasons

emitXMLFragment

public static int emitXMLFragment(byte[] arr,
                                  int offset,
                                  int len)
emitXMLFragment

Parameters:
arr - - the byte array where the XML fragment is contained
offset - - the starting offset into arr where the XML fragment starts
len - - the length of bytes that should be read from the given offset
Returns:
EMIT_XML_SUCCESS if xmlFragment was successfully written; EMIT_XML_SUSPENDED_IO if xmlFragment failed to be written because monitoring was off; EMIT_XML_FAIL if xmlFragment failed to be written for other reasons

getCurrentTime

public static double getCurrentTime()
getCurrentTime Returns current time (in seconds) more accurately than System.currentTimeMillis()


getCurrentThreadCpuTime

public static double getCurrentThreadCpuTime()
getCurrentThreadCpuTime returns thread cpu time converted in seconds (see JVMPI GetCurrentThreadCpuTime).


TPTP 4.1.0 Platform Project
Public API Specification