APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.jfr.internal

public final Class JVM

extends Object
Class Inheritance
Imports
java.lang.reflect.Field, java.util.List, jdk.internal.vm.annotation.IntrinsicCandidate, jdk.jfr.Event, jdk.jfr.internal.event.EventConfiguration, .EventWriter, jdk.jfr.internal.management.HiddenWait

Interface against the JVM.

Field Summary

Modifier and TypeField and Description
public static final Object
private static final JVM
private static volatile boolean
pack-priv static final long

Constructor Summary

AccessConstructor and Description
public
JVM()

Method Summary

Modifier and TypeMethod and Description
public static native void
abort(String
descriptive message to be include in VM termination sequence
errorMsg
)

Access to VM termination support.

public static native boolean

Returns:

true, if the string was successfully added.
addStringConstant
(long
identifier associated with the string, not negative
id
,
String
string constant to be added, not null
s
)

Adds a string to the string constant pool.

public static native void
beginRecording()

Begin recording events Requires that JFR has been started with JVMSupport#createJFR()

public static native long

Returns:

the next startPosition
commit
(long nextPosition)

Commits an event to the underlying buffer by setting the nextPosition.

public static native long

Returns:

the time, in ticks
counterTime
()

Return ticks

pack-priv static native boolean
createJFR(boolean
simulate a initialization failure and rollback in native, used for testing purposes
simulateFailure
)

Set up native resources, data structures, threads etc. for JFR

pack-priv static native boolean

Returns:

if an instance was actually destroyed.
destroyJFR
()

Destroys native part of JFR.

public static native long[]

Returns:

the unloaded IDs, or null if no unloading has occurred.
drainStaleMethodTracerIds
()

Returns IDs for method-traced classes that have been unloaded.

public static native void
emitDataLoss(long
number of bytes that were lost
bytes
)

Emit a jdk.DataLoss event for the specified amount of bytes.

public static native boolean

Returns:

true if the event was committed
emitEvent
(long
type id
eventTypeId
,
long
commit time for event
timestamp
,
long
when it is being done PeriodicType.When
periodicType
)

Emits native periodic event.

public static native void
emitOldObjectSamples(long
the cutoff in ticks
cutoff
,
boolean
emit all samples in old object queue
emitAll
,
boolean
don't use BFS when searching for path to GC root
skipBFS
)

Emit old object sample events.

public static native void
endRecording()

End recording events, which includes flushing data in thread buffers Requires that JFR has been started with JVMSupport#createJFR()

public static native void
exclude(Thread thread)

Exclude a thread from the jfr system

public static native void
flush(EventWriter writer, int uncommittedSize, int requestedSize)

Flushes the EventWriter for this thread.

public static native void
flush()

Flushes all thread buffers to disk and the constant pool data needed to read them.

public static native List<Class<? extends Event>>

Returns:

list of event classes.
getAllEventClasses
()

Return a list of all classes deriving from jdk.internal.event.Event

public static native boolean

Returns:

if transform is allowed
getAllowedToDoEventRetransforms
()

If the JVM supports JVM TI and retransformation has not been disabled this method will return true.

public static native long

Returns:

start time of the recording in nanos, -1 in case of in-memory
getChunkStartNanos
()

Get the start time in nanos from the header of the current chunk

public static native long

Returns:

a unique class identifier
getClassId
(Class<?>
clazz
clazz
)

Return a unique identifier for a class.

public static native Object

Returns:

the configuration, may be null
getConfiguration
(Class<? extends Event>
the class, not null
eventClass
)

Retrieves the EventConfiguration for an event class.

public static native String

Returns:

The path to emergency dump.
getDumpPath
()

Gets the path to emergency dump.

public static native EventWriter

Returns:

thread local EventWriter
getEventWriter
()

Fast path fetching the EventWriter using VM intrinsics

public static native String

Returns:

process identifier
getPid
()

Return process identifier.

public static native long

Returns:

a unique stack trace identifier
getStackTraceId
(int
number of frames to skip, or 0 if no frames should be skipped
skipCount
,
long stackFilerId)

Return unique identifier for stack trace.

public static native long

Returns:

a unique thread identifier
getThreadId
(Thread
thread
t
)

Return identifier for thread

public static native long

Returns:

frequency
getTicksFrequency
()

