Class ExperimentManager
- java.lang.Object
-
- java.rmi.server.RemoteObject
-
- java.rmi.server.RemoteServer
-
- java.rmi.server.UnicastRemoteObject
-
- org.palladiosimulator.protocom.framework.java.se.experiment.ExperimentManager
-
- All Implemented Interfaces:
Serializable
,Remote
,IExperimentManager
public class ExperimentManager extends UnicastRemoteObject implements IExperimentManager, Serializable
Manages the time span sensors and measurements.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.apache.log4j.Logger
LOGGER
-
Fields inherited from class java.rmi.server.RemoteObject
ref
-
Fields inherited from interface org.palladiosimulator.protocom.framework.java.se.experiment.IExperimentManager
EXPERIMENT_MANAGER_MASTER, EXPERIMENT_MANAGER_SLAVE
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ExperimentManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static de.uka.ipd.sdq.sensorframework.entities.ExperimentRun
addExperimentRun()
Adds a new experiment run to the experiment.void
createExperimentRun()
static de.uka.ipd.sdq.sensorframework.entities.TimeSpanSensor
createOrReuseTimeSpanSensor(String sensorName)
Returns aTimeSpanSensor
in the experiment that has the name sensorName.static de.uka.ipd.sdq.sensorframework.entities.Experiment
getExperiment()
static ExperimentManager
getInstance()
static de.uka.ipd.sdq.sensorframework.entities.ExperimentRun
getLatestExperimentRun()
Returns the newest experiment run instance.String
getName()
static void
init(String experimentName, String directory, int remoteType)
Creates a factory for file DAOs.void
startNewExperimentRun()
Start a new experiment run.static void
takeMeasurement(long start, de.uka.ipd.sdq.sensorframework.entities.ExperimentRun experimentRun, de.uka.ipd.sdq.sensorframework.entities.TimeSpanSensor timeSpanSensor)
Takes a measurement (from start time till current time) on the given sensorstatic long
takeStartTimeForInnerMeasurement()
Restored this from an older version.void
writeResultsAndClose()
Writes the experiment run to the specified DAO source.-
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObject
-
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
-
-
-
-
Constructor Detail
-
ExperimentManager
protected ExperimentManager() throws RemoteException
- Throws:
RemoteException
-
-
Method Detail
-
getInstance
public static ExperimentManager getInstance()
-
getName
public String getName() throws RemoteException
- Specified by:
getName
in interfaceIExperimentManager
- Throws:
RemoteException
-
getExperiment
public static de.uka.ipd.sdq.sensorframework.entities.Experiment getExperiment()
-
addExperimentRun
public static de.uka.ipd.sdq.sensorframework.entities.ExperimentRun addExperimentRun()
Adds a new experiment run to the experiment. Current date is used for as date.- Returns:
- the newly created experiment run
-
takeStartTimeForInnerMeasurement
public static long takeStartTimeForInnerMeasurement()
Restored this from an older version. Will be changed eventually.- Returns:
-
takeMeasurement
public static void takeMeasurement(long start, de.uka.ipd.sdq.sensorframework.entities.ExperimentRun experimentRun, de.uka.ipd.sdq.sensorframework.entities.TimeSpanSensor timeSpanSensor)
Takes a measurement (from start time till current time) on the given sensor- Parameters:
start
- start timeexperimentRun
-timeSpanSensor
- sensor
-
createOrReuseTimeSpanSensor
public static de.uka.ipd.sdq.sensorframework.entities.TimeSpanSensor createOrReuseTimeSpanSensor(String sensorName)
Returns aTimeSpanSensor
in the experiment that has the name sensorName. Creates a new sensor and returns it of no sensor with this name exists. The reuse is required because the EJB container may decide at times to create new instances of the components, so for one component type and one signature, this method may be called multiple times during the measurements. We want to store all results per component type into one sensor, though.- Parameters:
sensorName
- The sensor name to match- Returns:
- The
TimeSpanSensor
with the passed name or a newTimeSpanSensor
with that name that is then also added to the experiment.
-
getLatestExperimentRun
public static de.uka.ipd.sdq.sensorframework.entities.ExperimentRun getLatestExperimentRun()
Returns the newest experiment run instance. If no one exists, a new experiment run will be created. Note that the experiment run usually should be created explicitly and not here. This one is just a (quick) fix to get measurements from sensors running on instances different from the usage scenario.- Returns:
- latest experiment run instance or a new one
-
init
public static void init(String experimentName, String directory, int remoteType)
Creates a factory for file DAOs.
-
createExperimentRun
public void createExperimentRun()
-
writeResultsAndClose
public void writeResultsAndClose() throws RemoteException
Description copied from interface:IExperimentManager
Writes the experiment run to the specified DAO source.- Specified by:
writeResultsAndClose
in interfaceIExperimentManager
- Throws:
RemoteException
-
startNewExperimentRun
public void startNewExperimentRun() throws RemoteException
Description copied from interface:IExperimentManager
Start a new experiment run.- Specified by:
startNewExperimentRun
in interfaceIExperimentManager
- Throws:
RemoteException
-
-