Package org.eclipse.app4mc.amalthea.model.util

## Class RuntimeUtil

- Object
- - RuntimeUtil

    public class RuntimeUtil
    extends Object

### Nested Class Summary

Nested Classes
`static class` `RuntimeUtil.AccessDirection`
`static class` `RuntimeUtil.PositionType`
`static class` `RuntimeUtil.TimeType`

### Method Summary

All Methods
`static Runnable` `addRuntimeToProcessAsNewRunnable​(Process process, ExecutionNeed need, String runnableName, RuntimeUtil.PositionType positon)` Creates a new Runnable with the given runtime at beginning / end of the given process
`static Runnable` `addRuntimeToProcessAsNewRunnable​(Process process, Ticks ticks, String runnableName, RuntimeUtil.PositionType positon)` Creates a new Runnable with the given runtime at beginning / end of the given process
`static void` `addRuntimeToRunnable​(Runnable runnable, ExecutionNeed need)` Adds Runtime (given as ExecutionNeed) to an existing Runnable currently without consideration of modes
`static void` `addRuntimeToRunnable​(Runnable runnable, Ticks ticks)` Adds Runtime (given as Ticks) to an existing Runnable currently without consideration of modes
`static void` `clearRuntimeOfModel​(Amalthea model, EMap<ModeLabel,​String> modes)` Clears all runtime information (execution needs and ticks)
`static void` `clearRuntimeOfProcess​(Process process, EMap<ModeLabel,​String> modes)` Clears all runtime information (execution needs and ticks)
`static void` `clearRuntimeOfRunnable​(Runnable runnable, EMap<ModeLabel,​String> modes)` Clears all runtime information (execution needs and ticks)
`static Map<Process,​Double>` `getCumulativeProcessUtilizations​(Amalthea model, RuntimeUtil.TimeType tt, List<HwFeature> hwFeatures, EMap<ModeLabel,​String> modes)` Returns the cumulative process utilization, i.e. runtime on every procUnit summed up
`static Time` `getExecutionTimeForCycles​(double ticks, Frequency frequency)` Computes time for a number of ticks with a given frequency
`static Time` `getExecutionTimeForExecutionNeedEntry​(IDiscreteValueDeviation deviation, HwFeatureCategory hwFeatureCategory, ProcessingUnit processingUnit, RuntimeUtil.TimeType executionCase)` Computes time for specific execution need entry on a given processing unit
`static Time` `getExecutionTimeForExecutionNeeds​(ExecutionNeed need, ProcessingUnit processingUnit, RuntimeUtil.TimeType executionCase)` Computes time for execution needs on a given processing unit
`static Time` `getExecutionTimeForProcess​(Process process, ProcessingUnit processingUnit, EMap<ModeLabel,​String> modes, RuntimeUtil.TimeType executionCase)` Computes the execution time of a Process (Task or ISR) on a given processing unit
`static Time` `getExecutionTimeForProcess​(Process process, EMap<ModeLabel,​String> modes, RuntimeUtil.TimeType executionCase)` Computes the execution time of a Process (Task or ISR) - unique mapping is required
`static Time` `getExecutionTimeForRunnable​(Runnable runnable, ProcessingUnit processingUnit, EMap<ModeLabel,​String> modes, RuntimeUtil.TimeType executionCase)` Computes the execution time of a Runnable on a given processing unit
`static Time` `getExecutionTimeForTicks​(Ticks ticks, ProcessingUnit processingUnit, RuntimeUtil.TimeType executionCase)` Computes time for ticks on a given processing unit
`static Time` `getExecutionTimeForTicksDeviation​(IDiscreteValueDeviation deviation, ProcessingUnit processingUnit, RuntimeUtil.TimeType executionCase)` Computes time for ticks on a given processing unit
`static Map<Process,​List<Time>>` `getPeriodsOfAllProcesses​(Amalthea model, RuntimeUtil.TimeType tt, EMap<ModeLabel,​String> modes)` Gets all Period ranges from the model
`static List<Time>` `getPeriodsOfProcess​(Process process, RuntimeUtil.TimeType tt, EMap<ModeLabel,​String> modes)` Returns a list of all triggering periods.
`static Map<Stimulus,​Long>` `getPlainTriggerForProcess​(Process process, long depthCounter, Function<Stimulus,​Boolean> filter)` Returns all stimuli (matching filter) that trigger the given process
`static Map<Process,​Map<Stimulus,​Long>>` `getPlainTriggersForModel​(Amalthea model, Function<Stimulus,​Boolean> filter)` Returns a map from process to all stimuli (matching filter) that lead to that process with the correct prescaler
`static Map<Process,​List<ITimeDeviation>>` `getProcessesWithRelativePeriodicStimulus​(Amalthea model)` Returns a Map of all sporadically triggered processes with their prescaler
`static Map<Process,​List<Time>>` `getProcessesWithRelativePeriodicStimulus​(Amalthea model, RuntimeUtil.TimeType tt)` Returns a Map of all sporadically triggered processes with their prescaler
`static Map<ProcessingUnit,​Double>` `getProcessUtilization​(Process process, Amalthea model, RuntimeUtil.TimeType tt, List<HwFeature> hwFeatures, EMap<ModeLabel,​String> modes)` Calculates the utilization for a given process
`static double` `getProcessUtilization​(Process process, ProcessingUnit procUnit, Amalthea model, RuntimeUtil.TimeType tt, List<HwFeature> hwFeatures, EMap<ModeLabel,​String> modes)` Calculates the utilization for a given process on a given procUnit
`static double` `getProcessUtilization​(Process process, Time period, RuntimeUtil.TimeType tt, EMap<ModeLabel,​String> modes)` Calculates the process utilization
`static double` `getProcUnitUtilization​(ProcessingUnit procUnit, Amalthea model, RuntimeUtil.TimeType tt, List<HwFeature> hwFeatures, EMap<ModeLabel,​String> modes)` Calculates the utilization for a given procUnit
`static double` `getTicksForExecutionTime​(Time executionTime, Frequency frequency)` Computes ticks for a given time and frequency.
`static double` `getTicksForExecutionTimeInSeconds​(BigDecimal executionTime, Frequency frequency)` Computes ticks for a given time (in seconds) and frequency.
`static Map<Stimulus,​Long>` `getTriggeredStimuli​(Process process, EMap<ModeLabel,​String> modes)` Returns a map of all stimuli, triggered by this process, associated with its prescaler.
`static Map<Process,​Long>` `getTriggeringProcesses​(InterProcessStimulus ip, EMap<ModeLabel,​String> modes)` Returns all Processes that trigger the given InterProcessStimulus
`static void` `setRuntimeOfRunnable​(Runnable runnable, ExecutionNeed need, EMap<ModeLabel,​String> modes)` Sets the runtime of the given runnable to the given ExecutionNeed
`static void` `setRuntimeOfRunnable​(Runnable runnable, Ticks ticks, EMap<ModeLabel,​String> modes)` Sets the runtime of the given runnable to the given Ticks

### Methods inherited from class Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### getExecutionTimeForProcess

    public static Time getExecutionTimeForProcess​(Process process,
                                                  EMap<ModeLabel,​String> modes,
                                                  RuntimeUtil.TimeType executionCase)

Computes the execution time of a Process (Task or ISR) - unique mapping is required

Parameters:
  `process` - task or isr
  `modes` - (optional) - null works
  `executionCase` - BCET, ACET, WCET
Returns:
  execution time

#### getExecutionTimeForProcess

    public static Time getExecutionTimeForProcess​(Process process,
                                                  ProcessingUnit processingUnit,
                                                  EMap<ModeLabel,​String> modes,
                                                  RuntimeUtil.TimeType executionCase)

Computes the execution time of a Process (Task or ISR) on a given processing unit

Parameters:
  `process` - task or isr
  `processingUnit` - executing processing unit
  `modes` - (optional) - null works
  `executionCase` - BCET, ACET, WCET
Returns:
  execution time

#### getExecutionTimeForRunnable

    public static Time getExecutionTimeForRunnable​(Runnable runnable,
                                                   ProcessingUnit processingUnit,
                                                   EMap<ModeLabel,​String> modes,
                                                   RuntimeUtil.TimeType executionCase)

Computes the execution time of a Runnable on a given processing unit

Parameters:
  `runnable` - runnable
  `processingUnit` - executing processing unit
  `modes` - (optional) - null works
  `executionCase` - BCET, ACET, WCET
Returns:
  execution time

#### getExecutionTimeForTicks

    public static Time getExecutionTimeForTicks​(Ticks ticks,
                                                ProcessingUnit processingUnit,
                                                RuntimeUtil.TimeType executionCase)

Computes time for ticks on a given processing unit

#### getExecutionTimeForTicksDeviation

    public static Time getExecutionTimeForTicksDeviation​(IDiscreteValueDeviation deviation,
                                                         ProcessingUnit processingUnit,
                                                         RuntimeUtil.TimeType executionCase)

Computes time for ticks on a given processing unit