Frequency, ticks per second

public static native double
getTimeConversionFactor()

To convert ticks to wall clock time.

public static native long

Returns:

a unique class identifier
getTypeId
(Class<?>
class
clazz
)

Return a unique identifier for a class.

public static native long

Returns:

the id, or a negative value if it does not exists.
getTypeId
(String
the name of the type
name
)

Returns the id for the Java types defined in metadata.xml.

public static native long

Returns:

number of unloaded event classes.
getUnloadedEventClassCount
()

Return a count of the number of unloaded classes deriving from Event

public static native long
hostMemoryUsage()

Returns the amount of memory used in the host system whether or not this JVM runs in a container.

public static native long
hostTotalMemory()

Returns the total amount of memory of the host system whether or not this JVM runs in a container.

public static native long
hostTotalSwapMemory()

Returns the total amount of swap memory of the host system whether or not this JVM runs in a container.

public static native void
include(Thread thread)

Include a thread back into the jfr system

public static native boolean
isAvailable()

Cheap test to check if JFR functionality is available.

public static native boolean
isContainerized()

Returns true, if the JVM is running in a container, false otherwise.

public static native boolean

Returns:

is thread currently excluded
isExcluded
(Thread thread)

Test if a thread is currently excluded from the jfr system.

public static native boolean

Returns:

is class excluded
isExcluded
(Class<? extends Event>
the class, not null
eventClass
)

Test if a class is excluded from the jfr system.

public static native boolean

Returns:

is class instrumented
isInstrumented
(Class<? extends Event>
the class, not null
eventClass
)

Test if a class is instrumented.

public static native boolean

Returns:

true if this is a product build, false otherwise.
isProduct
()

Returns whether the current build is a product build.

public static native boolean
isRecording()

Return true if the JVM is recording

public static native void
log(int
the tagset id
tagSetId
,
int
on level
level
,
String
log message
message
)

Write message to log.

public static native void
logEvent(int
log level
level
,
String[]
lines to log
lines
,
boolean
if lines should be written to jfr+event+system
system
)

Log an event to jfr+event or jfr+event+system.

public static native void
markChunkFinal()

Marks current chunk as final

This allows streaming clients to read the chunk header and close the stream when no more data will be written into the current repository.

public static native long
nanosNow()

Returns the same clock that sets the start time of a chunk (in nanos).

public static native EventWriter

Returns:

thread local EventWriter
newEventWriter
()

Create a new EventWriter

private static native void
public static native long

Returns:

an ID that can be used to unregister the start frames, or -1 if it could not be registered
registerStackFilter
(String[] classes, String[] methods)

Registers stack filters that should be used with getStackTrace(int, long)

Method name at an array index is for class at the same array index.

public static synchronized native void
retransformClasses(Class<?>[] classes)

Call to invoke event tagging and retransformation of the passed classes

public static native void
setCompressedIntegers(boolean
true if compressed integers should be used, false otherwise.
compressed
)

Turn on/off compressed integers.

public static native boolean

Returns:

if the field could be set
setConfiguration
(Class<? extends Event>
the class, not null
eventClass
,
EventConfiguration
the configuration, may be null
configuration
)

Stores an EventConfiguration to the configuration field of an event class.

public static native void
setCPUPeriod(long
the new fixed period in nanoseconds
periodNanos
)

Set the fixed CPU time sampler period.

public static native void
setCPURate(double
the new rate in events per second
rate
)

Set the maximum event emission rate for the CPU time sampler Use setCPUPeriod(long) if you want a fixed sampling period instead.

public static native boolean

Returns:

true, if it could be set
setCutoff
(long
the id of the event type
eventTypeId
,
long
cutoff in ticks,
cutoffTicks
)

Sets cutoff for event.

public static native void
setDumpPath(String dumpPathText)

Sets the path to emergency dump.

public static native void
setEnabled(long
event type id
eventTypeId
,
boolean
enable event
enabled
)

Enable event

public static native void
setFileNotification(long
number of bytes, reset after file rotation
delta
)

Interval at which the JVM should notify on FILE_DELTA_CHANGE

public static native void
setForceInstrumentation(boolean force)

Controls if a class deriving from jdk.jfr.Event should always be instrumented on class load.

public static native void
setGlobalBufferCount(long count)

