EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.simucomframework]

COVERAGE SUMMARY FOR SOURCE FILE [ReliabilitySensorHelper.java]

nameclass, %method, %block, %line, %
ReliabilitySensorHelper.java0%   (0/1)0%   (0/6)0%   (0/175)0%   (0/48)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ReliabilitySensorHelper0%   (0/1)0%   (0/6)0%   (0/175)0%   (0/48)
ReliabilitySensorHelper (): void 0%   (0/1)0%   (0/3)0%   (0/1)
getScenarioProbeSetId (String): String 0%   (0/1)0%   (0/8)0%   (0/1)
recordExternalCallResult (String, String, FailureException, SimuComModel, Req... 0%   (0/1)0%   (0/79)0%   (0/21)
recordScenarioResult (SimuComModel, MarkovFailureType, RequestContext, String... 0%   (0/1)0%   (0/73)0%   (0/20)
recordScenarioRunResultFailure (SimuComModel, MarkovFailureType, RequestConte... 0%   (0/1)0%   (0/6)0%   (0/3)
recordScenarioRunResultSuccess (SimuComModel, RequestContext, String): void 0%   (0/1)0%   (0/6)0%   (0/2)

1package de.uka.ipd.sdq.simucomframework;
2 
3import javax.measure.quantity.Quantity;
4 
5import de.uka.ipd.sdq.probespec.framework.ProbeSample;
6import de.uka.ipd.sdq.probespec.framework.ProbeSetSample;
7import de.uka.ipd.sdq.probespec.framework.ProbeType;
8import de.uka.ipd.sdq.probespec.framework.RequestContext;
9import de.uka.ipd.sdq.probespec.framework.probes.IProbeStrategy;
10import de.uka.ipd.sdq.probespec.framework.utils.ProbeSpecUtils;
11import de.uka.ipd.sdq.reliability.core.FailureStatistics;
12import de.uka.ipd.sdq.reliability.core.MarkovFailureType;
13import de.uka.ipd.sdq.simucomframework.exceptions.FailureException;
14import de.uka.ipd.sdq.simucomframework.model.SimuComModel;
15 
16/**
17 * This class provides auxiliary functionality for capturing
18 * reliability-relevant sensor data during the simulation.
19 * 
20 * @author brosch
21 * 
22 */
23public class ReliabilitySensorHelper {
24 
25        /**
26         * A ProbeSet ID for capturing the execution result of a usage scenario.
27         */
28        private static final String SCENARIO_RESULT_PROBESET_ID = "scenarioRunProbeSet";
29 
30        /**
31         * A Probe ID for the value of a usage scenario execution result.
32         */
33        private static final String SCENARIO_RESULT_STATE_PROBE_ID = "scenarioRunResultStateProbe";
34 
35        /**
36         * A Probe ID for the measurement time of a usage scenario execution result.
37         */
38        private static final String SCENARIO_RESULT_TIME_PROBE_ID = "scenarioRunResultTimeProbe";
39 
40        /**
41         * A Probe ID for the value of an external call execution result.
42         */
43        private static final String EXTERNAL_CALL_RESULT_STATE_PROBE_ID = "callResultStateProbe";
44 
45        /**
46         * A Probe ID for the measurement time of an external call execution result.
47         */
48        private static final String EXTERNAL_CALL_RESULT_TIME_PROBE_ID = "callResultTimeProbe";
49 
50        /**
51         * Retrieves a usage-scenario-specific execution result ProbeSet ID.
52         * 
53         * @param usageScenarioId
54         *            the ID of the PCM model element representing the usage
55         *            scenario
56         * @return the corresponding ProbeSet ID
57         */
58        public static String getScenarioProbeSetId(final String usageScenarioId) {
59                return SCENARIO_RESULT_PROBESET_ID + "/" + usageScenarioId;
60        }
61 
62        /**
63         * Records the execution result of a failed usage scenario run.
64         * 
65     * @param model
66     *            the simulation model providing access to the current 
67     *            simulated time
68         * @param failureType
69         *            the type of failure-on-demand occurrence (NULL for success)
70         * @param requestContext
71         *            the identification of the request context
72         * @param usageScenarioId
73         *            the ID of the PCM model element representing the usage
74         *            scenario
75         */
76        public static void recordScenarioRunResultFailure(
77                        final SimuComModel model,
78                        final MarkovFailureType failureType,
79                        final RequestContext requestContext, final String usageScenarioId) {
80                recordScenarioResult(model, failureType, requestContext,
81                                usageScenarioId);
82        }
83 
84        /**
85         * Records a successfully completed execution scenario run.
86         * 
87     * @param model
88     *            the simulation model providing access to the current 
89     *            simulated time
90         * @param requestContext
91         *            the identification of the request context
92         * @param usageScenarioId
93         *            the ID of the PCM model element representing the usage
94         *            scenario
95         */
96        public static synchronized void recordScenarioRunResultSuccess(
97                        final SimuComModel model,
98                        final RequestContext requestContext, final String usageScenarioId) {
99                recordScenarioResult(model, null, requestContext, usageScenarioId);
100        }
101 
102    /**
103     * Records the execution result of a usage scenario run.
104     * 
105     * @param model
106     *            the simulation model providing access to the current 
107     *            simulated time
108     * @param failureType
109     *            the type of failure-on-demand occurrence (NULL for success)
110     * @param requestContext
111     *            the identification of the request context
112     * @param usageScenarioId
113     *            the ID of the PCM model element representing the usage scenario
114     */
115        private static void recordScenarioResult(
116                        final SimuComModel model,
117                        final MarkovFailureType failureType,
118                        final RequestContext requestContext, final String usageScenarioId) {
119                IProbeStrategy takeTimeStrategy = model.getProbeSpecContext()
120                        .getProbeStrategyRegistry().getProbeStrategy(
121                                                ProbeType.CURRENT_TIME, null);
122                IProbeStrategy takeResultStrategy = model.getProbeSpecContext()
123        .getProbeStrategyRegistry().getProbeStrategy(
124                                                ProbeType.EXECUTION_RESULT, null);
125                int stateId = FailureStatistics.getInstance().getExecutionResultId(
126                                failureType);
127                int probeSetId = model.getProbeSpecContext().obtainProbeSetId(
128                                getScenarioProbeSetId(usageScenarioId));
129                ProbeSample<?, ? extends Quantity> timeSample = takeTimeStrategy
130                                .takeSample(SCENARIO_RESULT_TIME_PROBE_ID + "/"
131                                                + usageScenarioId, model.getSimulationControl());
132                ProbeSample<?, ? extends Quantity> stateSample = takeResultStrategy
133                                .takeSample(SCENARIO_RESULT_STATE_PROBE_ID + "/"
134                                                + usageScenarioId, stateId);
135                ProbeSetSample sample = ProbeSpecUtils.buildProbeSetSample(timeSample,
136                                stateSample, requestContext, usageScenarioId, probeSetId);
137                model.getProbeSpecContext().getSampleBlackboard().addSample(sample);
138        }
139 
140        /**
141         * Records the execution results of an external call action.
142         * 
143         * @param callName
144         *            the call name of the external call action
145         * @param externalCallId
146         *            the probe set id of the external call action
147         * @param exception
148         *            the occurred failure exception (if any)
149         * @param simControl
150         *            the simulation control object, keeping the current simulated
151         *            time
152         * @param requestContext
153         *            the identification of the request context
154         */
155        public static synchronized void recordExternalCallResult(
156                        final String callName, final String externalCallId,
157                        final FailureException exception,
158                        final SimuComModel model,
159                        final RequestContext requestContext) {
160                IProbeStrategy takeTimeStrategy = model.getProbeSpecContext()
161                                .getProbeStrategyRegistry().getProbeStrategy(
162                                                ProbeType.CURRENT_TIME, null);
163                IProbeStrategy takeResultStrategy = model.getProbeSpecContext()
164                                .getProbeStrategyRegistry().getProbeStrategy(
165                                                ProbeType.EXECUTION_RESULT, null);
166                MarkovFailureType failureType = (exception == null) ? null : exception
167                                .getFailureType();
168                int stateId = FailureStatistics.getInstance().getExecutionResultId(
169                                failureType);
170                int probeSetId = model.getProbeSpecContext().obtainProbeSetId(callName);
171                ProbeSample<?, ? extends Quantity> timeSample = takeTimeStrategy
172                                .takeSample(EXTERNAL_CALL_RESULT_TIME_PROBE_ID + "/"
173                                                + probeSetId, model.getSimulationControl());
174                ProbeSample<?, ? extends Quantity> stateSample = takeResultStrategy
175                                .takeSample(EXTERNAL_CALL_RESULT_STATE_PROBE_ID + "/"
176                                                + probeSetId, stateId);
177                ProbeSetSample sample = ProbeSpecUtils.buildProbeSetSample(timeSample,
178                                stateSample, requestContext, externalCallId, probeSetId);
179                model.getProbeSpecContext().getSampleBlackboard().addSample(sample);
180        }
181}

[all classes][de.uka.ipd.sdq.simucomframework]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov