Class ReadLargeChunksDemand
java.lang.Object
org.palladiosimulator.protocom.resourcestrategies.activeresource.AbstractDemandStrategy
org.palladiosimulator.protocom.resourcestrategies.activeresource.hdd.ReadLargeChunksDemand
- All Implemented Interfaces:
IDemandStrategy
Reads large chunks of data up to MAX_FILE_SIZE Byte (default 8 MB) from a predefined hard disk
drive.
During initialisation, it is checked whether there is a directory fileDirectory. If yes, it is
used to read data from the hard disk drive. If not, the directory is created and a number of
files given by numberOfFiles are written. The files size is maxFileSize.
It is recommended to restart the application or even the whole machine if the files are written
during initialisation.
To avoid caching effects, each consume reads from another file until all files of the list are
read. Then, the first file is read again.
TODO: Initialisation of the HD, variable file sizes, variable number of files, scattered
reads, writes, variable file sizes.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.palladiosimulator.protocom.resourcestrategies.activeresource.AbstractDemandStrategy
AbstractDemandStrategy.ProcessingRate, AbstractDemandStrategy.Work -
Field Summary
Fields inherited from class org.palladiosimulator.protocom.resourcestrategies.activeresource.AbstractDemandStrategy
CALIBRATION_PATH_CONFIG_KEY, defaultIterationCount, degreeOfAccuracy, WORKUNITS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()Do cleanup work.intgetName()Template method to return the name of this strategyTemplate method to return the real hardware resource type simulated by this strategyvoidinitializeStrategy(DegreeOfAccuracyEnum degreeOfAccuracy, double processingRate) Initialize the strategy and perform necessary calibrationsvoidinitializeStrategy(DegreeOfAccuracyEnum degreeOfAccuracy, double processingRate, String calibrationPath) Initialize the strategy and perform necessary calibrationsprotected voidrun(long load) Template method.Methods inherited from class org.palladiosimulator.protocom.resourcestrategies.activeresource.AbstractDemandStrategy
calibrate, consume, debugEnabled, ensureCalibrationExists, formatDuration, getCalibrationFileName, getCalibrationPath, hasCalibrationTable, setCalibrationListener, setCalibrationTable, setDebug, setProperties, watchConsumeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.palladiosimulator.protocom.resourcestrategies.activeresource.IDemandStrategy
calibrate, consume, debugEnabled, ensureCalibrationExists, hasCalibrationTable, setCalibrationListener, setCalibrationTable, setDebug, setProperties
-
Constructor Details
-
ReadLargeChunksDemand
public ReadLargeChunksDemand() -
ReadLargeChunksDemand
-
-
Method Details
-
run
protected void run(long load) Description copied from class:AbstractDemandStrategyTemplate method. This starts running the strategy with the parameter load- Specified by:
runin classAbstractDemandStrategy- Parameters:
load- Complexity parameter. Algorithm should take longer if parameter is larger, i.e., ideally run(a) < run(b) <==> a < b
-
getStrategysResource
Description copied from class:AbstractDemandStrategyTemplate method to return the real hardware resource type simulated by this strategy- Specified by:
getStrategysResourcein interfaceIDemandStrategy- Specified by:
getStrategysResourcein classAbstractDemandStrategy- Returns:
- The resource type we can simulate
- See Also:
-
initializeStrategy
public void initializeStrategy(DegreeOfAccuracyEnum degreeOfAccuracy, double processingRate, String calibrationPath) Description copied from interface:IDemandStrategyInitialize the strategy and perform necessary calibrations- Specified by:
initializeStrategyin interfaceIDemandStrategy- Overrides:
initializeStrategyin classAbstractDemandStrategy- Parameters:
degreeOfAccuracy- The degree of accuracy used for calibration: HIGH, MEDIUM, LOW WARNING: The use of HIGH can result in a significant increase in the execution timeprocessingRate- [units/seconds] The rate to initialize with (demand/processingRate = time)calibrationPath- Path where the calibration is stored- See Also:
-
initializeStrategy
Description copied from interface:IDemandStrategyInitialize the strategy and perform necessary calibrations- Specified by:
initializeStrategyin interfaceIDemandStrategy- Overrides:
initializeStrategyin classAbstractDemandStrategy- Parameters:
degreeOfAccuracy- The degree of accuracy used for calibration: HIGH, MEDIUM, LOW WARNING: The use of HIGH can result in a significant increase in the execution timeprocessingRate- [units/seconds] The rate to initialize with (demand/processingRate = time)- See Also:
-
getMaxFileSize
public int getMaxFileSize() -
getName
Description copied from class:AbstractDemandStrategyTemplate method to return the name of this strategy- Specified by:
getNamein interfaceIDemandStrategy- Specified by:
getNamein classAbstractDemandStrategy- Returns:
- a string containing the name of the strategy
- See Also:
-
cleanup
public void cleanup()Description copied from interface:IDemandStrategyDo cleanup work.- Specified by:
cleanupin interfaceIDemandStrategy
-