|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.neeve.util.UtlThread
public final class UtlThread
Utility class containing methods to worh with threads.
This class IS supported for use by end users..
Nested Class Summary | |
---|---|
static class |
UtlThread.ThreadStats
Used by a thread to track stats related to its execution. |
Constructor Summary | |
---|---|
UtlThread()
|
Method Summary | |
---|---|
static com.lmax.disruptor.SequenceBarrier |
asIntrumentedSequenceBarrier(com.lmax.disruptor.SequenceBarrier barrier)
Returns a sequence barrier that records disruptor wait times. |
static boolean |
cpuAffinityMasksEnabled()
Returns whether CPU affinitization is enabled or not |
static String |
decodeAffinityMask(long mask)
Returns a mask string for the given mask. |
static String |
decodeAffinityMask(long mask,
boolean physicalFormat)
Decodes an affinity mask into a string format. |
static void |
deregister(Thread thread)
Can be called to stop tracking the specified thread. |
static void |
dumpAffinitizationState(Appendable to,
String prefix)
Dumps thread affinitization information. |
static void |
dumpProcessorLayout(Appendable to)
Dumps the processor layout to the provided Appendable |
static Thread[] |
getAllThreads()
Gets all running threads in the JVM. |
static UtlThread.ThreadStats |
getThreadStats(Thread thread)
Gets the thread stats for the given thread. |
static void |
main(String[] args)
|
static long |
parseAffinityMask(String affinity)
Parses a mask string into a mask value. |
static UtlThread.ThreadStats |
registerOrGetThreadStats(Thread thread)
Can be called to register a thread for tracking. |
static void |
setCPUAffinityMask(long mask)
Sets the CPU affinity mask of the current thread. |
static void |
setCPUAffinityMask(String affinity)
Sets the CPU affinity mask of the current thread. |
static void |
setDefaultCPUAffinityMask()
Set the CPU affinity mask of the current thread to the default mask |
static boolean |
threadWaitStatsEnabled()
Returns whether thread wait stats are enabled. |
static void |
triggerThreadDump(Appendable output)
Creates a stack dump. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UtlThread()
Method Detail |
---|
public static final UtlThread.ThreadStats registerOrGetThreadStats(Thread thread)
The caller should call deregister(Thread)
when the thread
is longer in use.
thread
- The thread to register or null if thread stats are not enabled.public static void deregister(Thread thread)
thread
- The thread to deregister.public static final boolean cpuAffinityMasksEnabled()
public static final boolean threadWaitStatsEnabled()
public static final void setCPUAffinityMask(long mask)
mask
- The affinity mask to set.public static void setCPUAffinityMask(String affinity)
affinity
- The affinity mask to set in the form described by parseAffinityMask(String)
.parseAffinityMask(String)
public static void setDefaultCPUAffinityMask()
public static long parseAffinityMask(String affinity)
Examples:
affinity
- The string describing the affinity mask
public static final String decodeAffinityMask(long mask)
mask
- The mask to decode
parseAffinityMask(String)
.public static final String decodeAffinityMask(long mask, boolean physicalFormat)
mask
- The mask The mask to decode.physicalFormat
- Attempts to resolve the cores to physical format for the given machine,
public static final void dumpProcessorLayout(Appendable to)
Appendable
to
- The target to which to dump the processor layout.public static final void dumpAffinitizationState(Appendable to, String prefix)
to
- The target to which to dump the affinization state.public static final UtlThread.ThreadStats getThreadStats(Thread thread)
thread
- The thread for which to retrieve stats.
parseAffinityMask(String)
public static final Thread[] getAllThreads()
This method may be used by end users, but is not supported and is subject to change
public static void triggerThreadDump(Appendable output)
This method may be used by end users, but is not supported and is subject to change
output
- the appendable to which to append the dump.public static final com.lmax.disruptor.SequenceBarrier asIntrumentedSequenceBarrier(com.lmax.disruptor.SequenceBarrier barrier)
When threadWaitStatsEnabled()
, an instrumented SequenceBarrier
is returned that records wait times.
This method is intended for internal use only.
barrier
- The barrier to instrument.
public static final void main(String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |