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 nameKindFile
com.jprofiler.api.controller.ControllerclassController
com.jprofiler.api.controller.HeapDumpOptionsclassHeapDumpOptions
com.jprofiler.api.controller.ProbeObjectTypeenumProbeObjectType
com.jprofiler.api.controller.ProbeRecordingOptionsclassProbeRecordingOptions
com.jprofiler.api.controller.ProbeValueTypeenumProbeValueType
com.jprofiler.api.controller.TrackingOptionsclassTrackingOptions

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

SignatureReturnsDescription
startCPURecording(boolean)voidStarts recording CPU data.
startCPURecording(boolean, TrackingOptions)voidStarts recording CPU data.
stopCPURecording()voidStops CPU recording.
startProbeRecording(String, boolean)voidStart recording data for a selected probe.
startProbeRecording(String, ProbeRecordingOptions)voidStart recording data for a selected probe.
stopProbeRecording(String)voidStop recording data for a selected probe.
startProbeTracking(String, String[], ProbeObjectType, ProbeValueType)voidStart tracking selected elements for a selected probe.
stopProbeTracking(String, String[], ProbeObjectType, ProbeValueType)voidStop tracking selected elements for a selected probe.
startComplexityRecording()voidStarts algorithmic complexity recording for all previously configured methods.
stopComplexityRecording()voidStops algorithmic complexity recording and prepares data for snapshot.
startCallTracer(int, boolean, boolean)voidStarts the call tracer.
stopCallTracer()voidStops the call tracer.
startMonitorRecording()voidStart recording of monitor usage with default thresholds of 100 microseconds for blocking events and 100 ms for waiting events.
startMonitorRecording(int, int)voidStart recording of monitor usage.
stopMonitorRecording()voidStop recording of monitor usage.
startAllocRecording(boolean)voidStarts recording of memory allocations.
startAllocRecording(boolean, TrackingOptions)voidStarts recording of memory allocations.
stopAllocRecording()voidStops recording of memory allocations.
addBookmark(String)voidAdds a bookmark at the current time.
addBookmark(String, int, boolean)voidAdd a bookmark at the current time.
triggerThreadDump(boolean)voidTrigger a thread dump.
triggerThreadDump(boolean, String)voidTrigger a thread dump with an optional label for identification.
triggerAllObjectsDump()voidTriggers a dump of all objects on the heap to be displayed in the "All objects" view.
triggerAllObjectsDump(String)voidTriggers a dump of all objects on the heap to be displayed in the "All objects" view with an optional label for identification.
triggerMonitorDump()voidTrigger a dump of current monitors and locks.
triggerHeapDump()voidTrigger a heap dump.
triggerHeapDump(HeapDumpOptions)voidTrigger a heap dump with the specified heap dump options.
markHeap()voidMark all objects currently on the heap as "old".
saveSnapshot(File)voidSaves a snapshot of all profiling data to disk.
startThreadProfiling()voidStarts recording of thread states and monitor usage.
stopThreadProfiling()voidStops recording of thread states and monitor usage.
startVMTelemetryRecording()voidStarts recording of VM telemetry data.
stopVMTelemetryRecording()voidStops recording of VM telemetry data.
saveSnapshotOnExit(File)voidSaves a snapshot of all profiling data to disk when the VM shuts down.
enableTriggerGroup(boolean, String)voidEnable or disable all triggers with a specified group ID.
enableTriggers(boolean)voidEnable or disable all triggers.
triggerMBeanSnapshot(String, String)voidTriggers 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 — if true and cpu recording is currently switched off, any previously accumulated CPU profiling data will be discarded. If false, CPU data will be accumulated across pairs of invocations of startCPURecording() and stopCPURecording().

##### 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 — if true and cpu recording is currently switched off, any previously accumulated CPU profiling data will be discarded. If false, CPU data will be accumulated across pairs of invocations of startCPURecording() and stopCPURecording().
  • trackingOptions — the request tracking options or null for the previous state

##### stopCPURecording()

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 the PROBE_NAME constants in this class. For embedded and injected probes, the class name of the probe is used. For script probes, this name is script.n where 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 the PROBE_NAME constants in this class. For embedded and injected probes, the class name of the probe is used. For script probes, this name is script.n where 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 the PROBE_NAME constants in this class. For embedded and injected probes, the class name of the probe is used. For script probes, this name is script.n where 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 tracked
  • valueType — 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 the PROBE_NAME constants in this class. For embedded and injected probes, the class name of the probe is used. For script probes, this name is script.n where n is the one-based index of the script probe.
  • description — the descriptions of the tracked elements
  • objectType — the type of the elements to be tracked
  • valueType — 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 — if true, calls into filtered classes will be recorded, too.
  • cap — the maximum number of events to be recorded. A good default is 100000.
  • reset — if true previously recorded calls will be cleared.