Set the number of global buffers to use

public static native void
setGlobalBufferSize(long size)

Set size of a global buffer

public static native void
setMemorySize(long size)

Set overall memory size

public static native void
setMethodSamplingPeriod(long type, long
the sampling period
periodMillis
)

Set period for method samples, in milliseconds.

public static native long[]

Returns:

the published IDs, or null if no classes has been published.
setMethodTraceFilters
(String[] classes, String[] methods, String[] annotations, int[] modification)

Sets method tracing filters.

public static native void
setMiscellaneous(long
the id of the event type
eventTypeId
,
long value)

Sets bits used for event settings, like cutoff(ticks) and level

public static native void
setOutput(String
the file where data should be written, or null if it should not be copied out (in memory).
file
)

Sets the file where data should be written.

public static native void
setRepositoryLocation(String dirText)

Sets the location of the disk repository.

public static native void
setStackDepth(int depth)

Set stack depth.

public static native void
setStackTraceEnabled(long
the event id
eventTypeId
,
boolean
if stack traces should be enabled
enabled
)

Turn on stack trace for an event

public static native void
setThreadBufferSize(long size)

Set thread buffer size.

public static native boolean

Returns:

true, if it could be set
setThreshold
(long
the id of the event type
eventTypeId
,
long
threshold in ticks,
ticks
)

Set threshold for event, Long.MAXIMUM_VALUE = no limit

public static native boolean

Returns:

true, if it could be set
setThrottle
(long
the id of the event type
eventTypeId
,
long
event sample size
eventSampleSize
,
long
time period in milliseconds
period_ms
)

Sets the event emission rate in event sample size per time unit.

public static native boolean

Returns:

if it is time to perform a chunk rotation
shouldRotateDisk
()

Test if a chunk rotation is warranted.

public static native void
storeMetadataDescriptor(byte[]
binary representation of metadata descriptor
bytes
)

Store the metadata descriptor that is to be written at the end of a chunk, data should be written after GMT offset and size of metadata event should be adjusted Requires that JFR has been started with JVMSupport#createJFR()

public static native void
subscribeLogLevel(LogTag
the log tag to subscribe
lt
,
int
the tagset id
tagSetId
)

Subscribe to LogLevel updates for LogTag

public static native boolean

Returns:

true if the epoch was updated by the current thread.
tryUpdateEpoch
(Field
A java.lang.reflect.Field instance root, not null
root
)

The tryUpdateEpoch() method(s) takes a state object as an argument and returns true if the epoch was exclusively updated by the current thread.

public static native void
public static native void
unregisterStackFilter(long
the stack filter ID to unregister
stackFilterId
)

Unregisters a set of stack filters.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CHUNK_ROTATION_MONITORback to summary
public static final Object CHUNK_ROTATION_MONITOR
jvmback to summary
private static final JVM jvm
nativeOKback to summary
private static volatile boolean nativeOK
RESERVED_CLASS_ID_LIMITback to summary
pack-priv static final long RESERVED_CLASS_ID_LIMIT

Constructor Detail

JVMback to summary
public JVM()

Method Detail

abortback to summary
public static native void abort(String errorMsg)

Access to VM termination support.

Parameters
errorMsg:String

descriptive message to be include in VM termination sequence

addStringConstantback to summary
public static native boolean addStringConstant(long id, String s)

Adds a string to the string constant pool. If the same string is added twice, two entries will be created.

Parameters
id:long

identifier associated with the string, not negative

s:String

string constant to be added, not null

Returns:boolean

true, if the string was successfully added.

beginRecordingback to summary
public static native void beginRecording()

Begin recording events Requires that JFR has been started with JVMSupport#createJFR()

commitback to summary
public static native long commit(long nextPosition)

Commits an event to the underlying buffer by setting the nextPosition.

Returns:long

the next startPosition

Annotations
@IntrinsicCandidate
counterTimeback to summary
public static native long counterTime()

Return ticks

Returns:long

the time, in ticks

Annotations
@IntrinsicCandidate
createJFRback to summary
pack-priv static native boolean createJFR(boolean simulateFailure) throws IllegalStateException

Set up native resources, data structures, threads etc. for JFR

Parameters
simulateFailure:boolean

simulate a initialization failure and rollback in native, used for testing purposes

