Package adams.core

Class Performance


  • public class Performance
    extends Object
    A convenience class for accessing the performance tuning parameters.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • Performance

        public Performance()
    • 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 retrieve
        defValue - 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 retrieve
        defValue - 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 retrieve
        defValue - 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