org.mule.module.management.mbean
Interface YourKitProfilerServiceMBean

All Known Implementing Classes:
YourKitProfilerService

public interface YourKitProfilerServiceMBean


Field Summary
static long ALLOCATION_RECORDING_ADAPTIVE
           
static long ALLOCATION_RECORDING_ALL
           
static long CPU_J2EE
           
static long CPU_SAMPLING
           
static long CPU_TRACING
           
static long MONITOR_PROFILING
           
static long SNAPSHOT_CAPTURING
          this mark is added to getStatus to indicate that captureEverySec was stated
static long SNAPSHOT_HPROF
           
static long SNAPSHOT_WITH_HEAP
           
static long SNAPSHOT_WITHOUT_HEAP
           
 
Method Summary
 void advanceGeneration(String description)
          Advance current object generation number.
 String captureMemorySnapshot()
          This method is just a convenient replacement of captureSnapshot(YourKitProfilerServiceMBean.SNAPSHOT_WITH_HEAP)
 String captureSnapshot(long snapshotFlags)
          Captures snapshot: write profiling information to file.
 String forceGC()
          Force GC
 String getHost()
           
 int getPort()
           
 long getStatus()
          Get current profiling status.
 void startAllocationRecording(long mode)
          Start object allocation recording.
 void startCapturingMemSnapshot(int seconds)
          Starts new daemon thread which calls captureMemorySnapshot() every N seconds.
 void startCPUProfiling(long mode, String filters)
          Start CPU profiling.
 void startMonitorProfiling()
          Start monitor profiling (requires that the profiled application runs on Java 5 or newer)
 void stopAllocationRecording()
           
 void stopCapturingMemSnapshot()
          Stops daemon thread started by startCapturingMemSnapshot(int)
 void stopCPUProfiling()
          Stop CPU profiling.
 void stopMonitorProfiling()
          Stop monitor profiling (requires that the profiled application runs on Java 5 or newer)
 

Field Detail

ALLOCATION_RECORDING_ALL

static final long ALLOCATION_RECORDING_ALL
See Also:
Constant Field Values

ALLOCATION_RECORDING_ADAPTIVE

static final long ALLOCATION_RECORDING_ADAPTIVE
See Also:
Constant Field Values

CPU_SAMPLING

static final long CPU_SAMPLING
See Also:
Constant Field Values

CPU_TRACING

static final long CPU_TRACING
See Also:
Constant Field Values

MONITOR_PROFILING

static final long MONITOR_PROFILING
See Also:
Constant Field Values

CPU_J2EE

static final long CPU_J2EE
See Also:
Constant Field Values

SNAPSHOT_WITHOUT_HEAP

static final long SNAPSHOT_WITHOUT_HEAP
See Also:
Constant Field Values

SNAPSHOT_WITH_HEAP

static final long SNAPSHOT_WITH_HEAP
See Also:
Constant Field Values

SNAPSHOT_HPROF

static final long SNAPSHOT_HPROF
See Also:
Constant Field Values

SNAPSHOT_CAPTURING

static final long SNAPSHOT_CAPTURING
this mark is added to getStatus to indicate that captureEverySec was stated

See Also:
Constant Field Values
Method Detail

getHost

String getHost()
Returns:
name of host where controlled profiled application is running. The method never returns null.

getPort

int getPort()
Returns:
port profiler agent listens on.

captureMemorySnapshot

String captureMemorySnapshot()
                             throws Exception
This method is just a convenient replacement of captureSnapshot(YourKitProfilerServiceMBean.SNAPSHOT_WITH_HEAP)

Returns:
absolute path to the captured snapshot.
Throws:
Exception

captureSnapshot

String captureSnapshot(long snapshotFlags)
                       throws Exception
Captures snapshot: write profiling information to file.

If some profiling is being performed (e.g. started with startCPUProfiling(long, String), startMonitorProfiling() or startAllocationRecording(long), or remotely), it won't stop after the capture. To stop it, explicitly call stopCPUProfiling(), stopMonitorProfiling() or stopAllocationRecording().

Parameters:
snapshotFlags - defines how much information should be stored:
  • YourKitProfilerServiceMBean.SNAPSHOT_WITHOUT_HEAP - capture snapshot with all the recorded information (CPU profiling, monitors, telemetry), but without the heap dump.
  • YourKitProfilerServiceMBean.SNAPSHOT_WITH_HEAP - capture snapshot with all the recorded information (CPU profiling, monitors, telemetry, allocations), as well as with the heap dump.
  • YourKitProfilerServiceMBean.SNAPSHOT_HPROF - capture snapshot in HPROF format (it will including the heap dump only).
Returns:
absolute path to the captured snapshot.
Throws:
Exception - if capture failed. The possible reasons are:
  • there's no Java application with properly configured profiler agent listening on port at host
  • profiled application has terminated
  • agent cannot capture snapshot for some reason

advanceGeneration

void advanceGeneration(String description)
Advance current object generation number. Since that moment, all newly created objects will belong to the new generation. Note that generations are also automatically advanced on capturing snapshots. Generations are only available if the profiled application runs on Java 5 or newer.

Parameters:
description - optional description associated with the generation

startAllocationRecording

void startAllocationRecording(long mode)
                              throws Exception
Start object allocation recording.