Exceptions
IllegalStateException:
if native part of JFR could not be created.
destroyJFRback to summary
pack-priv static native boolean destroyJFR()

Destroys native part of JFR. If already destroy, call is ignored. Requires that JFR has been started with JVMSupport#createJFR()

Returns:boolean

if an instance was actually destroyed.

drainStaleMethodTracerIdsback to summary
public static native long[] drainStaleMethodTracerIds()

Returns IDs for method-traced classes that have been unloaded.

Returns:long[]

the unloaded IDs, or null if no unloading has occurred.

emitDataLossback to summary
public static native void emitDataLoss(long bytes)

Emit a jdk.DataLoss event for the specified amount of bytes.

Parameters
bytes:long

number of bytes that were lost

emitEventback to summary
public static native boolean emitEvent(long eventTypeId, long timestamp, long periodicType)

Emits native periodic event.

Parameters
eventTypeId:long

type id

timestamp:long

commit time for event

periodicType:long

when it is being done PeriodicType.When

Returns:boolean

true if the event was committed

emitOldObjectSamplesback to summary
public static native void emitOldObjectSamples(long cutoff, boolean emitAll, boolean skipBFS)

Emit old object sample events.

Parameters
cutoff:long

the cutoff in ticks

emitAll:boolean

emit all samples in old object queue

skipBFS:boolean

don't use BFS when searching for path to GC root

endRecordingback to summary
public static native void endRecording()

End recording events, which includes flushing data in thread buffers Requires that JFR has been started with JVMSupport#createJFR()

excludeback to summary
public static native void exclude(Thread thread)

Exclude a thread from the jfr system

flushback to summary
public static native void flush(EventWriter writer, int uncommittedSize, int requestedSize)

Flushes the EventWriter for this thread.

flushback to summary
public static native void flush()

Flushes all thread buffers to disk and the constant pool data needed to read them.

When the method returns, the chunk header should be updated with valid pointers to the metadata event, last check point event, correct file size and the generation id.

getAllEventClassesback to summary
public static native List<Class<? extends Event>> getAllEventClasses()

Return a list of all classes deriving from jdk.internal.event.Event

Returns:List<Class<? extends Event>>

list of event classes.

getAllowedToDoEventRetransformsback to summary
public static native boolean getAllowedToDoEventRetransforms()

If the JVM supports JVM TI and retransformation has not been disabled this method will return true. This flag can not change during the lifetime of the JVM.

Returns:boolean

if transform is allowed

getChunkStartNanosback to summary
public static native long getChunkStartNanos()

Get the start time in nanos from the header of the current chunk

Returns:long

start time of the recording in nanos, -1 in case of in-memory

getClassIdback to summary
public static native long getClassId(Class<?> clazz)

Return a unique identifier for a class. The class is marked as being "in use" in JFR.

Parameters
clazz:Class<?>

clazz

Returns:long

a unique class identifier

Annotations
@IntrinsicCandidate
getConfigurationback to summary
public static native Object getConfiguration(Class<? extends Event> eventClass)

Retrieves the EventConfiguration for an event class.

Parameters
eventClass:Class<? extends Event>

the class, not null

Returns:Object

the configuration, may be null

getDumpPathback to summary
public static native String getDumpPath()

Gets the path to emergency dump.

Returns:String

The path to emergency dump.

getEventWriterback to summary
public static native EventWriter getEventWriter()

Fast path fetching the EventWriter using VM intrinsics

Returns:EventWriter

thread local EventWriter

Annotations
@IntrinsicCandidate
getPidback to summary
public static native String getPid()

Return process identifier.

Returns:String

process identifier

getStackTraceIdback to summary
public static native long getStackTraceId(int skipCount, long stackFilerId)

Return unique identifier for stack trace. Requires that JFR has been started with JVMSupport#createJFR()

Parameters
skipCount:int

number of frames to skip, or 0 if no frames should be skipped

Returns:long

a unique stack trace identifier

getThreadIdback to summary
public static native long getThreadId(Thread t)

Return identifier for thread

Parameters
t:Thread

thread

Returns:long

a unique thread identifier

getTicksFrequencyback to summary
public static native long getTicksFrequency()

Frequency, ticks per second

Returns:long

frequency

