Class RMeasurementStore
- java.lang.Object
-
- edu.kit.ipd.sdq.eventsim.measurement.r.RMeasurementStore
-
- All Implemented Interfaces:
MeasurementStorage
public class RMeasurementStore extends Object implements MeasurementStorage
StoresMeasurements into R using Rserve (for details on Rserve see https://rforge.net/Rserve).Measurements are buffered and sent to R as a batch once the buffer size reaches its capacity. Increasing the buffer capacity improves performance at the cost of higher memory consumption (this needs to be further evaluated, however).
-
-
Constructor Summary
Constructors Constructor Description RMeasurementStore(RserveConnection connection)Use this constructor when no RDS file is to be created upon finish.RMeasurementStore(RserveConnection connection, String rdsFilePath)Use this constructor when an RDS file is to be created upon finish.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddIdExtractor(Class<? extends Object> elementClass, Function<Object,String> extractionFunction)voidaddMetadata(Metadata... metadata)Adds global metadata that will be appended to eachMeasurementadded viaMeasurementStorage.put(Measurement).voidaddMetadata(List<Metadata> metadata)voidaddNameExtractor(Class<? extends Object> elementClass, Function<Object,String> extractionFunction)voidaddTypeExtractor(Class<? extends Object> elementClass, Function<Object,String> extractionFunction)voidfinish()static RMeasurementStorefromLaunchConfiguration(Map<String,Object> configuration, RserveConnection connection)Constructs aRMeasurementStoreby extracting configuration options from the provided launch configuration.voidput(Measurement<?> m)Stores the given measurement.voidstart()
-
-
-
Constructor Detail
-
RMeasurementStore
public RMeasurementStore(RserveConnection connection)
Use this constructor when no RDS file is to be created upon finish.
-
RMeasurementStore
public RMeasurementStore(RserveConnection connection, String rdsFilePath)
Use this constructor when an RDS file is to be created upon finish.- Parameters:
rdsFilePath- the location of the file to be created.
-
-
Method Detail
-
fromLaunchConfiguration
public static RMeasurementStore fromLaunchConfiguration(Map<String,Object> configuration, RserveConnection connection)
Constructs aRMeasurementStoreby extracting configuration options from the provided launch configuration.- Parameters:
configuration- the launch configuration- Returns:
- the constructed
RMeasurementStore, ornullif expected configuration options could not be found in the provided launch configuration.
-
addIdExtractor
public void addIdExtractor(Class<? extends Object> elementClass, Function<Object,String> extractionFunction)
Description copied from interface:MeasurementStorageAdds a mapping (by means of aFunction) fromObjects of a fixed type toStrings that uniquely identify (id) objects of the specifiedtype. This allows to extract ids from arbitraryObjects without dictating an interface.- Specified by:
addIdExtractorin interfaceMeasurementStorage- Parameters:
elementClass- the type's classextractionFunction- the function that mapstypeinstances to id-Strings.
-
addNameExtractor
public void addNameExtractor(Class<? extends Object> elementClass, Function<Object,String> extractionFunction)
- Specified by:
addNameExtractorin interfaceMeasurementStorage- Parameters:
elementClass- the type's classextractionFunction- the function that mapstypeinstances to name-Strings.- See Also:
MeasurementStorage.addIdExtractor(Class, Function)
-
addTypeExtractor
public void addTypeExtractor(Class<? extends Object> elementClass, Function<Object,String> extractionFunction)
- Specified by:
addTypeExtractorin interfaceMeasurementStorageextractionFunction- the function that mapstypeinstances to type-Strings.- See Also:
MeasurementStorage.addIdExtractor(Class, Function)
-
put
public void put(Measurement<?> m)
Description copied from interface:MeasurementStorageStores the given measurement.- Specified by:
putin interfaceMeasurementStorage- Parameters:
m- the measurement to be added
-
addMetadata
public void addMetadata(Metadata... metadata)
Description copied from interface:MeasurementStorageAdds global metadata that will be appended to eachMeasurementadded viaMeasurementStorage.put(Measurement).- Specified by:
addMetadatain interfaceMeasurementStorage- Parameters:
metadata- the global metadata to be appended
-
addMetadata
public void addMetadata(List<Metadata> metadata)
- Specified by:
addMetadatain interfaceMeasurementStorage- See Also:
MeasurementStorage.addMetadata(Metadata...)
-
start
public void start() throws MeasurementStorageStartException- Specified by:
startin interfaceMeasurementStorage- Throws:
MeasurementStorageStartException
-
finish
public void finish()
- Specified by:
finishin interfaceMeasurementStorage
-
-