##### stopCallTracer()

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.

##### startMonitorRecording()

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.

##### stopMonitorRecording()

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 — if true and allocation recording is currently switched off, any previously recorded profiling data will be discarded. If false, allocations within all pairs of invocations of startAllocRecording() and stopAllocRecording() 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 — if true and allocation recording is currently switched off, any previously recorded profiling data will be discarded. If false, allocations within all pairs of invocations of startAllocRecording() and stopAllocRecording() will be recorded.
  • trackingOptions — the request tracking options

##### stopAllocRecording()

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.

##### addBookmark(String)

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 be null

##### 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 be null
  • color — the RGB color to be used for drawing the bookmark, for example 0xFF0000.
  • 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 — if true, 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 — if true, 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.

##### triggerAllObjectsDump()

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.

##### triggerMonitorDump()

public static void triggerMonitorDump()

Trigger a dump of current monitors and locks.

##### triggerHeapDump()

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

##### markHeap()

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.

##### saveSnapshot(File)

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.

##### startThreadProfiling()

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.

##### stopThreadProfiling()

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 enabled
  • groupId — the group ID

Throws:

  • IllegalArgumentException — if no trigger with the specified group ID exists

##### enableTriggers(boolean)

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

FieldTypeDescription
PROBE_NAME_PERSISTENCEStringName of the built-in persistence probe.
PROBE_NAME_JDBCStringName of the built-in JDBC probe.
PROBE_NAME_JMSStringName of the built-in JMS probe.
PROBE_NAME_JNDIStringName of the built-in JNDI probe.
PROBE_NAME_MONGO_DBStringName of the built-in MongoDB probe.
PROBE_NAME_CASSANDRAStringName of the built-in Cassandra probe.
PROBE_NAME_HTTP_CLIENTStringName of the built-in HTTP client probe.
PROBE_NAME_RMIStringName of the built-in RMI probe.
PROBE_NAME_GRPCStringName of the built-in gRPC probe.
PROBE_NAME_AIStringName of the built-in AI probe.
PROBE_NAME_KAFKA_PRODUCERStringName of the built-in Apache Kafka producer probe.
PROBE_NAME_KAFKA_CONSUMERStringName of the built-in Apache Kafka consumer probe.
PROBE_NAME_WSStringName of the built-in web service probe.
PROBE_NAME_HTTP_SERVERStringName of the built-in http server probe.
PROBE_NAME_FILEStringName of the built-in file probe.
PROBE_NAME_SOCKETStringName of the built-in socket probe.
PROBE_NAME_PROCESSStringName of the built-in process probe.
PROBE_NAME_CLASS_LOADERStringName of the built-in class loader probe.
PROBE_NAME_EXCEPTIONStringName of the built-in Exception probe.
PROBE_NAME_GCStringName of the built-in GC probe.
PROBE_NAME_ALL_CUSTOMStringIdentifier for all custom probes.

##### PROBE_NAME_PERSISTENCE

public static final String PROBE_NAME_PERSISTENCE = "builtin.PersistenceProbe"

Name of the built-in persistence probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.

##### PROBE_NAME_JDBC

public static final String PROBE_NAME_JDBC = "builtin.JdbcProbe"

Name of the built-in JDBC probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.

##### PROBE_NAME_JMS

public static final String PROBE_NAME_JMS = "builtin.JmsProbe"

Name of the built-in JMS probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.

##### PROBE_NAME_JNDI

public static final String PROBE_NAME_JNDI = "builtin.JndiProbe"

Name of the built-in JNDI probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.

##### PROBE_NAME_MONGO_DB

public static final String PROBE_NAME_MONGO_DB = "builtin.MongoDbProbe"

Name of the built-in MongoDB probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.

##### PROBE_NAME_CASSANDRA

public static final String PROBE_NAME_CASSANDRA = "builtin.CassandraProbe"

Name of the built-in Cassandra probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.

##### PROBE_NAME_HTTP_CLIENT

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.

##### PROBE_NAME_RMI

public static final String PROBE_NAME_RMI = "builtin.RmiProbe"

Name of the built-in RMI probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.

##### PROBE_NAME_GRPC

public static final String PROBE_NAME_GRPC = "builtin.GrpcProbe"

Name of the built-in gRPC probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.

##### PROBE_NAME_AI

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.

##### PROBE_NAME_WS

public static final String PROBE_NAME_WS = "builtin.WsProbe"

Name of the built-in web service probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.

##### PROBE_NAME_HTTP_SERVER

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.

##### PROBE_NAME_FILE

public static final String PROBE_NAME_FILE = "builtin.FileProbe"

Name of the built-in file probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.

##### PROBE_NAME_SOCKET

public static final String PROBE_NAME_SOCKET = "builtin.SocketProbe"

Name of the built-in socket probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.

##### PROBE_NAME_PROCESS

public static final String PROBE_NAME_PROCESS = "builtin.ProcessProbe"

Name of the built-in process probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.

##### PROBE_NAME_CLASS_LOADER

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.

##### PROBE_NAME_EXCEPTION

public static final String PROBE_NAME_EXCEPTION = "builtin.ExceptionProbe"

Name of the built-in Exception probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.

##### PROBE_NAME_GC

public static final String PROBE_NAME_GC = "builtin.GCProbe"

Name of the built-in GC probe. Used in Controller.startProbeRecording and Controller.stopProbeRecording.

##### PROBE_NAME_ALL_CUSTOM

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

SignatureReturnsDescription
fullGc(boolean)HeapDumpOptionsDetermines whether a full garbage collection should be performed for the heap dump.
primitiveData(boolean)HeapDumpOptionsDetermines whether primitive data should be recorded for the heap dump.
calculateRetainedSizes(boolean)HeapDumpOptionsDetermines whether retained sizes should be calculated for the heap dump.
selectRecorded(boolean)HeapDumpOptionsDetermines whether recorded objects should be selected when the heap dump is opened in the JProfiler GUI.
retainSoftReferences(boolean)HeapDumpOptionsDetermines whether soft references should be considered for full GC.
retainWeakReferences(boolean)HeapDumpOptionsDetermines whether weak references should be considered for full GC.
retainPhantomReferences(boolean)HeapDumpOptionsDetermines whether phantom references should be considered for full GC.
retainFinalizerReferences(boolean)HeapDumpOptionsDetermines whether finalizer references should be considered for full GC.
isFullGc()booleanReturns if a full garbage collection should be performed for the heap dump.
isPrimitiveData()booleanReturns if primitive data should be recorded for the heap dump.
isCalculateRetainedSizes()booleanReturns if retained sizes should be calculated for the heap dump.
isSelectRecorded()booleanReturns if recorded objects should be selected when the heap dump is opened in the JProfiler GUI.
isRetainSoftReferences()booleanReturns if soft references should retain objects in the heap dump if full GC is selected.
isRetainWeakReferences()booleanReturns if weak references should retain objects in the heap dump if full GC is selected.
isRetainPhantomReferences()booleanReturns if phantom references should retain objects in the heap dump if full GC is selected.
isRetainFinalizerReferences()booleanReturns if finalizer references should retain objects in the heap dump if full GC is selected.
freeze()HeapDumpOptionsMake these heap dump options unmodifiable.

##### fullGc(boolean)

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

##### primitiveData(boolean)

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

##### selectRecorded(boolean)

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:

##### isFullGc()

public boolean isFullGc()

Returns if a full garbage collection should be performed for the heap dump.

Returns: the value

##### isPrimitiveData()

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

##### isSelectRecorded()

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:

##### freeze()

public HeapDumpOptions freeze()

Make these heap dump options unmodifiable. Further modification attempts will result in an UnsupportedOperationException.

Returns: this instance

Constructors

SignatureDescription
HeapDumpOptions()Create a new instance with the default options described above.

##### HeapDumpOptions()

public HeapDumpOptions()

Create a new instance with the default options described above.

Fields

FieldTypeDescription
DEFAULTHeapDumpOptionsThe default value used by Controller.triggerHeapDump.
SELECT_RECORDEDHeapDumpOptionsSame as HeapDumpOptions.DEFAULT, only with selectRecorded(true).
NO_FULL_GCHeapDumpOptionsSame as HeapDumpOptions.DEFAULT, only with fullGc(false).

##### DEFAULT

public static final HeapDumpOptions DEFAULT

The default value used by Controller.triggerHeapDump. This uses the default options described above.

##### SELECT_RECORDED

public static final HeapDumpOptions SELECT_RECORDED

Same as HeapDumpOptions.DEFAULT, only with selectRecorded(true).

##### NO_FULL_GC

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

##### CONTROL_OBJECT_FROM_ID

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.

##### HOTSPOT

The descriptions parameter of the startProbeTracking method will contain the names of hot spots.

Methods

