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
Nested Classes Modifier and Type Class Description static classFailureStatistics.FailureType
-
Constructor Summary
Constructors Constructor Description FailureStatistics()The constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.palladiosimulator.metricspec.IdentifiergetExecutionResultId(MarkovFailureType failureType)Retrieves the id of a given execution result.org.palladiosimulator.probeframework.probes.EventProbe<FailureStatistics>getExecutionResultProbe()MarkovFailureTypegetExternalHardwareFailureType(String resourceTypeId, String systemRequiredRoleId, String signatureId)Retrieves the system-external hardware-induced failure type with the given ids.MarkovFailureTypegetExternalNetworkFailureType(String commLinkResourceTypeId, String systemRequiredRoleId, String signatureId)Retrieves the system-external network-induced failure type with the given ids.MarkovFailureTypegetExternalSoftwareFailureType(String softwareFailureId, String systemRequiredRoleId, String signatureId)Retrieves the system-external software-induced failure type with the given id.longgetFailureCount(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.MarkovFailureTypegetFailureType(String failureTypeId)Retrieves the failure type with the given id.org.palladiosimulator.metricspec.IdentifiergetFailureTypeIndex(MarkovFailureType failureType)Retrieves the numerical index that corresponds to a given failure typeMarkovFailureTypegetInternalHardwareFailureType(String resourceContainerId, String resourceTypeId)Retrieves the system-internal hardware-induced failure type with the given ids.MarkovFailureTypegetInternalNetworkFailureType(String linkingResourceId, String commLinkResourceTypeId)Retrieves the system-internal network-induced failure type with the given ids.MarkovFailureTypegetInternalSoftwareFailureType(String softwareFailureId, String internalActionId)Retrieves the system-internal software-induced failure type with the given id.MarkovFailureTypegetResourceTimeoutFailureType(String assemblyContextId, String passiveResourceId)Retrieves the system-internal passive resource timeout failure type with the given ids.longgetRunCount()Retrieves the current usage scenario run count.voidincreaseFailureCounter(FailureStatistics.FailureType failureKind, MarkovFailureType failureType)Increases the counter for handled failures for the defined type.voidincreaseRunCount()Increases total scenario run counter by one.voidincreaseUnhandledFailureCounter(MarkovFailureType failureType, Long sessionId)Inceases the unhandled failure counter for the defined type.voidprintFailureStatistics(org.apache.log4j.Logger logger, double simulationTime)Prints failure and handling statistics to a logger.voidprintHandledFailuresStatistics(org.apache.log4j.Logger logger, double simulationTime)Prints handling statistics to a logger.voidprintRunCount(org.apache.log4j.Logger logger, double simulationTime)Prints intermediate failure statistics to logger.voidrecordSuccess()static voidsetFailureTypes(List<MarkovFailureType> failureTypes)FIXME should not be static Sets the failure types that may occur during the simulation.
-
-
-
Method Detail
-
getExecutionResultProbe
public org.palladiosimulator.probeframework.probes.EventProbe<FailureStatistics> getExecutionResultProbe()
-
increaseUnhandledFailureCounter
public void increaseUnhandledFailureCounter(MarkovFailureType failureType, Long sessionId)
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
public MarkovFailureType getFailureType(String failureTypeId)
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
public long getFailureCount(FailureStatistics.FailureType failureType)
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
public static void setFailureTypes(List<MarkovFailureType> failureTypes)
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
-
-