Class AbstractDemandStrategy

    • Constructor Detail

      • AbstractDemandStrategy

        public AbstractDemandStrategy​(int low,
                                      int medium,
                                      int high,
                                      int iterationCount,
                                      int warmups)
        Constructor. Configures a demand strategy with low, medium and high modifier, as well as number of standard and warm-up cycles
        Parameters:
        low - accuracy modifier for low precision calibration
        medium - accuracy modifier for medium precision calibration
        high - accuracy modifier for high precision calibration
        iterationCount -
        warmups -
    • Method Detail

      • consume

        public void consume​(double demand)
        Description copied from interface: IDemandStrategy
        Consume a resource according to its demand & processing rate(specified in initaliseStrategy) WARNING: initializeStrategy() has to be run first
        Specified by:
        consume in interface IDemandStrategy
        Parameters:
        demand - [units] The demand to consume
        See Also:
        IDemandStrategy.consume(double)
      • getCalibrationFileName

        protected String getCalibrationFileName()
        Returns the name of the file used to store the calibration table Filename depends on paramters of this class
        Returns:
        The calibration table file name
      • getCalibrationPath

        protected File getCalibrationPath()
        Query the calibration path from the properties of this object
        Returns:
        The file system path used to load and store the calibration data, or the current working directory if it is not set
      • run

        protected abstract void run​(long load)
        Template method. This starts running the strategy with the parameter load
        Parameters:
        load - Complexity parameter. Algorithm should take longer if parameter is larger, i.e., ideally run(a) < run(b) <==> a < b
      • calibrate

        public CalibrationTable calibrate()
        Create a new calibration table for this host by measuring the execution times of our algorithm and creating an according calibration table
        Specified by:
        calibrate in interface IDemandStrategy
        Returns:
        a calibration table containing the results of the calibration
      • setCalibrationListener

        public void setCalibrationListener​(ICalibrationListener listener)
        Description copied from interface: IDemandStrategy
        Sets the calibration listener that receives progress updates during the calibration.
        Specified by:
        setCalibrationListener in interface IDemandStrategy
        Parameters:
        listener - the calibration listener to receive the updates
      • hasCalibrationTable

        public boolean hasCalibrationTable()
        Description copied from interface: IDemandStrategy
        Checks whether the strategy has a calibration table.
        Specified by:
        hasCalibrationTable in interface IDemandStrategy
        Returns:
        true if the strategy has a calibration table, otherwise false
      • setDebug

        public void setDebug​(boolean enable)
        Description copied from interface: IDemandStrategy
        Enables or disables debug mode. When debug mode is enabled, the calibration returns dummy results instead of actually calibrating the strategy.
        Specified by:
        setDebug in interface IDemandStrategy
        Parameters:
        enable - true if debug mode should be enabled, otherwise false
      • debugEnabled

        public boolean debugEnabled()
        Description copied from interface: IDemandStrategy
        Checks whether debug mode is enabled.
        Specified by:
        debugEnabled in interface IDemandStrategy
        Returns:
        true if debug mode is enabled, otherwise false
      • watchConsume

        @Deprecated
        public void watchConsume​(double demand)
        Deprecated.
        Consumes demands (only used for testing purpose!)
        Parameters:
        demand -
      • formatDuration

        public static String formatDuration​(org.jscience.physics.amount.Amount<javax.measure.quantity.Duration> t)