Parameters:
  `deviation` - ticks deviation
  `processingUnit` - executing processing unit
  `executionCase` - BCET, ACET, WCET
Returns:
  execution time

#### getExecutionTimeForExecutionNeeds

    public static Time getExecutionTimeForExecutionNeeds​(ExecutionNeed need,
                                                         ProcessingUnit processingUnit,
                                                         RuntimeUtil.TimeType executionCase)

Computes time for execution needs on a given processing unit

Parameters:
  `need` - execution need
  `processingUnit` - executing processing unit
  `executionCase` - BCET, ACET, WCET
Returns:
  execution time

#### getExecutionTimeForExecutionNeedEntry

    public static Time getExecutionTimeForExecutionNeedEntry​(IDiscreteValueDeviation deviation,
                                                             HwFeatureCategory hwFeatureCategory,
                                                             ProcessingUnit processingUnit,
                                                             RuntimeUtil.TimeType executionCase)

Computes time for specific execution need entry on a given processing unit

Parameters:
  `deviation` - needs deviation
  `hwFeatureCategory` - corresponding feature category
  `processingUnit` - executing processing unit
  `executionCase` - BCET, ACET, WCET
Returns:
  execution time

#### getExecutionTimeForCycles

    public static Time getExecutionTimeForCycles​(double ticks,
                                                 Frequency frequency)

Computes time for a number of ticks with a given frequency

Parameters:
  `ticks` - ticks / cycles
  `frequency` - frequency (of an executing processing unit)
Returns:
  execution time

#### getTicksForExecutionTimeInSeconds

    public static double getTicksForExecutionTimeInSeconds​(BigDecimal executionTime,
                                                           Frequency frequency)

Computes ticks for a given time (in seconds) and frequency.

Parameters:
  `executionTime` - execution time in seconds
  `frequency` - frequency (of an executing processing unit)
Returns:
  ticks / cycles

#### getTicksForExecutionTime

    public static double getTicksForExecutionTime​(Time executionTime,
                                                  Frequency frequency)

Computes ticks for a given time and frequency.

Parameters:
  `executionTime` - execution time
  `frequency` - frequency (of an executing processing unit)
Returns:
  ticks / cycles

#### setRuntimeOfRunnable

    public static void setRuntimeOfRunnable​(Runnable runnable,
                                            ExecutionNeed need,
                                            EMap<ModeLabel,​String> modes)

Sets the runtime of the given runnable to the given ExecutionNeed

#### setRuntimeOfRunnable

    public static void setRuntimeOfRunnable​(Runnable runnable,
                                            Ticks ticks,
                                            EMap<ModeLabel,​String> modes)

Sets the runtime of the given runnable to the given Ticks

#### addRuntimeToRunnable

    public static void addRuntimeToRunnable​(Runnable runnable,
                                            ExecutionNeed need)

Adds Runtime (given as ExecutionNeed) to an existing Runnable currently without consideration of modes

#### addRuntimeToRunnable

    public static void addRuntimeToRunnable​(Runnable runnable,
                                            Ticks ticks)

Adds Runtime (given as Ticks) to an existing Runnable currently without consideration of modes

#### clearRuntimeOfModel

    public static void clearRuntimeOfModel​(Amalthea model,
                                           EMap<ModeLabel,​String> modes)

Clears all runtime information (execution needs and ticks)

Parameters:
  `model` - Amalthea model
  `modes` - (optional) - null works

#### clearRuntimeOfProcess

    public static void clearRuntimeOfProcess​(Process process,
                                             EMap<ModeLabel,​String> modes)

Clears all runtime information (execution needs and ticks)

Parameters:
  `process` - task or isr
  `modes` - (optional) - null works

#### clearRuntimeOfRunnable

    public static void clearRuntimeOfRunnable​(Runnable runnable,
                                              EMap<ModeLabel,​String> modes)

Clears all runtime information (execution needs and ticks)

Parameters:
  `runnable` - runnable
  `modes` - (optional) - null works

#### addRuntimeToProcessAsNewRunnable

    public static Runnable addRuntimeToProcessAsNewRunnable​(Process process,
                                                            ExecutionNeed need,
                                                            String runnableName,
                                                            RuntimeUtil.PositionType positon)

Creates a new Runnable with the given runtime at beginning / end of the given process

Parameters:
  `process` - containing process (task or isr)
  `need` - execution need
  `runnableName` - name of new runnable
  `positon` - FIRST, LAST
Returns:
  the new runnable