Parameters:
mode - YourKitProfilerServiceMBean.ALLOCATION_RECORDING_ALL or YourKitProfilerServiceMBean.ALLOCATION_RECORDING_ADAPTIVE
Throws:
Exception - if capture failed. The possible reasons are:
  • there's no Java application with properly configured profiler agent listening on port at host
  • profiled application has terminated
  • agent cannot capture snapshot for some reason
See Also:
captureMemorySnapshot(), stopCPUProfiling()

stopAllocationRecording

void stopAllocationRecording()
                             throws Exception
Throws:
Exception - if capture failed. The possible reasons are:
  • there's no Java application with properly configured profiler agent listening on port at host
  • profiled application has terminated
  • agent cannot capture snapshot for some reason

startCPUProfiling

void startCPUProfiling(long mode,
                       String filters)
                       throws Exception
Start CPU profiling.

Parameters:
mode - YourKitProfilerServiceMBean.CPU_SAMPLING or YourKitProfilerServiceMBean.CPU_TRACING or YourKitProfilerServiceMBean.CPU_SAMPLING | YourKitProfilerServiceMBean.CPU_J2EE or YourKitProfilerServiceMBean.CPU_TRACING | YourKitProfilerServiceMBean.CPU_J2EE
filters - string containing '\n'-separated list of classes whose methods should not be profiled. Wildcards are accepted ('*'). More methods are profiled, bigger the overhead. The filters are used with YourKitProfilerServiceMBean.CPU_TRACING only; with YourKitProfilerServiceMBean.CPU_SAMPLING the value is ignored. If null or empty string passed, all methods will be profiled (not recommended due to high overhead). For example, you can pass DEFAULT_FILTERS.
Throws:
Exception - if capture failed. The possible reasons are:
  • there's no Java application with properly configured profiler agent listening on port at host
  • specified profiling mode is not supported by the JVM of the profiled application, e.g. tracing is supported with Java 5 and newer and thus is not available with Java 1.4.
  • profiled application has terminated
  • agent cannot capture snapshot for some reason
See Also:
captureSnapshot(long), stopCPUProfiling()

stopCPUProfiling

void stopCPUProfiling()
                      throws Exception
Stop CPU profiling.

Throws:
Exception - if capture failed. The possible reasons are:
  • there's no Java application with properly configured profiler agent listening on port at host
  • profiled application has terminated
  • agent cannot capture snapshot for some reason
See Also:
captureSnapshot(long), startCPUProfiling(long , String)

forceGC

String forceGC()
               throws Exception
Force GC

Returns:
Message contains size of objects in heap before GC, bytes and size of objects in heap after GC, bytes
Throws:
Exception

startMonitorProfiling

void startMonitorProfiling()
                           throws Exception
Start monitor profiling (requires that the profiled application runs on Java 5 or newer)

Throws:
Exception - if capture failed. The possible reasons are:
  • there's no Java application with properly configured profiler agent listening on port at host
  • specified profiling mode is not supported by the JVM of the profiled application, e.g. tracing is supported with Java 5 and newer and thus is not available with Java 1.4.
  • CPU profiling has already been started
  • profiled application has terminated
  • agent cannot capture snapshot for some reason
See Also:
stopMonitorProfiling(), captureSnapshot(long)

stopMonitorProfiling

void stopMonitorProfiling()
                          throws Exception
Stop monitor profiling (requires that the profiled application runs on Java 5 or newer)

Throws:
Exception - if capture failed. The possible reasons are:
  • there's no Java application with properly configured profiler agent listening on port at host
  • profiled application has terminated
  • agent cannot capture snapshot for some reason
See Also:
startMonitorProfiling(), captureSnapshot(long)

startCapturingMemSnapshot

void startCapturingMemSnapshot(int seconds)
Starts new daemon thread which calls captureMemorySnapshot() every N seconds.

Parameters:
seconds - delay between calls
See Also:
captureMemorySnapshot()

stopCapturingMemSnapshot

void stopCapturingMemSnapshot()
Stops daemon thread started by startCapturingMemSnapshot(int)

See Also:
startCapturingMemSnapshot (int)

getStatus

long getStatus()
               throws Exception
Get current profiling status. The following code snippet demonstrates how to use this method:
 long status = controller.getStatus();
 

if ((status & YourKitProfilerServiceMBean.ALLOCATION_RECORDING_ADAPTIVE) != 0) { System.out.println("Allocation recording is on (adaptive)"); } else if ((status & YourKitProfilerServiceMBean.ALLOCATION_RECORDING_ALL) != 0) { System.out.println("Allocation recording is on (all objects)"); } else { System.out.println("Allocation recording is off"); }

if ((status & YourKitProfilerServiceMBean.CPU_TRACING) != 0) { System.out.println("CPU profiling is on (tracing)"); } else if ((status & YourKitProfilerServiceMBean.CPU_SAMPLING) != 0) { System.out.println("CPU profiling is on (sampling)"); } else { System.out.println("CPU profiling is off"); }

if ((status & YourKitProfilerServiceMBean.MONITOR_PROFILING) != 0) { System.out.println("Monitor profiling is on"); } else { System.out.println("Monitor profiling is off"); } if ((status & YourKitProfilerServiceMBean.SNAPSHOT_CAPTURING) != 0) { System.out.println("Snaphot capturing is on"); } else { System.out.println("Snaphot capturing is off"); }

Returns:
a bit mask to check against Profiling Modes
Throws:
Exception


Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.