Class FailureStatistics
java.lang.Object
org.palladiosimulator.commons.designpatterns.AbstractObservable<IFailureStatisticsListener>
org.palladiosimulator.reliability.FailureStatistics
- All Implemented Interfaces:
org.palladiosimulator.commons.designpatterns.IAbstractObservable<IFailureStatisticsListener>
public class FailureStatistics
extends org.palladiosimulator.commons.designpatterns.AbstractObservable<IFailureStatisticsListener>
Singleton class that is used for counting simulated failures and printing statistics.
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.palladiosimulator.metricspec.Identifier
getExecutionResultId
(MarkovFailureType failureType) Retrieves the id of a given execution result.org.palladiosimulator.probeframework.probes.EventProbe<FailureStatistics>
getExternalHardwareFailureType
(String resourceTypeId, String systemRequiredRoleId, String signatureId) Retrieves the system-external hardware-induced failure type with the given ids.getExternalNetworkFailureType
(String commLinkResourceTypeId, String systemRequiredRoleId, String signatureId) Retrieves the system-external network-induced failure type with the given ids.getExternalSoftwareFailureType
(String softwareFailureId, String systemRequiredRoleId, String signatureId) Retrieves the system-external software-induced failure type with the given id.long
getFailureCount
(FailureStatistics.FailureType failureType) Retrieves the total number of handled failure occurrences.org.apache.commons.collections15.Bag<MarkovFailureType>
getFailureCounters
(FailureStatistics.FailureType failureType) Retrieves the counters for all handled failure occurrences.getFailureType
(String failureTypeId) Retrieves the failure type with the given id.org.palladiosimulator.metricspec.Identifier
getFailureTypeIndex
(MarkovFailureType failureType) Retrieves the numerical index that corresponds to a given failure typegetInternalHardwareFailureType
(String resourceContainerId, String resourceTypeId) Retrieves the system-internal hardware-induced failure type with the given ids.getInternalNetworkFailureType
(String linkingResourceId, String commLinkResourceTypeId) Retrieves the system-internal network-induced failure type with the given ids.getInternalSoftwareFailureType
(String softwareFailureId, String internalActionId) Retrieves the system-internal software-induced failure type with the given id.getResourceTimeoutFailureType
(String assemblyContextId, String passiveResourceId) Retrieves the system-internal passive resource timeout failure type with the given ids.long
Retrieves the current usage scenario run count.void
increaseFailureCounter
(FailureStatistics.FailureType failureKind, MarkovFailureType failureType) Increases the counter for handled failures for the defined type.void
Increases total scenario run counter by one.void
increaseUnhandledFailureCounter
(MarkovFailureType failureType, Long sessionId) Inceases the unhandled failure counter for the defined type.void
printFailureStatistics
(org.apache.log4j.Logger logger, double simulationTime) Prints failure and handling statistics to a logger.void
printHandledFailuresStatistics
(org.apache.log4j.Logger logger, double simulationTime) Prints handling statistics to a logger.void
printRunCount
(org.apache.log4j.Logger logger, double simulationTime) Prints intermediate failure statistics to logger.void
static void
setFailureTypes
(List<MarkovFailureType> failureTypes) FIXME should not be static Sets the failure types that may occur during the simulation.Methods inherited from class org.palladiosimulator.commons.designpatterns.AbstractObservable
addObserver, getEventDispatcher, getObservers, removeAllObserver, removeObserver
-
Constructor Details
-
FailureStatistics
public FailureStatistics()The constructor.
-
-
Method Details
-
getExecutionResultProbe
public org.palladiosimulator.probeframework.probes.EventProbe<FailureStatistics> getExecutionResultProbe() -
increaseUnhandledFailureCounter
Inceases the unhandled failure counter for the defined type. An unhandled failure means also a failed run. Thus, the list of failed runs is also updated with the given session id.- Parameters:
failureType
- the failure typesessionId
- the session id of the current run
-
getExecutionResultId
public org.palladiosimulator.metricspec.Identifier getExecutionResultId(MarkovFailureType failureType) Retrieves the id of a given execution result. Used for logging sensor data.- Parameters:
failureType
- the failure type that occurred as an execution result- Returns:
- the numerical id of the execution result
-
getExternalHardwareFailureType
public MarkovFailureType getExternalHardwareFailureType(String resourceTypeId, String systemRequiredRoleId, String signatureId) Retrieves the system-external hardware-induced failure type with the given ids.- Parameters:
resourceTypeId
- the resource type idsystemRequiredRoleId
- the id of the corresponding system-external rolesignatureId
- the id of the corresponding system-external signature- Returns:
- the corresponding failure type
-
getExternalNetworkFailureType
public MarkovFailureType getExternalNetworkFailureType(String commLinkResourceTypeId, String systemRequiredRoleId, String signatureId) Retrieves the system-external network-induced failure type with the given ids.- Parameters:
commLinkResourceTypeId
- the communication link resource type idsystemRequiredRoleId
- the id of the corresponding system-external rolesignatureId
- the id of the corresponding system-external signature- Returns:
- the corresponding failure type
-
getExternalSoftwareFailureType
public MarkovFailureType getExternalSoftwareFailureType(String softwareFailureId, String systemRequiredRoleId, String signatureId) Retrieves the system-external software-induced failure type with the given id.- Parameters:
softwareFailureId
- the software-induced failure type idsystemRequiredRoleId
- the id of the corresponding system-external rolesignatureId
- the id of the corresponding system-external signature- Returns:
- the corresponding failure type
-
getFailureType
Retrieves the failure type with the given id.- Parameters:
failureTypeId
- the failure type id- Returns:
- the failure type
-
getFailureTypeIndex
public org.palladiosimulator.metricspec.Identifier getFailureTypeIndex(MarkovFailureType failureType) Retrieves the numerical index that corresponds to a given failure type- Parameters:
failureType
- the failure type- Returns:
- the corresponding index
-
getFailureCount
Retrieves the total number of handled failure occurrences.- Returns:
- The number of handled failure occurrences
-
getFailureCounters
public org.apache.commons.collections15.Bag<MarkovFailureType> getFailureCounters(FailureStatistics.FailureType failureType) Retrieves the counters for all handled failure occurrences.- Returns:
- the counters
-
getInternalHardwareFailureType
public MarkovFailureType getInternalHardwareFailureType(String resourceContainerId, String resourceTypeId) Retrieves the system-internal hardware-induced failure type with the given ids.- Parameters:
resourceContainerId
- the resource container idresourceTypeId
- the resource type id- Returns:
- the corresponding failure type
-
getInternalNetworkFailureType
public MarkovFailureType getInternalNetworkFailureType(String linkingResourceId, String commLinkResourceTypeId) Retrieves the system-internal network-induced failure type with the given ids.- Parameters:
linkingResourceId
- the linking resource idcommLinkResourceTypeId
- the communication link resource type id- Returns:
- the corresponding failure type
-
getInternalSoftwareFailureType
public MarkovFailureType getInternalSoftwareFailureType(String softwareFailureId, String internalActionId) Retrieves the system-internal software-induced failure type with the given id.- Parameters:
softwareFailureId
- the software-induced failure type idinternalActionId
- the surrounding internal action id- Returns:
- the corresponding failure type
-
getResourceTimeoutFailureType
public MarkovFailureType getResourceTimeoutFailureType(String assemblyContextId, String passiveResourceId) Retrieves the system-internal passive resource timeout failure type with the given ids.- Parameters:
assemblyContextId
- the id of the surrounding assembly contextpassiveResourceId
- the passive resource id- Returns:
- the corresponding failure type
-
getRunCount
public long getRunCount()Retrieves the current usage scenario run count.- Returns:
- the usage scenario run count
-
increaseFailureCounter
public void increaseFailureCounter(FailureStatistics.FailureType failureKind, MarkovFailureType failureType) Increases the counter for handled failures for the defined type.- Parameters:
MarkovFailureType
- the failure type
-
recordSuccess
public void recordSuccess() -
increaseRunCount
public void increaseRunCount()Increases total scenario run counter by one. -
printFailureStatistics
public void printFailureStatistics(org.apache.log4j.Logger logger, double simulationTime) Prints failure and handling statistics to a logger.- Parameters:
logger
- The logger to write the statistics tosimulationTime
-
-
printRunCount
public void printRunCount(org.apache.log4j.Logger logger, double simulationTime) Prints intermediate failure statistics to logger.- Parameters:
logger
- The logger to write the statistics tosimulationTime
-
-
setFailureTypes
FIXME should not be static Sets the failure types that may occur during the simulation.- Parameters:
failureTypes
- the list of failure types
-
printHandledFailuresStatistics
public void printHandledFailuresStatistics(org.apache.log4j.Logger logger, double simulationTime) Prints handling statistics to a logger.- Parameters:
logger
- The logger to write the statistics tosimulationTime
- The overall simulated time to calculate rates
-