SignatureReturnsDescription
values()ProbeObjectType[]
valueOf(String)ProbeObjectType
toString()String

##### values()

public static ProbeObjectType[] values()

##### valueOf(String)

public static ProbeObjectType valueOf(String name)

##### toString()

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

SignatureReturnsDescription
events(boolean)ProbeRecordingOptionsDetermines whether single events should be recorded for the "Events" view of the probe.
connectionLeaks(boolean)ProbeRecordingOptionsDetermines whether connection leaks should be recorded for the JDBC probe.
isEvents()booleanReturns if single events are recorded for the "Events" view of the probe.
isConnectionLeaks()booleanReturns if connection leaks are recorded for the JDBC probe.
freeze()ProbeRecordingOptionsMake these recording options unmodifiable.

##### events(boolean)

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

##### isEvents()

public boolean isEvents()

Returns if single events are recorded for the "Events" view of the probe.

Returns: the value

##### isConnectionLeaks()

public boolean isConnectionLeaks()

Returns if connection leaks are recorded for the JDBC probe.

Returns: the value

##### freeze()

public ProbeRecordingOptions freeze()

Make these recording options unmodifiable. Further modification attempts will result in an UnsupportedOperationException.

Returns: this instance

Constructors

SignatureDescription
ProbeRecordingOptions()Create a new instance with the default options described above.

##### ProbeRecordingOptions()

public ProbeRecordingOptions()

Create a new instance with the default options described above.

Fields

FieldTypeDescription
NONEProbeRecordingOptionsNo special recordings are active.
EVENTSProbeRecordingOptionsSame as ProbeRecordingOptions.NONE, only with events(true).

##### NONE

public static final ProbeRecordingOptions NONE

No special recordings are active. This is the same as constructing a new object without calling any further methods.

##### EVENTS

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

##### TIMES

The probe tracker will show a graph of average times.

##### COUNT

The probe tracker will show a graph of average counts.

##### THROUGHPUT

The probe tracker will show a graph of average throughputs.

Methods

SignatureReturnsDescription
values()ProbeValueType[]
valueOf(String)ProbeValueType
toString()String

##### values()

public static ProbeValueType[] values()

##### valueOf(String)

public static ProbeValueType valueOf(String name)

##### toString()

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

SignatureReturnsDescription
platformThread(boolean)TrackingOptionsDetermines if platform thread start should be tracked.
virtualThread(boolean)TrackingOptionsDetermines if virtual thread start should be tracked.
executors(boolean)TrackingOptionsDetermines if executors should be tracked.
awt(boolean)TrackingOptionsDetermines if AWT should be tracked.
swt(boolean)TrackingOptionsDetermines if SWT should be tracked.
rmi(boolean)TrackingOptionsDetermines if RMI should be tracked.
grpc(boolean)TrackingOptionsDetermines if gRPC should be tracked.
http(boolean)TrackingOptionsDetermines if http requests should be tracked.
remoteEjb(boolean)TrackingOptionsDetermines if remote EJBs should be tracked.
kotlinCoroutines(boolean)TrackingOptionsDetermines if kotlin coroutines should be tracked.
isPlatformThread()booleanReturns if platform thread start is tracked.
isVirtualThread()booleanReturns if virtual thread start is tracked.
isExecutors()booleanReturns if executors are tracked.
isAwt()booleanReturns if AWT is tracked.
isSwt()booleanReturns if SWT is tracked.
isRmi()booleanReturns if RMI is tracked.
isGrpc()booleanReturns if gRPC is tracked.
isHttp()booleanReturns if http requests are tracked.
isRemoteEjb()booleanReturns if remote EJBs are tracked.
isKotlinCoroutines()booleanReturns if kotlin coroutines are tracked.
freeze()TrackingOptionsMake these tracking options unmodifiable.

##### platformThread(boolean)

public TrackingOptions platformThread(boolean threadStart)

Determines if platform thread start should be tracked.

Parameters:

  • threadStart — the new value

Returns: this instance

##### virtualThread(boolean)

public TrackingOptions virtualThread(boolean threadStart)

Determines if virtual thread start should be tracked.

Parameters:

  • threadStart — the new value

Returns: this instance

##### executors(boolean)

public TrackingOptions executors(boolean executors)

Determines if executors should be tracked.

Parameters:

  • executors — the new value

Returns: this instance

##### awt(boolean)

public TrackingOptions awt(boolean awt)

Determines if AWT should be tracked.

Parameters:

  • awt — the new value

Returns: this instance

##### swt(boolean)

public TrackingOptions swt(boolean swt)

Determines if SWT should be tracked.

Parameters:

  • swt — the new value

