public class ConcurrencyUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static long |
getLargeArraysBeginN()
Returns the minimal size for which JLargeArrays are used.
|
static int |
getNumberOfProcessors()
Returns the number of available processors.
|
static int |
getNumberOfThreads()
Returns the current number of threads.
|
static long |
getThreadsBeginN_1D_FFT_2Threads()
Returns the minimal size of 1D data for which two threads are used.
|
static long |
getThreadsBeginN_1D_FFT_4Threads()
Returns the minimal size of 1D data for which four threads are used.
|
static long |
getThreadsBeginN_2D()
Returns the minimal size of 2D data for which threads are used.
|
static long |
getThreadsBeginN_3D()
Returns the minimal size of 3D data for which threads are used.
|
static boolean |
isPowerOf2(int x)
Checks if x is a power-of-two number.
|
static boolean |
isPowerOf2(long x)
Checks if x is a power-of-two number.
|
static int |
nextPow2(int x)
Returns the closest power-of-two number greater than or equal to x.
|
static long |
nextPow2(long x)
Returns the closest power-of-two number greater than or equal to x.
|
static int |
prevPow2(int x)
Returns the closest power-of-two number less than or equal to x.
|
static long |
prevPow2(long x)
Returns the closest power-of-two number less than or equal to x.
|
static void |
resetThreadsBeginN_FFT()
Resets the minimal size of 1D data for which two and four threads are
used.
|
static void |
resetThreadsBeginN()
Resets the minimal size of 2D and 3D data for which threads are used.
|
static void |
setLargeArraysBeginN(long n)
Sets the minimal size for which JLargeArrays are used.
|
static void |
setNumberOfThreads(int n)
Sets the number of threads.
|
static void |
setThreadsBeginN_1D_FFT_2Threads(long n)
Sets the minimal size of 1D data for which two threads are used.
|
static void |
setThreadsBeginN_1D_FFT_4Threads(long n)
Sets the minimal size of 1D data for which four threads are used.
|
static void |
setThreadsBeginN_2D(long n)
Sets the minimal size of 2D data for which threads are used.
|
static void |
setThreadsBeginN_3D(long n)
Sets the minimal size of 3D data for which threads are used.
|
static void |
sleep(long millis)
Causes the currently executing thread to sleep (temporarily cease
execution) for the specified number of milliseconds.
|
static java.util.concurrent.Future<?> |
submit(java.lang.Runnable task)
Submits a Runnable task for execution and returns a Future representing
that task.
|
static void |
waitForCompletion(java.util.concurrent.Future<?>[] futures)
Waits for all threads to complete computation.
|
public static int getNumberOfProcessors()
public static int getNumberOfThreads()
public static void setNumberOfThreads(int n)
n
- number of threadspublic static long getThreadsBeginN_1D_FFT_2Threads()
public static long getThreadsBeginN_1D_FFT_4Threads()
public static long getThreadsBeginN_2D()
public static long getThreadsBeginN_3D()
public static long getLargeArraysBeginN()
public static void setThreadsBeginN_1D_FFT_2Threads(long n)
n
- the minimal size of 1D data for which two threads are usedpublic static void setThreadsBeginN_1D_FFT_4Threads(long n)
n
- the minimal size of 1D data for which four threads are usedpublic static void setThreadsBeginN_2D(long n)
n
- the minimal size of 2D data for which threads are usedpublic static void setThreadsBeginN_3D(long n)
n
- the minimal size of 3D data for which threads are usedpublic static void resetThreadsBeginN_FFT()
public static void resetThreadsBeginN()
public static void setLargeArraysBeginN(long n)
n
- the maximal size for which JLargeArrays are usedpublic static int nextPow2(int x)
x
- input valuepublic static long nextPow2(long x)
x
- input valuepublic static int prevPow2(int x)
x
- input valuepublic static long prevPow2(long x)
x
- input valuepublic static boolean isPowerOf2(int x)
x
- input valuepublic static boolean isPowerOf2(long x)
x
- input valuepublic static void sleep(long millis)
millis
- the length of time to sleep in millisecondspublic static java.util.concurrent.Future<?> submit(java.lang.Runnable task)
task
- a Runnable task for executionpublic static void waitForCompletion(java.util.concurrent.Future<?>[] futures)
futures
- array of Future objectsCopyright © 2014. All Rights Reserved.