1 | package de.uka.ipd.sdq.pipesandfilters.framework.recorder.sensorframework.strategies; |
2 | |
3 | import javax.measure.Measure; |
4 | import javax.measure.quantity.Duration; |
5 | import javax.measure.unit.SI; |
6 | |
7 | import de.uka.ipd.sdq.pipesandfilters.framework.PipeData; |
8 | import de.uka.ipd.sdq.sensorframework.entities.Experiment; |
9 | import de.uka.ipd.sdq.sensorframework.entities.ExperimentRun; |
10 | import de.uka.ipd.sdq.sensorframework.entities.TimeSpanSensor; |
11 | import de.uka.ipd.sdq.sensorframework.entities.dao.IDAOFactory; |
12 | |
13 | public class ResponseTimeWriteDataStrategy extends AbstractWriteDataStrategy { |
14 | |
15 | public ResponseTimeWriteDataStrategy(IDAOFactory daoFactory, |
16 | Experiment experiment, ExperimentRun run) { |
17 | super(daoFactory, experiment, run); |
18 | } |
19 | |
20 | @SuppressWarnings("unchecked") |
21 | @Override |
22 | public void writeData(PipeData data) { |
23 | Measure<Double, Duration> waitingTimeMeasure = (Measure<Double, Duration>) data |
24 | .getTupleElement(0); |
25 | Measure<Double, Duration> eventTimeMeasure = (Measure<Double, Duration>) data |
26 | .getTupleElement(1); |
27 | double waitingTime = waitingTimeMeasure.doubleValue(SI.SECOND); |
28 | double eventTime = eventTimeMeasure.doubleValue(SI.SECOND); |
29 | run.addTimeSpanMeasurement((TimeSpanSensor)sensor, eventTime, waitingTime); |
30 | } |
31 | |
32 | |
33 | |
34 | } |