Package adams.core
Class Performance
- java.lang.Object
-
- adams.core.Performance
-
public class Performance extends Object
A convenience class for accessing the performance tuning parameters.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description static StringFILENAMEthe name of the props file.protected static Propertiesm_Propertiesthe properties.
-
Constructor Summary
Constructors Constructor Description Performance()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intdetermineNumThreads(int threads)Detetermines the actual number of threads to use: > 0: specific number of threads to use = 0: use all cores (eg 4 threads on 4 core machine) < 0: # of cores + X (eg -1 equals 3 threads on 4 core machine)static booleangetBoolean(String key, boolean defValue)Returns the specified boolean property.static doublegetDouble(String key, double defValue)Returns the specified double property.static intgetInteger(String key, int defValue)Returns the specified integer property.static intgetMaxNumProcessors()Returns the maximum number of processors to use, -1 is all available.static StringgetNumThreadsHelp()Returns a help string explaining how "numThreads" works, to be used in the options/tiptext.static StringgetNumThreadsQuickInfo(int numThreads)Returns a quick info string, interpreting the number of threads.static StringgetNumThreadsQuickInfo(int numThreads, boolean suppressSequential)Returns a quick info string, interpreting the number of threads.protected static voidinitialize()loads the props file.
-
-
-
Field Detail
-
FILENAME
public static final String FILENAME
the name of the props file.- See Also:
- Constant Field Values
-
m_Properties
protected static Properties m_Properties
the properties.
-
-
Method Detail
-
initialize
protected static void initialize()
loads the props file.
-
getBoolean
public static boolean getBoolean(String key, boolean defValue)
Returns the specified boolean property.- Parameters:
key- the key of the property to retrievedefValue- the default value
-
getInteger
public static int getInteger(String key, int defValue)
Returns the specified integer property.- Parameters:
key- the key of the property to retrievedefValue- the default value
-
getDouble
public static double getDouble(String key, double defValue)
Returns the specified double property.- Parameters:
key- the key of the property to retrievedefValue- the default value
-
getMaxNumProcessors
public static int getMaxNumProcessors()
Returns the maximum number of processors to use, -1 is all available.- Returns:
- the maximum number
-
determineNumThreads
public static int determineNumThreads(int threads)
Detetermines the actual number of threads to use:- > 0: specific number of threads to use
- = 0: use all cores (eg 4 threads on 4 core machine)
- < 0: # of cores + X (eg -1 equals 3 threads on 4 core machine)
- Parameters:
threads- the number of threads- Returns:
- the actual number of threads
- See Also:
getMaxNumProcessors(),ProcessUtils.getAvailableProcessors()
-
getNumThreadsHelp
public static String getNumThreadsHelp()
Returns a help string explaining how "numThreads" works, to be used in the options/tiptext.- Returns:
- the help string
-
getNumThreadsQuickInfo
public static String getNumThreadsQuickInfo(int numThreads)
Returns a quick info string, interpreting the number of threads.- Parameters:
numThreads- the number of threads to turn into a quick info string- Returns:
- the quick info string
-
getNumThreadsQuickInfo
public static String getNumThreadsQuickInfo(int numThreads, boolean suppressSequential)
Returns a quick info string, interpreting the number of threads.- Parameters:
numThreads- the number of threads to turn into a quick info stringsuppressSequential- whether to suppress "sequential" string- Returns:
- the quick info string
-
-