getTimeConversionFactorback to summary
public static native double getTimeConversionFactor()

To convert ticks to wall clock time.

getTypeIdback to summary
public static native long getTypeId(Class<?> clazz)

Return a unique identifier for a class. Compared to getClassId(Class), this method does not tag the class as being "in-use".

Parameters
clazz:Class<?>

class

Returns:long

a unique class identifier

getTypeIdback to summary
public static native long getTypeId(String name)

Returns the id for the Java types defined in metadata.xml.

Parameters
name:String

the name of the type

Returns:long

the id, or a negative value if it does not exists.

getUnloadedEventClassCountback to summary
public static native long getUnloadedEventClassCount()

Return a count of the number of unloaded classes deriving from Event

Returns:long

number of unloaded event classes.

hostMemoryUsageback to summary
public static native long hostMemoryUsage()

Returns the amount of memory used in the host system whether or not this JVM runs in a container.

hostTotalMemoryback to summary
public static native long hostTotalMemory()

Returns the total amount of memory of the host system whether or not this JVM runs in a container.

hostTotalSwapMemoryback to summary
public static native long hostTotalSwapMemory()

Returns the total amount of swap memory of the host system whether or not this JVM runs in a container.

includeback to summary
public static native void include(Thread thread)

Include a thread back into the jfr system

isAvailableback to summary
public static native boolean isAvailable()

Cheap test to check if JFR functionality is available.

isContainerizedback to summary
public static native boolean isContainerized()

Returns true, if the JVM is running in a container, false otherwise.

If -XX:-UseContainerSupport has been specified, this method returns false, which is questionable, but Container.metrics() returns null, so events can't be emitted anyway.

isExcludedback to summary
public static native boolean isExcluded(Thread thread)

Test if a thread is currently excluded from the jfr system.

Returns:boolean

is thread currently excluded

isExcludedback to summary
public static native boolean isExcluded(Class<? extends Event> eventClass)

Test if a class is excluded from the jfr system.

Parameters
eventClass:Class<? extends Event>

the class, not null

Returns:boolean

is class excluded

isInstrumentedback to summary
public static native boolean isInstrumented(Class<? extends Event> eventClass)

Test if a class is instrumented.

Parameters
eventClass:Class<? extends Event>

the class, not null

Returns:boolean

is class instrumented

isProductback to summary
public static native boolean isProduct()

Returns whether the current build is a product build.

Returns:boolean

true if this is a product build, false otherwise.

isRecordingback to summary
public static native boolean isRecording()

Return true if the JVM is recording

logback to summary
public static native void log(int tagSetId, int level, String message)

Write message to log. Should swallow null or empty message, and be able to handle any Java character and not crash with very large message

Parameters
tagSetId:int

the tagset id

level:int

on level

message:String

log message

logEventback to summary
public static native void logEvent(int level, String[] lines, boolean system)

Log an event to jfr+event or jfr+event+system.

Caller should ensure that message is not null or too large to handle.

Parameters
level:int

log level

lines:String[]

lines to log

system:boolean

if lines should be written to jfr+event+system

markChunkFinalback to summary
public static native void markChunkFinal()

Marks current chunk as final

This allows streaming clients to read the chunk header and close the stream when no more data will be written into the current repository.

nanosNowback to summary
public static native long nanosNow()

Returns the same clock that sets the start time of a chunk (in nanos).

newEventWriterback to summary
public static native EventWriter newEventWriter()

Create a new EventWriter

Returns:EventWriter

thread local EventWriter

registerNativesback to summary
private static native void registerNatives()
registerStackFilterback to summary
public static native long registerStackFilter(String[] classes, String[] methods)

Registers stack filters that should be used with getStackTrace(int, long)

Method name at an array index is for class at the same array index.

This method should be called holding the MetadataRepository lock and before bytecode for the associated event class has been added.

Returns:long

an ID that can be used to unregister the start frames, or -1 if it could not be registered

retransformClassesback to summary
public static synchronized native void retransformClasses(Class<?>[] classes)

Call to invoke event tagging and retransformation of the passed classes

Exceptions
IllegalStateException:
if wrong JVMTI phase.
setCompressedIntegersback to summary
public static native void setCompressedIntegers(boolean compressed) throws IllegalStateException

Turn on/off compressed integers.

