Controller API
A resource document of the JProfiler MCP server. Back to the tool and resource reference.
For agent consumption, this page is also available as raw Markdown.
Content of the MCP resource jprofiler://api/controller of the JProfiler MCP server, see the tool and resource reference for the full list of tools and resources.
API reference of com.jprofiler.api.controller: the Controller class lets the profiled application
drive profiling itself - start and stop recordings, save snapshots, take heap dumps, mark the heap and
add bookmarks from application code. All methods are no-ops without overhead when the JProfiler agent is
not present, so the calls can stay in the code permanently.
This is complementary to recording driven by this server: recordingConfig of prepare_profiling/attach
and its triggers cover recording on a schedule or on agent-observed events. The Controller API is for
conditions only the application can see - for example saving a snapshot when a rare error occurs, or
bracketing a benchmark with startCPURecording/stopCPURecording and saveSnapshot. The saved snapshots are
then analyzed with load_snapshot.
Build setup: Maven artifact com.jprofiler:jprofiler-controller:<version> (provided scope suffices,
the agent wires the calls) or api/jprofiler-controller.jar of a JProfiler installation. The
jpcontroller command line executable and the JProfiler MBean expose the same functionality for
interactive and remote use without code changes.
Types
Flat alphabetical index of every type in the API. Use this when you know the qualified name and want to skip package navigation.
| Qualified name | Kind | File |
|---|---|---|
com.jprofiler.api.controller.Controller | class | Controller |
com.jprofiler.api.controller.HeapDumpOptions | class | HeapDumpOptions |
com.jprofiler.api.controller.ProbeObjectType | enum | ProbeObjectType |
com.jprofiler.api.controller.ProbeRecordingOptions | class | ProbeRecordingOptions |
com.jprofiler.api.controller.ProbeValueType | enum | ProbeValueType |
com.jprofiler.api.controller.TrackingOptions | class | TrackingOptions |
Package com.jprofiler.api.controller
Contains the controller class for programmatically controlling the recording of profiling data.
The Controller class contains further information.
License
Classes in this package and its sub-packages are licensed under the Apache License, version 2.0.
Controller
Import: import com.jprofiler.api.controller.Controller;
public class Controller
Use this class to influence the run time behaviour of JProfiler.
Overhead
When executing your application without JProfiler, all calls into this class will quietly do nothing without any overhead, because the implementations of the methods are empty. When the JProfiler agent is present, these methods will be instrumented and wired up with the agent.
Interactive use
If you would like to access the functionality in this class from the command line, use the
jpcontroller command line executable that attaches to the JProfiler MBean which is registered
for every profiled application. For more information, invoke jpcontroller -help.
Offline profiling
While you can use the controller during interactive profiling sessions, it is most useful for offline profiling. "Offline" refers to the fact that the JProfiler GUI does not have to be connected to the profiled process while profiling data is being recorded and snapshots are saved.
Please read the "Offline profiling" chapter in the documentation (directory $JPROFILER_HOME/doc) for an
overview on how to use the Controller API and consult the javadoc for Controller.
The $JPROFILER_HOME/api/samples/offline example project shows how to perform offline profiling.
Open the gradle build file build.gradle in an editor for instructions on how to run it.
JAR file and dependency
All classes in this package are contained in $JPROFILER_HOME/api/jprofiler-controller.jar.
The controller API is also available as a dependency. In the snippets below, "VERSION"
should be replaced with the corresponding JProfiler version.
Maven
<dependency>
<groupId>com.jprofiler</groupId>
<artifactId>jprofiler-controller</artifactId>
<version>VERSION</version>
</dependency>
Gradle
dependencies {
classpath group: 'com.jprofiler', name: 'jprofiler-controller', version: 'VERSION'
}
Shading
If this API is relocated, set -Djprofiler.controllerPackage to the relocated package name.
Methods
| Signature | Returns | Description |
|---|---|---|
startCPURecording(boolean) | void | Starts recording CPU data. |
startCPURecording(boolean, TrackingOptions) | void | Starts recording CPU data. |
stopCPURecording() | void | Stops CPU recording. |
startProbeRecording(String, boolean) | void | Start recording data for a selected probe. |
startProbeRecording(String, ProbeRecordingOptions) | void | Start recording data for a selected probe. |
stopProbeRecording(String) | void | Stop recording data for a selected probe. |
startProbeTracking(String, String[], ProbeObjectType, ProbeValueType) | void | Start tracking selected elements for a selected probe. |
stopProbeTracking(String, String[], ProbeObjectType, ProbeValueType) | void | Stop tracking selected elements for a selected probe. |
startComplexityRecording() | void | Starts algorithmic complexity recording for all previously configured methods. |
stopComplexityRecording() | void | Stops algorithmic complexity recording and prepares data for snapshot. |
startCallTracer(int, boolean, boolean) | void | Starts the call tracer. |
stopCallTracer() | void | Stops the call tracer. |
startMonitorRecording() | void | Start recording of monitor usage with default thresholds of 100 microseconds for blocking events and 100 ms for waiting events. |
startMonitorRecording(int, int) | void | Start recording of monitor usage. |
stopMonitorRecording() | void | Stop recording of monitor usage. |
startAllocRecording(boolean) | void | Starts recording of memory allocations. |
startAllocRecording(boolean, TrackingOptions) | void | Starts recording of memory allocations. |
stopAllocRecording() | void | Stops recording of memory allocations. |
addBookmark(String) | void | Adds a bookmark at the current time. |
addBookmark(String, int, boolean) | void | Add a bookmark at the current time. |
triggerThreadDump(boolean) | void | Trigger a thread dump. |
triggerThreadDump(boolean, String) | void | Trigger a thread dump with an optional label for identification. |
triggerAllObjectsDump() | void | Triggers a dump of all objects on the heap to be displayed in the "All objects" view. |
triggerAllObjectsDump(String) | void | Triggers a dump of all objects on the heap to be displayed in the "All objects" view with an optional label for identification. |
triggerMonitorDump() | void | Trigger a dump of current monitors and locks. |
triggerHeapDump() | void | Trigger a heap dump. |
triggerHeapDump(HeapDumpOptions) | void | Trigger a heap dump with the specified heap dump options. |
markHeap() | void | Mark all objects currently on the heap as "old". |
saveSnapshot(File) | void | Saves a snapshot of all profiling data to disk. |
startThreadProfiling() | void | Starts recording of thread states and monitor usage. |
stopThreadProfiling() | void | Stops recording of thread states and monitor usage. |
startVMTelemetryRecording() | void | Starts recording of VM telemetry data. |
stopVMTelemetryRecording() | void | Stops recording of VM telemetry data. |
saveSnapshotOnExit(File) | void | Saves a snapshot of all profiling data to disk when the VM shuts down. |
enableTriggerGroup(boolean, String) | void | Enable or disable all triggers with a specified group ID. |
enableTriggers(boolean) | void | Enable or disable all triggers. |
triggerMBeanSnapshot(String, String) | void | Triggers an MBean snapshot with an optional label. |
##### startCPURecording(boolean)
public static void startCPURecording(boolean reset)
Starts recording CPU data.
This method can be called repeatedly and alternatingly with
stopCPURecording(). With these methods you can restrict
CPU profiling to certain regions of your code.
Parameters:
reset— iftrueand cpu recording is currently switched off, any previously accumulated CPU profiling data will be discarded. Iffalse, CPU data will be accumulated across pairs of invocations ofstartCPURecording()andstopCPURecording().
##### startCPURecording(boolean, TrackingOptions)
public static void startCPURecording(boolean reset, TrackingOptions trackingOptions)
Starts recording CPU data.
This method can be called repeatedly and alternatingly with
stopCPURecording(). With these methods you can restrict
CPU profiling to certain regions of your code.
Parameters:
reset— iftrueand cpu recording is currently switched off, any previously accumulated CPU profiling data will be discarded. Iffalse, CPU data will be accumulated across pairs of invocations ofstartCPURecording()andstopCPURecording().trackingOptions— the request tracking options ornullfor the previous state
public static void stopCPURecording()
Stops CPU recording.
This method can be called after startCPURecording() has been called.
However, you do not have to call it since CPU profiling can run until the
JVM exits.
##### startProbeRecording(String, boolean)
public static void startProbeRecording(String probeName, boolean events)
Start recording data for a selected probe. For more information and a more general signature see
Controller.startProbeRecording.
##### startProbeRecording(String, ProbeRecordingOptions)
public static void startProbeRecording(String probeName, ProbeRecordingOptions recordingOptions)
Start recording data for a selected probe.
Parameters:
probeName— the name of the probe. For built-in probes, see thePROBE_NAMEconstants in this class. For embedded and injected probes, the class name of the probe is used. For script probes, this name isscript.nwhere n is the one-based index of the script probe.recordingOptions— determines whether special recordings for the probe should be switched on
See also:
##### stopProbeRecording(String)
public static void stopProbeRecording(String probeName)
Stop recording data for a selected probe.
Parameters:
probeName— the name of the probe. For built-in probes, see thePROBE_NAMEconstants in this class. For embedded and injected probes, the class name of the probe is used. For script probes, this name isscript.nwhere n is the one-based index of the script probe.
See also:
##### startProbeTracking(String, String[], ProbeObjectType, ProbeValueType)
public static void startProbeTracking(String probeName, String[] descriptions, ProbeObjectType objectType, ProbeValueType valueType)
Start tracking selected elements for a selected probe. Probe recording must be switched on for the selected probe otherwise this method does not have any effect.
Parameters:
probeName— the name of the probe. For built-in probes, see thePROBE_NAMEconstants in this class. For embedded and injected probes, the class name of the probe is used. For script probes, this name isscript.nwhere n is the one-based index of the script probe.descriptions— the descriptions of the tracked elements. These are the strings that you see in the probe view in the JProfiler GUI. The sum of the selected elements will be tracked in a single graph. To get separate graphs, call this method multiple times.objectType— the type of the elements to be trackedvalueType— the type of the values to be tracked
##### stopProbeTracking(String, String[], ProbeObjectType, ProbeValueType)
public static void stopProbeTracking(String probeName, String[] description, ProbeObjectType objectType, ProbeValueType valueType)
Stop tracking selected elements for a selected probe. This only has an effect if
Controller.startProbeTracking has been called before.
Parameters:
probeName— the name of the probe. For built-in probes, see thePROBE_NAMEconstants in this class. For embedded and injected probes, the class name of the probe is used. For script probes, this name isscript.nwhere n is the one-based index of the script probe.description— the descriptions of the tracked elementsobjectType— the type of the elements to be trackedvalueType— the type of the values to be tracked
##### startComplexityRecording()
public static void startComplexityRecording()
Starts algorithmic complexity recording for all previously configured methods.
##### stopComplexityRecording()
public static void stopComplexityRecording()
Stops algorithmic complexity recording and prepares data for snapshot.
##### startCallTracer(int, boolean, boolean)
public static void startCallTracer(int cap, boolean recordFiltered, boolean reset)
Starts the call tracer.
This method can be called repeatedly and alternatingly with
stopCallTracer().
Parameters:
recordFiltered— iftrue, calls into filtered classes will be recorded, too.cap— the maximum number of events to be recorded. A good default is 100000.reset— iftruepreviously recorded calls will be cleared.
public static void stopCallTracer()
Stops the call tracer.
This method can be called after startCallTracer() has been called.
However, you do not have to call it since the call tracer will stop automatically
after the cap has been reached. The data will be delivered to the frontend afterwards
if used in online mode.
public static void startMonitorRecording()
Start recording of monitor usage with default thresholds of 100 microseconds
for blocking events and 100 ms for waiting events.
This method can be called repeatedly and alternatingly with
stopMonitorRecording(). Monitor profiling is switched off
by default.
##### startMonitorRecording(int, int)
public static void startMonitorRecording(int blockingThreshold, int waitingThreshold)
Start recording of monitor usage.
This method can be called repeatedly and alternatingly with
stopMonitorRecording(). Monitor profiling is switched off
by default.
Parameters:
blockingThreshold— the recording threshold for blocking events in microseconds.waitingThreshold— the recording threshold for waiting events in microseconds.
public static void stopMonitorRecording()
Stop recording of monitor usage.
This method can be called repeatedly and alternatingly with
startMonitorRecording(). However, you do not have to call it since
monitor profiling can run until the JVM exits.
##### startAllocRecording(boolean)
public static void startAllocRecording(boolean reset)
Starts recording of memory allocations.
This method can be called repeatedly and alternatingly with
stopAllocRecording(). With these methods you can restrict
memory allocation profiling to certain regions of your code.
This is especially useful for profiling an application running within
an application server.
Parameters:
reset— iftrueand allocation recording is currently switched off, any previously recorded profiling data will be discarded. Iffalse, allocations within all pairs of invocations ofstartAllocRecording()andstopAllocRecording()will be recorded.
##### startAllocRecording(boolean, TrackingOptions)
public static void startAllocRecording(boolean reset, TrackingOptions trackingOptions)
Starts recording of memory allocations.
This method can be called repeatedly and alternatingly with
stopAllocRecording(). With these methods you can restrict
memory allocation profiling to certain regions of your code.
This is especially useful for profiling an application running within
an application server.
Parameters:
reset— iftrueand allocation recording is currently switched off, any previously recorded profiling data will be discarded. Iffalse, allocations within all pairs of invocations ofstartAllocRecording()andstopAllocRecording()will be recorded.trackingOptions— the request tracking options
public static void stopAllocRecording()
Stops recording of memory allocations.
This method can be called after startAllocRecording() has been called.
However, you do not have to call it since memory profiling can run until the
JVM exits.
public static void addBookmark(String description)
Adds a bookmark at the current time. The bookmark will be displayed in all JProfiler graphs with a time axis. The description will be displayed in the tooltip for the bookmark.
Parameters:
description— the name of the bookmark, may also benull
##### addBookmark(String, int, boolean)
public static void addBookmark(String description, int color, boolean dashed)
Add a bookmark at the current time. The bookmark will be displayed in all JProfiler graphs with a time axis. The description will be displayed in the tooltip for the bookmark.
Parameters:
description— the name of the bookmark, may also benullcolor— the RGB color to be used for drawing the bookmark, for example0xFF0000.dashed— if the line for drawing the bookmark should be dashed or not
##### triggerThreadDump(boolean)
public static void triggerThreadDump(boolean includeVirtualThreads)
Trigger a thread dump.
Parameters:
includeVirtualThreads— iftrue, virtual threads will be included. The thread dump won't be synchronized in this case.
##### triggerThreadDump(boolean, String)
public static void triggerThreadDump(boolean includeVirtualThreads, String label)
Trigger a thread dump with an optional label for identification.
Parameters:
includeVirtualThreads— iftrue, virtual threads will be included. The thread dump won't be synchronized in this case.label— A string parameter used to label the dump. Can be null.
public static void triggerAllObjectsDump()
Triggers a dump of all objects on the heap to be displayed in the "All objects" view.
##### triggerAllObjectsDump(String)
public static void triggerAllObjectsDump(String label)
Triggers a dump of all objects on the heap to be displayed in the "All objects" view with an optional label for identification.
Parameters:
label— A string parameter used to label the dump. Can be null.
public static void triggerMonitorDump()
Trigger a dump of current monitors and locks.
public static void triggerHeapDump()
Trigger a heap dump.
Calls triggerHeapDump(HeapDumpOptions.DEFAULT).
See also:
##### triggerHeapDump(HeapDumpOptions)
public static void triggerHeapDump(HeapDumpOptions heapDumpOptions)
Trigger a heap dump with the specified heap dump options.
If you want to analyze a heap dump with the heap walker in a snapshot saved with
the saveSnapshot method, you should call this method from your source code
at an appropriate time.
ATTENTION: Taking a heap dump takes a long time (on the order of seconds). If you call this method too often, your application might become unusable or take an excessively long time to finish.
Parameters:
heapDumpOptions— the options for the heap dump
public static void markHeap()
Mark all objects currently on the heap as "old". In the next heap dump, you can then distinguish between objects created before and after this method was called. This action has much less overhead than a full heap dump.
public static void saveSnapshot(File file)
Saves a snapshot of all profiling data to disk.
This is especially important for offline profiling.
You should choose the standard extension .jps for the
file parameter, since JProfiler's GUI frontend filters the corresponding
file choosers for that extension. If you want to save several snapshots during
one profiling run, take care to provide unique file parameters
since snapshot files will be overwritten otherwise.
ATTENTION: Saving a snapshot takes a long time (on the order of seconds). If you call this method too often, your application might become unusable or take an excessively long time to finish, and your hard disk might run out of space.
Parameters:
file— the file to which the snapshot should be saved.
public static void startThreadProfiling()
Starts recording of thread states and monitor usage.
This method can be called repeatedly and alternatingly with
stopThreadProfiling(). For an offline session, thread
profiling is switched on by default.
public static void stopThreadProfiling()
Stops recording of thread states and monitor usage.
This method can be called repeatedly and alternatingly with
startThreadProfiling(). However, you do not have to call it since
thread profiling can run until the JVM exits.
##### startVMTelemetryRecording()
public static void startVMTelemetryRecording()
Starts recording of VM telemetry data.
This method can be called repeatedly and alternatingly with
stopVMTelemetryRecording(). For an offline session, VM telemetry
recording is switched on by default.
##### stopVMTelemetryRecording()
public static void stopVMTelemetryRecording()
Stops recording of VM telemetry data.
This method can be called repeatedly and alternatingly with
startVMTelemetryRecording(). However, you do not have to call it since
VM telemetry recording can run until the JVM exits.
##### saveSnapshotOnExit(File)
public static void saveSnapshotOnExit(File file)
Saves a snapshot of all profiling data to disk when the VM shuts down.
This is especially important for offline profiling.
You should choose the standard extension .jps for the
file parameter, since JProfiler's GUI frontend filters the corresponding
file choosers for that extension.
ATTENTION: Saving a snapshot can take quite some time (on the order of 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.
Parameters:
file— the file to which the snapshot should be saved.
##### enableTriggerGroup(boolean, String)
public static void enableTriggerGroup(boolean enabled, String groupId) throws IllegalArgumentException
Enable or disable all triggers with a specified group ID. The group ID can be entered in the "Group ID" step of the trigger configuration wizard in the JProfiler GUI.
Parameters:
enabled— if the triggers should be enabledgroupId— the group ID
Throws:
IllegalArgumentException— if no trigger with the specified group ID exists
public static void enableTriggers(boolean enabled)
Enable or disable all triggers. The enabled/disabled state of the single triggers will not be lost, disabling all triggers with this method overrides the enabled/disabled state of the single triggers.
Parameters:
enabled— if the triggers should be enabled
##### triggerMBeanSnapshot(String, String)
public static void triggerMBeanSnapshot(String label, String regexp)
Triggers an MBean snapshot with an optional label. The recorded MBeans can be optionally filtered with a regular expression.
Parameters:
label— An optional label for the snapshot. Can be null.regexp— An optional regular expression for filtering MBeans based on the canonical name. Can be null.
Fields
| Field | Type | Description |
|---|---|---|
| PROBE_NAME_PERSISTENCE | String | Name of the built-in persistence probe. |
| PROBE_NAME_JDBC | String | Name of the built-in JDBC probe. |
| PROBE_NAME_JMS | String | Name of the built-in JMS probe. |
| PROBE_NAME_JNDI | String | Name of the built-in JNDI probe. |
| PROBE_NAME_MONGO_DB | String | Name of the built-in MongoDB probe. |
| PROBE_NAME_CASSANDRA | String | Name of the built-in Cassandra probe. |
| PROBE_NAME_HTTP_CLIENT | String | Name of the built-in HTTP client probe. |
| PROBE_NAME_RMI | String | Name of the built-in RMI probe. |
| PROBE_NAME_GRPC | String | Name of the built-in gRPC probe. |
| PROBE_NAME_AI | String | Name of the built-in AI probe. |
| PROBE_NAME_KAFKA_PRODUCER | String | Name of the built-in Apache Kafka producer probe. |
| PROBE_NAME_KAFKA_CONSUMER | String | Name of the built-in Apache Kafka consumer probe. |
| PROBE_NAME_WS | String | Name of the built-in web service probe. |
| PROBE_NAME_HTTP_SERVER | String | Name of the built-in http server probe. |
| PROBE_NAME_FILE | String | Name of the built-in file probe. |
| PROBE_NAME_SOCKET | String | Name of the built-in socket probe. |
| PROBE_NAME_PROCESS | String | Name of the built-in process probe. |
| PROBE_NAME_CLASS_LOADER | String | Name of the built-in class loader probe. |
| PROBE_NAME_EXCEPTION | String | Name of the built-in Exception probe. |
| PROBE_NAME_GC | String | Name of the built-in GC probe. |
| PROBE_NAME_ALL_CUSTOM | String | Identifier for all custom probes. |
public static final String PROBE_NAME_PERSISTENCE = "builtin.PersistenceProbe"
Name of the built-in persistence probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.
public static final String PROBE_NAME_JDBC = "builtin.JdbcProbe"
Name of the built-in JDBC probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.
public static final String PROBE_NAME_JMS = "builtin.JmsProbe"
Name of the built-in JMS probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.
public static final String PROBE_NAME_JNDI = "builtin.JndiProbe"
Name of the built-in JNDI probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.
public static final String PROBE_NAME_MONGO_DB = "builtin.MongoDbProbe"
Name of the built-in MongoDB probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.
public static final String PROBE_NAME_CASSANDRA = "builtin.CassandraProbe"
Name of the built-in Cassandra probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.
public static final String PROBE_NAME_HTTP_CLIENT = "builtin.HttpClientProbe"
Name of the built-in HTTP client probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.
public static final String PROBE_NAME_RMI = "builtin.RmiProbe"
Name of the built-in RMI probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.
public static final String PROBE_NAME_GRPC = "builtin.GrpcProbe"
Name of the built-in gRPC probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.
public static final String PROBE_NAME_AI = "builtin.AiProbe"
Name of the built-in AI probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.
##### PROBE_NAME_KAFKA_PRODUCER
public static final String PROBE_NAME_KAFKA_PRODUCER = "builtin.KafkaProducerProbe"
Name of the built-in Apache Kafka producer probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.
##### PROBE_NAME_KAFKA_CONSUMER
public static final String PROBE_NAME_KAFKA_CONSUMER = "builtin.KafkaConsumerProbe"
Name of the built-in Apache Kafka consumer probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.
public static final String PROBE_NAME_WS = "builtin.WsProbe"
Name of the built-in web service probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.
public static final String PROBE_NAME_HTTP_SERVER = "builtin.HttpServerProbe"
Name of the built-in http server probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.
public static final String PROBE_NAME_FILE = "builtin.FileProbe"
Name of the built-in file probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.
public static final String PROBE_NAME_SOCKET = "builtin.SocketProbe"
Name of the built-in socket probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.
public static final String PROBE_NAME_PROCESS = "builtin.ProcessProbe"
Name of the built-in process probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.
public static final String PROBE_NAME_CLASS_LOADER = "builtin.ClassLoaderProbe"
Name of the built-in class loader probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.
public static final String PROBE_NAME_EXCEPTION = "builtin.ExceptionProbe"
Name of the built-in Exception probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.
public static final String PROBE_NAME_GC = "builtin.GCProbe"
Name of the built-in GC probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.
public static final String PROBE_NAME_ALL_CUSTOM = "builtin.AllCustom"
Identifier for all custom probes. If used in Controller.startProbeRecording and Controller.stopProbeRecording all
custom probes will be started or stopped.
HeapDumpOptions
Import: import com.jprofiler.api.controller.HeapDumpOptions;
public class HeapDumpOptions
Heap dump options for calling Controller.triggerHeapDump
The default values after constructing an instance of this class are equivalent to calling
heapDumpOptions.fullGc(true).primitiveData(true).calculateRetainedSizes(true).
On OpenJ9 VMs, primitive data is not recorded by default.
Methods
| Signature | Returns | Description |
|---|---|---|
fullGc(boolean) | HeapDumpOptions | Determines whether a full garbage collection should be performed for the heap dump. |
primitiveData(boolean) | HeapDumpOptions | Determines whether primitive data should be recorded for the heap dump. |
calculateRetainedSizes(boolean) | HeapDumpOptions | Determines whether retained sizes should be calculated for the heap dump. |
selectRecorded(boolean) | HeapDumpOptions | Determines whether recorded objects should be selected when the heap dump is opened in the JProfiler GUI. |
retainSoftReferences(boolean) | HeapDumpOptions | Determines whether soft references should be considered for full GC. |
retainWeakReferences(boolean) | HeapDumpOptions | Determines whether weak references should be considered for full GC. |
retainPhantomReferences(boolean) | HeapDumpOptions | Determines whether phantom references should be considered for full GC. |
retainFinalizerReferences(boolean) | HeapDumpOptions | Determines whether finalizer references should be considered for full GC. |
isFullGc() | boolean | Returns if a full garbage collection should be performed for the heap dump. |
isPrimitiveData() | boolean | Returns if primitive data should be recorded for the heap dump. |
isCalculateRetainedSizes() | boolean | Returns if retained sizes should be calculated for the heap dump. |
isSelectRecorded() | boolean | Returns if recorded objects should be selected when the heap dump is opened in the JProfiler GUI. |
isRetainSoftReferences() | boolean | Returns if soft references should retain objects in the heap dump if full GC is selected. |
isRetainWeakReferences() | boolean | Returns if weak references should retain objects in the heap dump if full GC is selected. |
isRetainPhantomReferences() | boolean | Returns if phantom references should retain objects in the heap dump if full GC is selected. |
isRetainFinalizerReferences() | boolean | Returns if finalizer references should retain objects in the heap dump if full GC is selected. |
freeze() | HeapDumpOptions | Make these heap dump options unmodifiable. |
public HeapDumpOptions fullGc(boolean fullGc)
Determines whether a full garbage collection should be performed for the heap dump.
The default is true.
Parameters:
fullGc— the new value
Returns: this instance
public HeapDumpOptions primitiveData(boolean primitiveData)
Determines whether primitive data should be recorded for the heap dump.
The default is true.
Parameters:
primitiveData— the new value
Returns: this instance
##### calculateRetainedSizes(boolean)
public HeapDumpOptions calculateRetainedSizes(boolean calculateRetainedSizes)
Determines whether retained sizes should be calculated for the heap dump.
The default is true.
Parameters:
calculateRetainedSizes— the new value
Returns: this instance
public HeapDumpOptions selectRecorded(boolean selectRecorded)
Determines whether recorded objects should be selected when the heap dump is opened in the JProfiler GUI.
The default value is false.
Parameters:
selectRecorded— the new value
Returns: this instance
##### retainSoftReferences(boolean)
public HeapDumpOptions retainSoftReferences(boolean retainSoftReferences)
Determines whether soft references should be considered for full GC. The default value is true.
To remove objects that are only held by soft references, call this method with the argument false.
Parameters:
retainSoftReferences— whether soft references should be retained in the heap dump
Returns: this instance
See also:
##### retainWeakReferences(boolean)
public HeapDumpOptions retainWeakReferences(boolean retainWeakReferences)
Determines whether weak references should be considered for full GC. The default value is false.
To retain objects that are only held by weak references, call this method with the argument true.
Parameters:
retainWeakReferences— whether weak references should be retained in the heap dump
Returns: this instance
See also:
##### retainPhantomReferences(boolean)
public HeapDumpOptions retainPhantomReferences(boolean retainPhantomReferences)
Determines whether phantom references should be considered for full GC. The default value is false.
To retain objects that are only held by phantom references, call this method with the argument true.
Parameters:
retainPhantomReferences— whether phantom references should be retained in the heap dump
Returns: this instance
See also:
##### retainFinalizerReferences(boolean)
public HeapDumpOptions retainFinalizerReferences(boolean retainFinalizerReferences)
Determines whether finalizer references should be considered for full GC. The default value is false.
To retain objects that are only held by finalizer references, call this method with the argument true.
Parameters:
retainFinalizerReferences— whether finalizer references should be retained in the heap dump
Returns: this instance
See also:
public boolean isFullGc()
Returns if a full garbage collection should be performed for the heap dump.
Returns: the value
public boolean isPrimitiveData()
Returns if primitive data should be recorded for the heap dump.
Returns: the value
##### isCalculateRetainedSizes()
public boolean isCalculateRetainedSizes()
Returns if retained sizes should be calculated for the heap dump.
Returns: the value
public boolean isSelectRecorded()
Returns if recorded objects should be selected when the heap dump is opened in the JProfiler GUI.
Returns: the value
##### isRetainSoftReferences()
public boolean isRetainSoftReferences()
Returns if soft references should retain objects in the heap dump if full GC is selected.
Returns: the value
See also:
##### isRetainWeakReferences()
public boolean isRetainWeakReferences()
Returns if weak references should retain objects in the heap dump if full GC is selected.
Returns: the value
See also:
##### isRetainPhantomReferences()
public boolean isRetainPhantomReferences()
Returns if phantom references should retain objects in the heap dump if full GC is selected.
Returns: the value
See also:
##### isRetainFinalizerReferences()
public boolean isRetainFinalizerReferences()
Returns if finalizer references should retain objects in the heap dump if full GC is selected.
Returns: the value
See also:
public HeapDumpOptions freeze()
Make these heap dump options unmodifiable. Further modification attempts will result in an
UnsupportedOperationException.
Returns: this instance
Constructors
| Signature | Description |
|---|---|
HeapDumpOptions() | Create a new instance with the default options described above. |
public HeapDumpOptions()
Create a new instance with the default options described above.
Fields
| Field | Type | Description |
|---|---|---|
| DEFAULT | HeapDumpOptions | The default value used by Controller.triggerHeapDump. |
| SELECT_RECORDED | HeapDumpOptions | Same as HeapDumpOptions.DEFAULT, only with selectRecorded(true). |
| NO_FULL_GC | HeapDumpOptions | Same as HeapDumpOptions.DEFAULT, only with fullGc(false). |
public static final HeapDumpOptions DEFAULT
The default value used by Controller.triggerHeapDump. This uses the default options described above.
public static final HeapDumpOptions SELECT_RECORDED
Same as HeapDumpOptions.DEFAULT, only with selectRecorded(true).
public static final HeapDumpOptions NO_FULL_GC
Same as HeapDumpOptions.DEFAULT, only with fullGc(false).
ProbeObjectType
Import: import com.jprofiler.api.controller.ProbeObjectType;
public final enum ProbeObjectType
Represents the type of elements to be tracked in probe tracking.
See also:
Constants
The descriptions parameter of the startProbeTracking
method will contain IDs of control objects.
##### CONTROL_OBJECT_FROM_DESCRIPTION
The descriptions parameter of the startProbeTracking
method will contain the names of control objects.
The descriptions parameter of the startProbeTracking
method will contain the names of hot spots.
Methods
| Signature | Returns | Description |
|---|---|---|
values() | ProbeObjectType[] | |
valueOf(String) | ProbeObjectType | |
toString() | String |
public static ProbeObjectType[] values()
public static ProbeObjectType valueOf(String name)
public String toString()
ProbeRecordingOptions
Import: import com.jprofiler.api.controller.ProbeRecordingOptions;
public class ProbeRecordingOptions
Special probe recording options for calling Controller.startProbeRecording.
The default values after constructing an instance of this class are all set to false.
Methods
| Signature | Returns | Description |
|---|---|---|
events(boolean) | ProbeRecordingOptions | Determines whether single events should be recorded for the "Events" view of the probe. |
connectionLeaks(boolean) | ProbeRecordingOptions | Determines whether connection leaks should be recorded for the JDBC probe. |
isEvents() | boolean | Returns if single events are recorded for the "Events" view of the probe. |
isConnectionLeaks() | boolean | Returns if connection leaks are recorded for the JDBC probe. |
freeze() | ProbeRecordingOptions | Make these recording options unmodifiable. |
public ProbeRecordingOptions events(boolean events)
Determines whether single events should be recorded for the "Events" view of the probe.
This setting has no effect when used with a probe that does not have an event view.
The default is false.
Parameters:
events— the new value
Returns: this instance
##### connectionLeaks(boolean)
public ProbeRecordingOptions connectionLeaks(boolean connectionLeaks)
Determines whether connection leaks should be recorded for the JDBC probe.
This setting has no effect when used with other probes.
The default is false.
Parameters:
connectionLeaks— the new value
Returns: this instance
public boolean isEvents()
Returns if single events are recorded for the "Events" view of the probe.
Returns: the value
public boolean isConnectionLeaks()
Returns if connection leaks are recorded for the JDBC probe.
Returns: the value
public ProbeRecordingOptions freeze()
Make these recording options unmodifiable. Further modification attempts will result in an
UnsupportedOperationException.
Returns: this instance
Constructors
| Signature | Description |
|---|---|
ProbeRecordingOptions() | Create a new instance with the default options described above. |
public ProbeRecordingOptions()
Create a new instance with the default options described above.
Fields
| Field | Type | Description |
|---|---|---|
| NONE | ProbeRecordingOptions | No special recordings are active. |
| EVENTS | ProbeRecordingOptions | Same as ProbeRecordingOptions.NONE, only with events(true). |
public static final ProbeRecordingOptions NONE
No special recordings are active. This is the same as constructing a new object without
calling any further methods.
public static final ProbeRecordingOptions EVENTS
Same as ProbeRecordingOptions.NONE, only with events(true).
ProbeValueType
Import: import com.jprofiler.api.controller.ProbeValueType;
public final enum ProbeValueType
Represents the types of values to be tracked in probe tracking.
See also:
Constants
The probe tracker will show a graph of average times.
The probe tracker will show a graph of average counts.
The probe tracker will show a graph of average throughputs.
Methods
| Signature | Returns | Description |
|---|---|---|
values() | ProbeValueType[] | |
valueOf(String) | ProbeValueType | |
toString() | String |
public static ProbeValueType[] values()
public static ProbeValueType valueOf(String name)
public String toString()
TrackingOptions
Import: import com.jprofiler.api.controller.TrackingOptions;
public class TrackingOptions
Request tracking options for calling Controller.startCPURecording and
Controller.startAllocRecording. See the help topic on request
tracking for more information.
After constructing an instance of this class, all request tracking options are set to false.
Methods
| Signature | Returns | Description |
|---|---|---|
platformThread(boolean) | TrackingOptions | Determines if platform thread start should be tracked. |
virtualThread(boolean) | TrackingOptions | Determines if virtual thread start should be tracked. |
executors(boolean) | TrackingOptions | Determines if executors should be tracked. |
awt(boolean) | TrackingOptions | Determines if AWT should be tracked. |
swt(boolean) | TrackingOptions | Determines if SWT should be tracked. |
rmi(boolean) | TrackingOptions | Determines if RMI should be tracked. |
grpc(boolean) | TrackingOptions | Determines if gRPC should be tracked. |
http(boolean) | TrackingOptions | Determines if http requests should be tracked. |
remoteEjb(boolean) | TrackingOptions | Determines if remote EJBs should be tracked. |
kotlinCoroutines(boolean) | TrackingOptions | Determines if kotlin coroutines should be tracked. |
isPlatformThread() | boolean | Returns if platform thread start is tracked. |
isVirtualThread() | boolean | Returns if virtual thread start is tracked. |
isExecutors() | boolean | Returns if executors are tracked. |
isAwt() | boolean | Returns if AWT is tracked. |
isSwt() | boolean | Returns if SWT is tracked. |
isRmi() | boolean | Returns if RMI is tracked. |
isGrpc() | boolean | Returns if gRPC is tracked. |
isHttp() | boolean | Returns if http requests are tracked. |
isRemoteEjb() | boolean | Returns if remote EJBs are tracked. |
isKotlinCoroutines() | boolean | Returns if kotlin coroutines are tracked. |
freeze() | TrackingOptions | Make these tracking options unmodifiable. |
public TrackingOptions platformThread(boolean threadStart)
Determines if platform thread start should be tracked.
Parameters:
threadStart— the new value
Returns: this instance
public TrackingOptions virtualThread(boolean threadStart)
Determines if virtual thread start should be tracked.
Parameters:
threadStart— the new value
Returns: this instance
public TrackingOptions executors(boolean executors)
Determines if executors should be tracked.
Parameters:
executors— the new value
Returns: this instance
public TrackingOptions awt(boolean awt)
Determines if AWT should be tracked.
Parameters:
awt— the new value
Returns: this instance
public TrackingOptions swt(boolean swt)
Determines if SWT should be tracked.
Parameters:
swt— the new value
Returns: this instance
public TrackingOptions rmi(boolean rmi)
Determines if RMI should be tracked.
Parameters:
rmi— the new value
Returns: this instance
public TrackingOptions grpc(boolean grpc)
Determines if gRPC should be tracked.
Parameters:
grpc— the new value
Returns: this instance
public TrackingOptions http(boolean http)
Determines if http requests should be tracked.
Parameters:
http— the new value
Returns: this instance
public TrackingOptions remoteEjb(boolean remoteEjb)
Determines if remote EJBs should be tracked.
Parameters:
remoteEjb— the new value
Returns: this instance
##### kotlinCoroutines(boolean)
public TrackingOptions kotlinCoroutines(boolean kotlinCoroutines)
Determines if kotlin coroutines should be tracked.
Parameters:
kotlinCoroutines— the new value
Returns: this instance
public boolean isPlatformThread()
Returns if platform thread start is tracked.
Returns: the value
public boolean isVirtualThread()
Returns if virtual thread start is tracked.
Returns: the value
public boolean isExecutors()
Returns if executors are tracked.
Returns: the value
public boolean isAwt()
Returns if AWT is tracked.
Returns: the value
public boolean isSwt()
Returns if SWT is tracked.
Returns: the value
public boolean isRmi()
Returns if RMI is tracked.
Returns: the value
public boolean isGrpc()
Returns if gRPC is tracked.
Returns: the value
public boolean isHttp()
Returns if http requests are tracked.
Returns: the value
public boolean isRemoteEjb()
Returns if remote EJBs are tracked.
Returns: the value
public boolean isKotlinCoroutines()
Returns if kotlin coroutines are tracked.
Returns: the value
public TrackingOptions freeze()
Make these tracking options unmodifiable. Further modification attempts will result in an
UnsupportedOperationException.
Returns: this instance
Constructors
| Signature | Description |
|---|---|
TrackingOptions() | Create a new instance with no tracking types enabled. |
public TrackingOptions()
Create a new instance with no tracking types enabled.
Fields
| Field | Type | Description |
|---|---|---|
| NONE | TrackingOptions | No request tracking types are enabled. |
| PLATFORM_THREAD | TrackingOptions | Only track platform thread start, same as new TrackingOptions().platformThreadStart(true). |
| EXECUTORS | TrackingOptions | Only track executors, same as new TrackingOptions().executors(true). |
| AWT | TrackingOptions | Only track AWT, same as new TrackingOptions().awt(true). |
| SWT | TrackingOptions | Only track SWT, same as new TrackingOptions().swt(true). |
| RMI | TrackingOptions | Only track RMI, same as new TrackingOptions().rmi(true). |
| GRPC | TrackingOptions | Only track gRPC, same as new TrackingOptions().grpc(true). |
| REMOTE_EJB | TrackingOptions | Only track remote EJBs, same as new TrackingOptions().remoteEjb(true). |
| HTTP | TrackingOptions | Only track http requests, same as new TrackingOptions().http(true). |
| KOTLIN_COROUTINES | TrackingOptions | Only track kotlin coroutines, same as new TrackingOptions().kotlinCoroutines(true). |
| VIRTUAL_THREAD | TrackingOptions | Only track virtual thread start, same as new TrackingOptions().virtualThread(true). |
public static final TrackingOptions NONE
No request tracking types are enabled. This is the same as constructing a new
object without calling any further methods.
public static final TrackingOptions PLATFORM_THREAD
Only track platform thread start, same as new TrackingOptions().platformThreadStart(true).
public static final TrackingOptions EXECUTORS
Only track executors, same as new TrackingOptions().executors(true).
public static final TrackingOptions AWT
Only track AWT, same as new TrackingOptions().awt(true).
public static final TrackingOptions SWT
Only track SWT, same as new TrackingOptions().swt(true).
public static final TrackingOptions RMI
Only track RMI, same as new TrackingOptions().rmi(true).
public static final TrackingOptions GRPC
Only track gRPC, same as new TrackingOptions().grpc(true).
public static final TrackingOptions REMOTE_EJB
Only track remote EJBs, same as new TrackingOptions().remoteEjb(true).
public static final TrackingOptions HTTP
Only track http requests, same as new TrackingOptions().http(true).
public static final TrackingOptions KOTLIN_COROUTINES
Only track kotlin coroutines, same as new TrackingOptions().kotlinCoroutines(true).
public static final TrackingOptions VIRTUAL_THREAD
Only track virtual thread start, same as new TrackingOptions().virtualThread(true).