public class ThreadUtils extends Object
Modifier and Type | Field and Description |
---|---|
static int |
ALL
whether to use all available cores.
|
static int |
SEQUENTIAL
the number of threads used to be considered sequential.
|
Constructor and Description |
---|
ThreadUtils() |
Modifier and Type | Method and Description |
---|---|
static int |
getActualNumThreads(int numThreads,
int maxThreads)
Calculates the number of threads to use.
|
static int |
getAvailableProcessors()
Returns the available number of processors on the machine.
|
static boolean |
isMultiThreaded(int numThreads)
Returns whether the number of threads represent a multi-threaded setup.
|
public static final int ALL
public static final int SEQUENTIAL
public static int getAvailableProcessors()
public static int getActualNumThreads(int numThreads, int maxThreads)
numThreads
- the requested number of threads (-1 for # of cores/cpus)maxThreads
- the maximum to ask forpublic static boolean isMultiThreaded(int numThreads)
numThreads
- the number of threadsCopyright © 2017. All Rights Reserved.