Class 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.
    • Constructor Detail

      • FailureStatistics

        public FailureStatistics()
        The constructor.
    • 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 type
        sessionId - 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 id
        systemRequiredRoleId - the id of the corresponding system-external role
        signatureId - 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 id
        systemRequiredRoleId - the id of the corresponding system-external role
        signatureId - 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 id
        systemRequiredRoleId - the id of the corresponding system-external role
        signatureId - 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 id
        resourceTypeId - 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 id
        commLinkResourceTypeId - 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 id
        internalActionId - 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 context
        passiveResourceId - 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 to
        simulationTime -
      • 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 to
        simulationTime -
      • 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 to
        simulationTime - The overall simulated time to calculate rates