@Experimental
public interface ThreadSnapshot
| Modifier and Type | Method and Description |
|---|---|
Long |
getBlockedTime()
This value is extracted from
ThreadInfo.getBlockedTime(). |
Long |
getCpuTime()
This value is extracted from
ThreadMXBean.getThreadCpuTime(long). |
Long |
getWaitedTime()
This value is extracted from
ThreadInfo.getWaitedTime(). |
Long getBlockedTime()
ThreadInfo.getBlockedTime().
Returns the approximate accumulated elapsed time (in milliseconds) that the thread associated with this ThreadInfo
has blocked to enter or reenter a monitor since thread contention monitoring is enabled. I.e. the total accumulated time the
thread has been in the BLOCKED state since thread contention monitoring was last
enabled. This method returns -1 if thread contention monitoring is disabled.
The Java virtual machine may measure the time with a high resolution timer. This statistic is reset when the thread contention monitoring is reenabled.
UnsupportedOperationException - if the Java virtual machine does not support this operation.ThreadMXBean.isThreadContentionMonitoringSupported(),
ThreadMXBean.setThreadContentionMonitoringEnabled(boolean)Long getWaitedTime()
ThreadInfo.getWaitedTime().
Returns the approximate accumulated elapsed time (in milliseconds) that the thread associated with this ThreadInfo
has waited for notification since thread contention monitoring is enabled. I.e. the total accumulated time the thread has
been in the WAITING or TIMED_WAITING
state since thread contention monitoring is enabled. This method returns -1 if thread contention monitoring is
disabled.
The Java virtual machine may measure the time with a high resolution timer. This statistic is reset when the thread contention monitoring is reenabled.
UnsupportedOperationException - if the Java virtual machine does not support this operation.ThreadMXBean.isThreadContentionMonitoringSupported(),
ThreadMXBean.setThreadContentionMonitoringEnabled(boolean)Long getCpuTime()
ThreadMXBean.getThreadCpuTime(long).
Returns the total CPU time for the current thread in nanoseconds. The returned value is of nanoseconds precision but not necessarily nanoseconds accuracy. If the implementation distinguishes between user mode time and system mode time, the returned CPU time is the amount of time that the thread has executed in user mode or system mode.
If the thread of the specified ID is not alive or does not exist, this method returns -1. If CPU time measurement is disabled, this method returns -1. A thread is alive if it has been started and has not yet died.
If CPU time measurement is enabled after the thread has started, the Java virtual machine implementation may choose any time up to and including the time that the capability is enabled as the point where CPU time measurement starts.
IllegalArgumentException - if id <= 0.UnsupportedOperationException - if the Java virtual machine does not support CPU time measurement for other
threads.ThreadMXBean.getThreadUserTime(long),
ThreadMXBean.isThreadCpuTimeSupported(),
ThreadMXBean.isThreadCpuTimeEnabled(),
ThreadMXBean.setThreadCpuTimeEnabled(boolean)Copyright © 2025 MuleSoft, Inc.. All rights reserved.