Class ReadLargeChunksDemand
- java.lang.Object
-
- org.palladiosimulator.protocom.resourcestrategies.activeresource.AbstractDemandStrategy
-
- org.palladiosimulator.protocom.resourcestrategies.activeresource.hdd.ReadLargeChunksDemand
-
- All Implemented Interfaces:
IDemandStrategy
public class ReadLargeChunksDemand extends AbstractDemandStrategy implements 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 Constructor Description ReadLargeChunksDemand()
ReadLargeChunksDemand(File path, int maxFileSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanup()
Do cleanup work.int
getMaxFileSize()
String
getName()
Template method to return the name of this strategyResourceTypeEnum
getStrategysResource()
Template method to return the real hardware resource type simulated by this strategyvoid
initializeStrategy(DegreeOfAccuracyEnum degreeOfAccuracy, double processingRate)
Initialize the strategy and perform necessary calibrationsvoid
initializeStrategy(DegreeOfAccuracyEnum degreeOfAccuracy, double processingRate, String calibrationPath)
Initialize the strategy and perform necessary calibrationsprotected void
run(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, watchConsume
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.palladiosimulator.protocom.resourcestrategies.activeresource.IDemandStrategy
calibrate, consume, debugEnabled, ensureCalibrationExists, hasCalibrationTable, setCalibrationListener, setCalibrationTable, setDebug, setProperties
-
-
-
-
Constructor Detail
-
ReadLargeChunksDemand
public ReadLargeChunksDemand()
-
ReadLargeChunksDemand
public ReadLargeChunksDemand(File path, int maxFileSize)
-
-
Method Detail
-
run
protected void run(long load)
Description copied from class:AbstractDemandStrategy
Template method. This starts running the strategy with the parameter load- Specified by:
run
in classAbstractDemandStrategy
- Parameters:
load
- Complexity parameter. Algorithm should take longer if parameter is larger, i.e., ideally run(a) < run(b) <==> a < b
-
getStrategysResource
public ResourceTypeEnum getStrategysResource()
Description copied from class:AbstractDemandStrategy
Template method to return the real hardware resource type simulated by this strategy- Specified by:
getStrategysResource
in interfaceIDemandStrategy
- Specified by:
getStrategysResource
in classAbstractDemandStrategy
- Returns:
- The resource type we can simulate
- See Also:
IDemandStrategy.getStrategysResource()
-
initializeStrategy
public void initializeStrategy(DegreeOfAccuracyEnum degreeOfAccuracy, double processingRate, String calibrationPath)
Description copied from interface:IDemandStrategy
Initialize the strategy and perform necessary calibrations- Specified by:
initializeStrategy
in interfaceIDemandStrategy
- Overrides:
initializeStrategy
in 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:
IDemandStrategy.initializeStrategy(DegreeOfAccuracyEnum, double, String)
-
initializeStrategy
public void initializeStrategy(DegreeOfAccuracyEnum degreeOfAccuracy, double processingRate)
Description copied from interface:IDemandStrategy
Initialize the strategy and perform necessary calibrations- Specified by:
initializeStrategy
in interfaceIDemandStrategy
- Overrides:
initializeStrategy
in 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:
IDemandStrategy.initializeStrategy(DegreeOfAccuracyEnum, double)
-
getMaxFileSize
public int getMaxFileSize()
-
getName
public String getName()
Description copied from class:AbstractDemandStrategy
Template method to return the name of this strategy- Specified by:
getName
in interfaceIDemandStrategy
- Specified by:
getName
in classAbstractDemandStrategy
- Returns:
- a string containing the name of the strategy
- See Also:
IDemandStrategy.getName()
-
cleanup
public void cleanup()
Description copied from interface:IDemandStrategy
Do cleanup work.- Specified by:
cleanup
in interfaceIDemandStrategy
-
-