public class YourKitProfilerService extends Object implements YourKitProfilerServiceMBean
Modifier and Type | Field and Description |
---|---|
protected Log |
logger
logger used by this class
|
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 and Description |
---|
YourKitProfilerService() |
Modifier and Type | Method and Description |
---|---|
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)
|
protected transient Log logger
public String getHost()
getHost
in interface YourKitProfilerServiceMBean
public int getPort()
getPort
in interface YourKitProfilerServiceMBean
public String captureMemorySnapshot() throws Exception
captureMemorySnapshot
in interface YourKitProfilerServiceMBean
Exception
public String captureSnapshot(long snapshotFlags) throws Exception
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()
.captureSnapshot
in interface YourKitProfilerServiceMBean
snapshotFlags
- defines how much information should be stored:
Exception
- if capture failed. The possible reasons are:
public void startAllocationRecording(long mode) throws Exception
startAllocationRecording
in interface YourKitProfilerServiceMBean
mode
- YourKitProfilerServiceMBean.ALLOCATION_RECORDING_ALL or
YourKitProfilerServiceMBean.ALLOCATION_RECORDING_ADAPTIVEException
- if capture failed. The possible reasons are:
YourKitProfilerServiceMBean.captureMemorySnapshot()
,
YourKitProfilerServiceMBean.stopCPUProfiling()
public void stopAllocationRecording() throws Exception
stopAllocationRecording
in interface YourKitProfilerServiceMBean
Exception
- if capture failed. The possible reasons are:
public void startCPUProfiling(long mode, String filters) throws Exception
startCPUProfiling
in interface YourKitProfilerServiceMBean
mode
- YourKitProfilerServiceMBean.CPU_SAMPLING or
YourKitProfilerServiceMBean.CPU_TRACING or
YourKitProfilerServiceMBean.CPU_SAMPLING |
YourKitProfilerServiceMBean.CPU_J2EE or
YourKitProfilerServiceMBean.CPU_TRACING |
YourKitProfilerServiceMBean.CPU_J2EEfilters
- 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.Exception
- if capture failed. The possible reasons are:
YourKitProfilerServiceMBean.captureSnapshot(long)
,
YourKitProfilerServiceMBean.stopCPUProfiling()
public void stopCPUProfiling() throws Exception
stopCPUProfiling
in interface YourKitProfilerServiceMBean
Exception
- if capture failed. The possible reasons are:
YourKitProfilerServiceMBean.captureSnapshot(long)
,
YourKitProfilerServiceMBean.startCPUProfiling(long , String)
public void startMonitorProfiling() throws Exception
startMonitorProfiling
in interface YourKitProfilerServiceMBean
Exception
- if capture failed. The possible reasons are:
YourKitProfilerServiceMBean.stopMonitorProfiling()
,
YourKitProfilerServiceMBean.captureSnapshot(long)
public void stopMonitorProfiling() throws Exception
stopMonitorProfiling
in interface YourKitProfilerServiceMBean
Exception
- if capture failed. The possible reasons are:
YourKitProfilerServiceMBean.startMonitorProfiling()
,
YourKitProfilerServiceMBean.captureSnapshot(long)
public void advanceGeneration(String description) throws Exception
advanceGeneration
in interface YourKitProfilerServiceMBean
description
- optional description associated with the generationException
- if generation could not be advanced.public String forceGC() throws Exception
forceGC
in interface YourKitProfilerServiceMBean
Exception
public void startCapturingMemSnapshot(int seconds)
YourKitProfilerServiceMBean.captureMemorySnapshot()
every N
seconds.startCapturingMemSnapshot
in interface YourKitProfilerServiceMBean
seconds
- delay between callsYourKitProfilerServiceMBean.captureMemorySnapshot()
public void stopCapturingMemSnapshot()
YourKitProfilerServiceMBean.startCapturingMemSnapshot(int)
stopCapturingMemSnapshot
in interface YourKitProfilerServiceMBean
public long getStatus() throws Exception
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");
}
getStatus
in interface YourKitProfilerServiceMBean
Exception
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.