Returns: this instance

##### rmi(boolean)

public TrackingOptions rmi(boolean rmi)

Determines if RMI should be tracked.

Parameters:

  • rmi — the new value

Returns: this instance

##### grpc(boolean)

public TrackingOptions grpc(boolean grpc)

Determines if gRPC should be tracked.

Parameters:

  • grpc — the new value

Returns: this instance

##### http(boolean)

public TrackingOptions http(boolean http)

Determines if http requests should be tracked.

Parameters:

  • http — the new value

Returns: this instance

##### remoteEjb(boolean)

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

##### isPlatformThread()

public boolean isPlatformThread()

Returns if platform thread start is tracked.

Returns: the value

##### isVirtualThread()

public boolean isVirtualThread()

Returns if virtual thread start is tracked.

Returns: the value

##### isExecutors()

public boolean isExecutors()

Returns if executors are tracked.

Returns: the value

##### isAwt()

public boolean isAwt()

Returns if AWT is tracked.

Returns: the value

##### isSwt()

public boolean isSwt()

Returns if SWT is tracked.

Returns: the value

##### isRmi()

public boolean isRmi()

Returns if RMI is tracked.

Returns: the value

##### isGrpc()

public boolean isGrpc()

Returns if gRPC is tracked.

Returns: the value

##### isHttp()

public boolean isHttp()

Returns if http requests are tracked.

Returns: the value

##### isRemoteEjb()

public boolean isRemoteEjb()

Returns if remote EJBs are tracked.

Returns: the value

##### isKotlinCoroutines()

public boolean isKotlinCoroutines()

Returns if kotlin coroutines are tracked.

Returns: the value

##### freeze()

public TrackingOptions freeze()

Make these tracking options unmodifiable. Further modification attempts will result in an UnsupportedOperationException.

Returns: this instance

Constructors

SignatureDescription
TrackingOptions()Create a new instance with no tracking types enabled.

##### TrackingOptions()

public TrackingOptions()

Create a new instance with no tracking types enabled.

Fields

FieldTypeDescription
NONETrackingOptionsNo request tracking types are enabled.
PLATFORM_THREADTrackingOptionsOnly track platform thread start, same as new TrackingOptions().platformThreadStart(true).
EXECUTORSTrackingOptionsOnly track executors, same as new TrackingOptions().executors(true).
AWTTrackingOptionsOnly track AWT, same as new TrackingOptions().awt(true).
SWTTrackingOptionsOnly track SWT, same as new TrackingOptions().swt(true).
RMITrackingOptionsOnly track RMI, same as new TrackingOptions().rmi(true).
GRPCTrackingOptionsOnly track gRPC, same as new TrackingOptions().grpc(true).
REMOTE_EJBTrackingOptionsOnly track remote EJBs, same as new TrackingOptions().remoteEjb(true).
HTTPTrackingOptionsOnly track http requests, same as new TrackingOptions().http(true).
KOTLIN_COROUTINESTrackingOptionsOnly track kotlin coroutines, same as new TrackingOptions().kotlinCoroutines(true).
VIRTUAL_THREADTrackingOptionsOnly track virtual thread start, same as new TrackingOptions().virtualThread(true).

##### NONE

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.

##### PLATFORM_THREAD

public static final TrackingOptions PLATFORM_THREAD

Only track platform thread start, same as new TrackingOptions().platformThreadStart(true).

##### EXECUTORS

public static final TrackingOptions EXECUTORS

Only track executors, same as new TrackingOptions().executors(true).

##### AWT

public static final TrackingOptions AWT

Only track AWT, same as new TrackingOptions().awt(true).

##### SWT

public static final TrackingOptions SWT

Only track SWT, same as new TrackingOptions().swt(true).

##### RMI

public static final TrackingOptions RMI

Only track RMI, same as new TrackingOptions().rmi(true).

##### GRPC

public static final TrackingOptions GRPC

Only track gRPC, same as new TrackingOptions().grpc(true).

##### REMOTE_EJB

public static final TrackingOptions REMOTE_EJB

Only track remote EJBs, same as new TrackingOptions().remoteEjb(true).

##### HTTP

public static final TrackingOptions HTTP

Only track http requests, same as new TrackingOptions().http(true).

##### KOTLIN_COROUTINES

public static final TrackingOptions KOTLIN_COROUTINES

Only track kotlin coroutines, same as new TrackingOptions().kotlinCoroutines(true).

##### VIRTUAL_THREAD

public static final TrackingOptions VIRTUAL_THREAD

Only track virtual thread start, same as new TrackingOptions().virtualThread(true).