Parameters
compressed:boolean

true if compressed integers should be used, false otherwise.

Exceptions
IllegalStateException:
if state can't be changed.
setConfigurationback to summary
public static native boolean setConfiguration(Class<? extends Event> eventClass, EventConfiguration configuration)

Stores an EventConfiguration to the configuration field of an event class.

Parameters
eventClass:Class<? extends Event>

the class, not null

configuration:EventConfiguration

the configuration, may be null

Returns:boolean

if the field could be set

setCPUPeriodback to summary
public static native void setCPUPeriod(long periodNanos)

Set the fixed CPU time sampler period. Use setCPURate(double) if you want a fixed rate with an auto-adjusted period instead. Setting period to 0 turns off the CPU time sampler.

Parameters
periodNanos:long

the new fixed period in nanoseconds

setCPURateback to summary
public static native void setCPURate(double rate)

Set the maximum event emission rate for the CPU time sampler Use setCPUPeriod(long) if you want a fixed sampling period instead. Setting rate to 0 turns off the CPU time sampler.

Parameters
rate:double

the new rate in events per second

setCutoffback to summary
public static native boolean setCutoff(long eventTypeId, long cutoffTicks)

Sets cutoff for event. Determines how long the event should be allowed to run. Long.MAXIMUM_VALUE = no limit

Parameters
eventTypeId:long

the id of the event type

cutoffTicks:long

cutoff in ticks,

Returns:boolean

true, if it could be set

setDumpPathback to summary
public static native void setDumpPath(String dumpPathText)

Sets the path to emergency dump.

setEnabledback to summary
public static native void setEnabled(long eventTypeId, boolean enabled)

Enable event

Parameters
eventTypeId:long

event type id

enabled:boolean

enable event

setFileNotificationback to summary
public static native void setFileNotification(long delta)

Interval at which the JVM should notify on FILE_DELTA_CHANGE

Parameters
delta:long

number of bytes, reset after file rotation

setForceInstrumentationback to summary
public static native void setForceInstrumentation(boolean force)

Controls if a class deriving from jdk.jfr.Event should always be instrumented on class load.

setGlobalBufferCountback to summary
public static native void setGlobalBufferCount(long count) throws IllegalArgumentException, IllegalStateException

Set the number of global buffers to use

Exceptions
IllegalArgumentException:
if count is not within a valid range
IllegalStateException:
if value can't be changed
setGlobalBufferSizeback to summary
public static native void setGlobalBufferSize(long size) throws IllegalArgumentException

Set size of a global buffer

Exceptions
IllegalArgumentException:
if buffer size is not within a valid range
setMemorySizeback to summary
public static native void setMemorySize(long size) throws IllegalArgumentException

Set overall memory size

Exceptions
IllegalArgumentException:
if memory size is not within a valid range
setMethodSamplingPeriodback to summary
public static native void setMethodSamplingPeriod(long type, long periodMillis)

Set period for method samples, in milliseconds. Setting period to 0 turns off the method sampler.

Parameters
periodMillis:long

the sampling period

setMethodTraceFiltersback to summary
public static native long[] setMethodTraceFilters(String[] classes, String[] methods, String[] annotations, int[] modification)

Sets method tracing filters. A filter can be a class, a method, or an annotation. For example, the following three filters:

  • Method timing on all methods in class com.foo.Bar
  • Method tracing on the method com.foo.Bar::baz
  • Method timing and tracing on all methods or classes with the annotation @com.foo.Foo
can be set using the following code:
String[] classes = new String[3];
classes[0] = "com/foo/Bar";
classes[1] = "com/foo/Bar";
classes[2] = null;

String[] methods = new String[3];
methods[0] = null;
methods[1] = "baz";
methods[2] = null;

String[] annotations = new String[3];
annotations[0] = null;
annotations[1] = null;
annotations[2] = "com/foo/Foo";

int[] modifications = new int[3];
modifications[0] = 1; // filter should apply to timing
modifications[1] = 2; // filter should apply to tracing
modifications[2] = 1 | 2; // filter should apply to both timing and tracing

JVM.setMethodTraceFilters(classes, methods, annotations, modifications);
The filter will be applied to currently and future loaded classes.

If a method is overloaded, the filter matches against all methods. It's not possible to match specific method parameters or annotation values.