#### addRuntimeToProcessAsNewRunnable

    public static Runnable addRuntimeToProcessAsNewRunnable​(Process process,
                                                            Ticks ticks,
                                                            String runnableName,
                                                            RuntimeUtil.PositionType positon)

Creates a new Runnable with the given runtime at beginning / end of the given process

Parameters:
  `process` - containing process (task or isr)
  `ticks` - ticks
  `runnableName` - name of new runnable
  `positon` - FIRST, LAST
Returns:
  the new runnable

#### getProcUnitUtilization

    public static double getProcUnitUtilization​(ProcessingUnit procUnit,
                                                Amalthea model,
                                                RuntimeUtil.TimeType tt,
                                                List<HwFeature> hwFeatures,
                                                EMap<ModeLabel,​String> modes)

Calculates the utilization for a given procUnit

#### getProcessUtilization

    public static Map<ProcessingUnit,​Double> getProcessUtilization​(Process process,
                                                                         Amalthea model,
                                                                         RuntimeUtil.TimeType tt,
                                                                         List<HwFeature> hwFeatures,
                                                                         EMap<ModeLabel,​String> modes)

Calculates the utilization for a given process

Returns:
  Map: procUnit -> utilization

#### getProcessUtilization

    public static double getProcessUtilization​(Process process,
                                               ProcessingUnit procUnit,
                                               Amalthea model,
                                               RuntimeUtil.TimeType tt,
                                               List<HwFeature> hwFeatures,
                                               EMap<ModeLabel,​String> modes)

Calculates the utilization for a given process on a given procUnit

Assumption (wrong): All triggers activate the process on all procUnits together! (at the same time)

Returns:
  utilization

#### getProcessUtilization

    public static double getProcessUtilization​(Process process,
                                               Time period,
                                               RuntimeUtil.TimeType tt,
                                               EMap<ModeLabel,​String> modes)

Calculates the process utilization

#### getCumulativeProcessUtilizations

    public static Map<Process,​Double> getCumulativeProcessUtilizations​(Amalthea model,
                                                                             RuntimeUtil.TimeType tt,
                                                                             List<HwFeature> hwFeatures,
                                                                             EMap<ModeLabel,​String> modes)

Returns the cumulative process utilization, i.e. runtime on every procUnit summed up

Returns:
  Map: process -> sum of utilization on all procUnits

#### getPeriodsOfAllProcesses

    public static Map<Process,​List<Time>> getPeriodsOfAllProcesses​(Amalthea model,
                                                                         RuntimeUtil.TimeType tt,
                                                                         EMap<ModeLabel,​String> modes)

Gets all Period ranges from the model

#### getPeriodsOfProcess

    public static List<Time> getPeriodsOfProcess​(Process process,
                                                 RuntimeUtil.TimeType tt,
                                                 EMap<ModeLabel,​String> modes)

Returns a list of all triggering periods. Sorted by shortest period first!

#### getTriggeringProcesses

    public static Map<Process,​Long> getTriggeringProcesses​(InterProcessStimulus ip,
                                                                 EMap<ModeLabel,​String> modes)

Returns all Processes that trigger the given InterProcessStimulus

Returns:
  Map: process -> prescaler value

#### getTriggeredStimuli

    public static Map<Stimulus,​Long> getTriggeredStimuli​(Process process,
                                                               EMap<ModeLabel,​String> modes)

Returns a map of all stimuli, triggered by this process, associated with its prescaler.

#### getProcessesWithRelativePeriodicStimulus

    public static Map<Process,​List<Time>> getProcessesWithRelativePeriodicStimulus​(Amalthea model,
                                                                                         RuntimeUtil.TimeType tt)

Returns a Map of all sporadically triggered processes with their prescaler

Returns:
  Map of processes with a sporadic activation and depending on tt the time between activations

#### getProcessesWithRelativePeriodicStimulus

    public static Map<Process,​List<ITimeDeviation>> getProcessesWithRelativePeriodicStimulus​(Amalthea model)

Returns a Map of all sporadically triggered processes with their prescaler

Returns:
  Map of processes with a sporadic activation and the deviation of the activations

#### getPlainTriggersForModel

    public static Map<Process,​Map<Stimulus,​Long>> getPlainTriggersForModel​(Amalthea model,
                                                                                       Function<Stimulus,​Boolean> filter)

Returns a map from process to all stimuli (matching filter) that lead to that process with the correct prescaler

#### getPlainTriggerForProcess

    public static Map<Stimulus,​Long> getPlainTriggerForProcess​(Process process,
                                                                     long depthCounter,
                                                                     Function<Stimulus,​Boolean> filter)

Returns all stimuli (matching filter) that trigger the given process