Package com.illumon.util.profiling
Class ThreadMXBeanThreadProfiler<BEAN_TYPE extends ThreadMXBean>
java.lang.Object
com.illumon.util.profiling.ThreadMXBeanThreadProfiler<BEAN_TYPE>
- All Implemented Interfaces:
ThreadProfiler
- Direct Known Subclasses:
BaselineThreadMXBeanThreadProfiler,SunThreadMXBeanThreadProfiler
public abstract class ThreadMXBeanThreadProfiler<BEAN_TYPE extends ThreadMXBean>
extends Object
implements ThreadProfiler
An abstract generic
ThreadMXBean-based ThreadProfiler implementation, with support for baseline
measurements available on all JVMs.-
Field Summary
FieldsFields inherited from interface com.illumon.util.profiling.ThreadProfiler
CPU_PROFILING_ENABLED, DEFAULT, MEMORY_PROFILING_ENABLED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanCheck if CPU profiling (e.g.final longGet the approximate number of total nanoseconds the current thread has executed (in system or user mode) since CPU time measurement started.final longGet the approximate number of total nanoseconds the current thread has executed (in user mode) since CPU time measurement started.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.illumon.util.profiling.ThreadProfiler
getCurrentThreadAllocatedBytes, memoryProfilingAvailable
-
Field Details
-
threadMXBean
The bean for measurements.
-
-
Constructor Details
-
ThreadMXBeanThreadProfiler
protected ThreadMXBeanThreadProfiler()
-
-
Method Details
-
cpuProfilingAvailable
public final boolean cpuProfilingAvailable()Description copied from interface:ThreadProfilerCheck if CPU profiling (e.g.ThreadProfiler.getCurrentThreadCpuTime()andThreadProfiler.getCurrentThreadUserTime()) is available (supported and enabled).- Specified by:
cpuProfilingAvailablein interfaceThreadProfiler- Returns:
- Whether CPU profiling is available.
-
getCurrentThreadCpuTime
public final long getCurrentThreadCpuTime()Description copied from interface:ThreadProfilerGet the approximate number of total nanoseconds the current thread has executed (in system or user mode) since CPU time measurement started.- Specified by:
getCurrentThreadCpuTimein interfaceThreadProfiler- Returns:
- The approximate number of total nanoseconds the current thread has executed, or
QueryConstants.NULL_LONGif unavailable.
-
getCurrentThreadUserTime
public final long getCurrentThreadUserTime()Description copied from interface:ThreadProfilerGet the approximate number of total nanoseconds the current thread has executed (in user mode) since CPU time measurement started.- Specified by:
getCurrentThreadUserTimein interfaceThreadProfiler- Returns:
- The approximate number of total nanoseconds the current thread has executed in user mode, or
QueryConstants.NULL_LONGif unavailable.
-