1 | package de.uka.ipd.sdq.probespec.framework.calculator; |
2 | |
3 | import java.util.Vector; |
4 | |
5 | import javax.measure.unit.SI; |
6 | |
7 | import de.uka.ipd.sdq.pipesandfilters.framework.CaptureType; |
8 | import de.uka.ipd.sdq.pipesandfilters.framework.MeasurementMetric; |
9 | import de.uka.ipd.sdq.pipesandfilters.framework.Scale; |
10 | import de.uka.ipd.sdq.probespec.framework.ProbeSpecContext; |
11 | import de.uka.ipd.sdq.probespec.framework.ProbeType; |
12 | |
13 | /** |
14 | * Calculates a time span representing the response time. It expects two |
15 | * ProbeSets each containing at least a {@link ProbeType#CURRENT_TIME} probe. |
16 | * |
17 | * @author Faber, Philipp Merkle |
18 | * @see BinaryCalculator |
19 | * @see Calculator |
20 | */ |
21 | public class ResponseTimeCalculator extends TimeSpanCalculator { |
22 | |
23 | private static Vector<MeasurementMetric> concreteMeasurementMetrics; |
24 | |
25 | /** |
26 | * Default Constructor. |
27 | * |
28 | * @param ctx |
29 | * the {@link ProbeSpecContext} |
30 | * @param startProbeSetID |
31 | * ID of the start probe set element from the model |
32 | * @param endProbeSetID |
33 | * ID of the end probe set element from the model |
34 | */ |
35 | public ResponseTimeCalculator(ProbeSpecContext ctx, Integer startProbeSetID, Integer endProbeSetID) { |
36 | super(ctx, startProbeSetID, endProbeSetID); |
37 | } |
38 | |
39 | /** |
40 | * Initializes the metric information for the result of this calculator |
41 | * type. The method is called by the constructor of the super class. |
42 | */ |
43 | @Override |
44 | protected synchronized Vector<MeasurementMetric> getConcreteMeasurementMetrics() { |
45 | if (concreteMeasurementMetrics == null) { |
46 | concreteMeasurementMetrics = new Vector<MeasurementMetric>(); |
47 | // TODO Specifying the unit here could be problematic since it can |
48 | // conflict with the actually measured unit |
49 | MeasurementMetric mm = new MeasurementMetric( |
50 | CaptureType.NATURAL_NUMBER, SI.MILLI(SI.SECOND), |
51 | Scale.ORDINAL); |
52 | mm.setDescription("This measure represents the response time"); |
53 | mm.setMonotonic(false); |
54 | mm.setName("Response Time"); |
55 | mm.setStrongMonotonic(false); |
56 | concreteMeasurementMetrics.add(mm); |
57 | } |
58 | return concreteMeasurementMetrics; |
59 | } |
60 | |
61 | } |