java.lang.Objectcom.jprofiler.agent.Controller
public class Controller
This is JProfiler's profiling API. It is contained in bin/agent.jar in your JProfiler installation directory. Call these static methods from your source code to influence the run time behaviour of JProfiler.
When executing your application without JProfiler, all calls into this class will quietly do nothing.
| Nested Class Summary | |
|---|---|
static interface |
Controller.HTTPRequestResolver
Interface for mapping HTTP requests to strings that are displayed in the JProfiler GUI. |
static interface |
Controller.JMSResolver
Interface for mapping JMS messages to strings that are displayed in the JProfiler GUI. |
| Method Summary | |
|---|---|
static void |
addBookmark(java.lang.String description)
Add a bookmark at the current time. |
static void |
registerHTTPRequestResolver(Controller.HTTPRequestResolver resolver)
Register a resolver class that will map HTTP requests to description strings. |
static void |
registerJMSResolver(Controller.JMSResolver resolver)
Register a resolver class that will map JMS messages to description strings. |
static void |
saveSnapshot(java.io.File file)
Save a snapshot of all profiling data to disk. |
static void |
saveSnapshotOnExit(java.io.File file)
Save a snapshot of all profiling data to disk when the VM shuts down. |
static void |
startAllocRecording(boolean reset)
Start recording of memory allocations. |
static void |
startCPURecording(boolean reset)
Start recording CPU data. |
static void |
startThreadProfiling()
Start recording of thread states and monitor usage. |
static void |
startVMTelemetryRecording()
Start recording of VM telemetry data. |
static void |
stopAllocRecording()
Stop recording of memory allocations. |
static void |
stopCPURecording()
Stop CPU recording. |
static void |
stopThreadProfiling()
Stop recording of thread states and monitor usage. |
static void |
stopVMTelemetryRecording()
Stop recording of VM telemetry data. |
static void |
triggerHeapDump()
Trigger a heap dump. |
static void |
triggerHeapDump(boolean fullGc)
Trigger a heap dump. |
static void |
triggerHeapDump(boolean fullGc,
boolean onlyRecorded)
Trigger a heap dump. |
static void |
triggerHeapDump(boolean fullGc,
boolean onlyRecorded,
boolean primitiveData)
Trigger a heap dump. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void startCPURecording(boolean reset)
reset - if true, any previously accumulated CPU profiling
data will be discarded. If false, CPU data will be accumulated
accross pairs of invocations of startCPURecording() and
stopCPURecording().public static void stopCPURecording()
public static void startAllocRecording(boolean reset)
reset - if true, any previously recorded profiling
data will be discarded. If false, allocations within all
pairs of invocations of startAllocRecording() and
stopAllocRecording() will be recorded.public static void stopAllocRecording()
public static void addBookmark(java.lang.String description)
description - the name of the bookmark, may also be nullpublic static void triggerHeapDump()
public static void triggerHeapDump(boolean fullGc)
fullGc - if true, a full garbage collection will be performed.
public static void triggerHeapDump(boolean fullGc,
boolean onlyRecorded)
fullGc - if true, a full garbage collection will be performed.onlyRecorded - if true, only objects recorded between startAllocRecording and
stopAllocRecording will be inlucded in the dump.
public static void triggerHeapDump(boolean fullGc,
boolean onlyRecorded,
boolean primitiveData)
ATTENTION: Taking a heap dump takes a long time (on the order of seconds). If you call this method to often, your application might become unusable or take an excessively long time to finish.
fullGc - if true, a full garbage collection will be performed.onlyRecorded - if true, only objects recorded between startAllocRecording and
stopAllocRecording will be inlucded in the dump.primitiveData - if true, also primitive data will be recorded in JVMPI mode.public static void saveSnapshot(java.io.File file)
ATTENTION: Saving a snapshot takes a long time (on the order of seconds). If you call this method to often, your application might become unusable or take an excessively long time to finish, and your hard disk might run out of space.
file - the file to which the snapshot should be saved.public static void registerJMSResolver(Controller.JMSResolver resolver)
resolver - the resolver, null to restore the default behavior.public static void registerHTTPRequestResolver(Controller.HTTPRequestResolver resolver)
resolver - the resolver, null to restore the default behavior.public static void startThreadProfiling()
public static void stopThreadProfiling()
public static void startVMTelemetryRecording()
public static void stopVMTelemetryRecording()
public static void saveSnapshotOnExit(java.io.File file)
ATTENTION: Saving a snapshot can take quite some time (on the order fo seconds). When the VM is shut down during a user logout or a system shutdown, the OS may terminate the VM before saving is completed.
file - the file to which the snapshot should be saved.