Package com.illumon.util.profiling
Interface ThreadProfiler
- All Known Implementing Classes:
BaselineThreadMXBeanThreadProfiler,NullThreadProfiler,SunThreadMXBeanThreadProfiler,ThreadMXBeanThreadProfiler
public interface ThreadProfiler
Interface for thread profiling utilities which may be platform or JVM dependent.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanstatic final ThreadProfilerDefault instance for almost all usage.static final boolean -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if CPU profiling (e.g.longGet the approximate number of total bytes allocated by the current thread.longGet the approximate number of total nanoseconds the current thread has executed (in system or user mode) since CPU time measurement started.longGet the approximate number of total nanoseconds the current thread has executed (in user mode) since CPU time measurement started.static ThreadProfilermake()Make a new ThreadProfiler for this JVM.booleanCheck if memory profiling (e.g.
-
Field Details
-
CPU_PROFILING_ENABLED
static final boolean CPU_PROFILING_ENABLED -
MEMORY_PROFILING_ENABLED
static final boolean MEMORY_PROFILING_ENABLED -
DEFAULT
Default instance for almost all usage.
-
-
Method Details
-
memoryProfilingAvailable
boolean memoryProfilingAvailable()Check if memory profiling (e.g.getCurrentThreadAllocatedBytes()) is available (supported and enabled).- Returns:
- Whether memory profiling is available.
-
getCurrentThreadAllocatedBytes
long getCurrentThreadAllocatedBytes()Get the approximate number of total bytes allocated by the current thread.- Returns:
- The approximate number of total bytes allocated by the current thread, or
QueryConstants.NULL_LONGif unavailable.
-
cpuProfilingAvailable
boolean cpuProfilingAvailable()Check if CPU profiling (e.g.getCurrentThreadCpuTime()andgetCurrentThreadUserTime()) is available (supported and enabled).- Returns:
- Whether CPU profiling is available.
-
getCurrentThreadCpuTime
long getCurrentThreadCpuTime()Get the approximate number of total nanoseconds the current thread has executed (in system or user mode) since CPU time measurement started.- Returns:
- The approximate number of total nanoseconds the current thread has executed, or
QueryConstants.NULL_LONGif unavailable.
-
getCurrentThreadUserTime
long getCurrentThreadUserTime()Get the approximate number of total nanoseconds the current thread has executed (in user mode) since CPU time measurement started.- Returns:
- The approximate number of total nanoseconds the current thread has executed in user mode, or
QueryConstants.NULL_LONGif unavailable.
-
make
Make a new ThreadProfiler for this JVM. The result may not support all measurements, if there's no suitable implementation available.- Returns:
- A new ThreadProfiler for this JVM.
-