Only one type of a filter - class, method, or annotation - can be used per array index.

If the filter is matched, JVMUpcalls::onMethodTrace will be invoked with the bytecode. If a filter is replaced, and method no longer requires instrumentation, the method will also be called with modification = 0;

Returns:long[]

the published IDs, or null if no classes has been published.

setMiscellaneousback to summary
public static native void setMiscellaneous(long eventTypeId, long value)

Sets bits used for event settings, like cutoff(ticks) and level

Parameters
eventTypeId:long

the id of the event type

setOutputback to summary
public static native void setOutput(String file)

Sets the file where data should be written. Requires that JFR has been started with JVMSupport#createJFR()

Recording  Previous  Current  Action
==============================================
   true     null      null     Ignore, keep recording in-memory
   true     null      file1    Start disk recording
   true     file      null     Copy out metadata to disk and continue in-memory recording
   true     file1     file2    Copy out metadata and start with new File (file2)
   false     *        null     Ignore, but start recording to memory with beginRecording()
   false     *        file     Ignore, but start recording to disk with beginRecording()

recording can be set to true/false with beginRecording() endRecording()
Parameters
file:String

the file where data should be written, or null if it should not be copied out (in memory).

setRepositoryLocationback to summary
public static native void setRepositoryLocation(String dirText)

Sets the location of the disk repository.

setStackDepthback to summary
public static native void setStackDepth(int depth) throws IllegalArgumentException, IllegalStateException

Set stack depth.

Exceptions
IllegalArgumentException:
if not within a valid range
IllegalStateException:
if depth can't be changed
setStackTraceEnabledback to summary
public static native void setStackTraceEnabled(long eventTypeId, boolean enabled)

Turn on stack trace for an event

Parameters
eventTypeId:long

the event id

enabled:boolean

if stack traces should be enabled

setThreadBufferSizeback to summary
public static native void setThreadBufferSize(long size) throws IllegalArgumentException, IllegalStateException

Set thread buffer size.

Exceptions
IllegalArgumentException:
if size is not within a valid range
IllegalStateException:
if size can't be changed
setThresholdback to summary
public static native boolean setThreshold(long eventTypeId, long ticks)

Set threshold for event, Long.MAXIMUM_VALUE = no limit

Parameters
eventTypeId:long

the id of the event type

ticks:long

threshold in ticks,

Returns:boolean

true, if it could be set

setThrottleback to summary
public static native boolean setThrottle(long eventTypeId, long eventSampleSize, long period_ms)

Sets the event emission rate in event sample size per time unit. Determines how events are throttled.

Parameters
eventTypeId:long

the id of the event type

eventSampleSize:long

event sample size

period_ms:long

time period in milliseconds

Returns:boolean

true, if it could be set

shouldRotateDiskback to summary
public static native boolean shouldRotateDisk()

Test if a chunk rotation is warranted.

Returns:boolean

if it is time to perform a chunk rotation

storeMetadataDescriptorback to summary
public static native void storeMetadataDescriptor(byte[] bytes)

Store the metadata descriptor that is to be written at the end of a chunk, data should be written after GMT offset and size of metadata event should be adjusted Requires that JFR has been started with JVMSupport#createJFR()

Parameters
bytes:byte[]

binary representation of metadata descriptor

subscribeLogLevelback to summary
public static native void subscribeLogLevel(LogTag lt, int tagSetId)

Subscribe to LogLevel updates for LogTag

Parameters
lt:LogTag

the log tag to subscribe

tagSetId:int

the tagset id

tryUpdateEpochback to summary
public static native boolean tryUpdateEpoch(Field root)

The tryUpdateEpoch() method(s) takes a state object as an argument and returns true if the epoch was exclusively updated by the current thread.

Parameters
root:Field

A java.lang.reflect.Field instance root, not null

Returns:boolean

true if the epoch was updated by the current thread.

Annotations
@IntrinsicCandidate
uncaughtExceptionback to summary
public static native void uncaughtException(Thread thread, Throwable t)
unregisterStackFilterback to summary
public static native void unregisterStackFilter(long stackFilterId)

Unregisters a set of stack filters.

This method should be called holding the MetadataRepository lock and after the associated event class has been unloaded.

Parameters
stackFilterId:long

the stack filter ID to unregister