Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mule.module.management.mbean
Class YourKitProfilerService

    java.lang.Object
      org.mule.module.management.mbean.YourKitProfilerService

All Implemented Interfaces:
  YourKitProfilerServiceMBean

    public class YourKitProfilerService

extends Object
implements YourKitProfilerServiceMBean

Field Summary
`protected Log` | `logger` logger used by this class

Fields inherited from interface org.mule.module.management.mbean.YourKitProfilerServiceMBean
`ALLOCATION_RECORDING_ADAPTIVE, ALLOCATION_RECORDING_ALL, CPU_J2EE, CPU_SAMPLING, CPU_TRACING, MONITOR_PROFILING, SNAPSHOT_CAPTURING, SNAPSHOT_HPROF, SNAPSHOT_WITH_HEAP, SNAPSHOT_WITHOUT_HEAP`

Constructor Summary
`YourKitProfilerService()`

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 `YourKitProfilerServiceMBean.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 `YourKitProfilerServiceMBean.startCapturingMemSnapshot(int)`
`void` | `stopCPUProfiling()` Stop CPU profiling.
`void` | `stopMonitorProfiling()` Stop monitor profiling (requires that the profiled application runs on Java 5 or newer)

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### logger

    protected transient Log logger

  logger used by this class

Constructor Detail

### YourKitProfilerService

    public YourKitProfilerService()
                           throws Exception

Throws:
  `Exception`

Method Detail

### getHost

    public String getHost()

  Specified by:
    `getHost` in interface `YourKitProfilerServiceMBean`
  Returns:
    name of host where controlled profiled application is running. The method never returns null.

### getPort

    public int getPort()

  Specified by:
    `getPort` in interface `YourKitProfilerServiceMBean`
  Returns:
    port profiler agent listens on.

### captureMemorySnapshot

    public String captureMemorySnapshot()
                                 throws Exception

  This method is just a convenient replacement of captureSnapshot(YourKitProfilerServiceMBean.SNAPSHOT_WITH_HEAP)

  Specified by:
    `captureMemorySnapshot` in interface `YourKitProfilerServiceMBean`
  Returns:
    absolute path to the captured snapshot.
  Throws:
    `Exception`

### captureSnapshot

    public String captureSnapshot(long snapshotFlags)
                           throws Exception

  Captures snapshot: write profiling information to file.

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

  Specified by:
    `captureSnapshot` in interface `YourKitProfilerServiceMBean`
  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

### startAllocationRecording

    public void startAllocationRecording(long mode)
                                  throws Exception

  Start object allocation recording.

  Specified by:
    `startAllocationRecording` in interface `YourKitProfilerServiceMBean`
  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:
    `YourKitProfilerServiceMBean.captureMemorySnapshot()`, `YourKitProfilerServiceMBean.stopCPUProfiling()`

### stopAllocationRecording

    public void stopAllocationRecording()
                                 throws Exception

  Specified by:
    `stopAllocationRecording` in interface `YourKitProfilerServiceMBean`
  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

    public void startCPUProfiling(long mode,
                                  String filters)
                           throws Exception

  Start CPU profiling.

  Specified by:
    `startCPUProfiling` in interface `YourKitProfilerServiceMBean`
  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:
    `YourKitProfilerServiceMBean.captureSnapshot(long)`, `YourKitProfilerServiceMBean.stopCPUProfiling()`

### stopCPUProfiling

    public void stopCPUProfiling()
                          throws Exception

  Stop CPU profiling.

  Specified by:
    `stopCPUProfiling` in interface `YourKitProfilerServiceMBean`
  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:
    `YourKitProfilerServiceMBean.captureSnapshot(long)`, `YourKitProfilerServiceMBean.startCPUProfiling(long , String)`

### startMonitorProfiling

    public void startMonitorProfiling()
                               throws Exception

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

  Specified by:
    `startMonitorProfiling` in interface `YourKitProfilerServiceMBean`
  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:
    `YourKitProfilerServiceMBean.stopMonitorProfiling()`, `YourKitProfilerServiceMBean.captureSnapshot(long)`

### stopMonitorProfiling

    public void stopMonitorProfiling()
                              throws Exception

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

  Specified by:
    `stopMonitorProfiling` in interface `YourKitProfilerServiceMBean`
  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:
    `YourKitProfilerServiceMBean.startMonitorProfiling()`, `YourKitProfilerServiceMBean.captureSnapshot(long)`

### advanceGeneration

    public 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.

  Specified by:
    `advanceGeneration` in interface `YourKitProfilerServiceMBean`
  Parameters:
    `description` - optional description associated with the generation

### forceGC

    public String forceGC()
                   throws Exception

  Force GC

  Specified by:
    `forceGC` in interface `YourKitProfilerServiceMBean`
  Returns:
    Message contains size of objects in heap before GC, bytes and size of objects in heap after GC, bytes
  Throws:
    `Exception`

### startCapturingMemSnapshot

    public void startCapturingMemSnapshot(int seconds)

  Starts new daemon thread which calls `YourKitProfilerServiceMBean.captureMemorySnapshot()` every N seconds.

  Specified by:
    `startCapturingMemSnapshot` in interface `YourKitProfilerServiceMBean`
  Parameters:
    `seconds` - delay between calls
  See Also:
    `YourKitProfilerServiceMBean.captureMemorySnapshot()`

### stopCapturingMemSnapshot

    public void stopCapturingMemSnapshot()

  Stops daemon thread started by `YourKitProfilerServiceMBean.startCapturingMemSnapshot(int)`

  Specified by:
    `stopCapturingMemSnapshot` in interface `YourKitProfilerServiceMBean`

### getStatus

    public 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");
       }

  `

  Specified by:
    `getStatus` in interface `YourKitProfilerServiceMBean`
  Returns:
    a bit mask to check against Profiling Modes
  Throws:
    `Exception`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.