Class RuntimeUtil
- Object
-
- RuntimeUtil
-
public class RuntimeUtil extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RuntimeUtil.AccessDirection
static class
RuntimeUtil.PositionType
static class
RuntimeUtil.TimeType
-
Method Summary
All Methods Modifier and Type Method Description 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 processstatic 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 processstatic void
addRuntimeToRunnable(Runnable runnable, ExecutionNeed need)
Adds Runtime (given as ExecutionNeed) to an existing Runnable currently without consideration of modesstatic void
addRuntimeToRunnable(Runnable runnable, Ticks ticks)
Adds Runtime (given as Ticks) to an existing Runnable currently without consideration of modesstatic 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 upstatic Time
getExecutionTimeForCycles(double ticks, Frequency frequency)
Computes time for a number of ticks with a given frequencystatic Time
getExecutionTimeForExecutionNeedEntry(IDiscreteValueDeviation deviation, HwFeatureCategory hwFeatureCategory, ProcessingUnit processingUnit, RuntimeUtil.TimeType executionCase)
Computes time for specific execution need entry on a given processing unitstatic Time
getExecutionTimeForExecutionNeeds(ExecutionNeed need, ProcessingUnit processingUnit, RuntimeUtil.TimeType executionCase)
Computes time for execution needs on a given processing unitstatic 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 unitstatic Time
getExecutionTimeForProcess(Process process, EMap<ModeLabel,String> modes, RuntimeUtil.TimeType executionCase)
Computes the execution time of a Process (Task or ISR) - unique mapping is requiredstatic Time
getExecutionTimeForRunnable(Runnable runnable, ProcessingUnit processingUnit, EMap<ModeLabel,String> modes, RuntimeUtil.TimeType executionCase)
Computes the execution time of a Runnable on a given processing unitstatic Time
getExecutionTimeForTicks(Ticks ticks, ProcessingUnit processingUnit, RuntimeUtil.TimeType executionCase)
Computes time for ticks on a given processing unitstatic Time
getExecutionTimeForTicksDeviation(IDiscreteValueDeviation deviation, ProcessingUnit processingUnit, RuntimeUtil.TimeType executionCase)
Computes time for ticks on a given processing unitstatic Map<Process,List<Time>>
getPeriodsOfAllProcesses(Amalthea model, RuntimeUtil.TimeType tt, EMap<ModeLabel,String> modes)
Gets all Period ranges from the modelstatic 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 processstatic 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 prescalerstatic Map<Process,List<ITimeDeviation>>
getProcessesWithRelativePeriodicStimulus(Amalthea model)
Returns a Map of all sporadically triggered processes with their prescalerstatic Map<Process,List<Time>>
getProcessesWithRelativePeriodicStimulus(Amalthea model, RuntimeUtil.TimeType tt)
Returns a Map of all sporadically triggered processes with their prescalerstatic Map<ProcessingUnit,Double>
getProcessUtilization(Process process, Amalthea model, RuntimeUtil.TimeType tt, List<HwFeature> hwFeatures, EMap<ModeLabel,String> modes)
Calculates the utilization for a given processstatic 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 procUnitstatic double
getProcessUtilization(Process process, Time period, RuntimeUtil.TimeType tt, EMap<ModeLabel,String> modes)
Calculates the process utilizationstatic double
getProcUnitUtilization(ProcessingUnit procUnit, Amalthea model, RuntimeUtil.TimeType tt, List<HwFeature> hwFeatures, EMap<ModeLabel,String> modes)
Calculates the utilization for a given procUnitstatic 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 InterProcessStimulusstatic void
setRuntimeOfRunnable(Runnable runnable, ExecutionNeed need, EMap<ModeLabel,String> modes)
Sets the runtime of the given runnable to the given ExecutionNeedstatic void
setRuntimeOfRunnable(Runnable runnable, Ticks ticks, EMap<ModeLabel,String> modes)
Sets the runtime of the given runnable to the given Ticks
-
-
-
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 isrmodes
- (optional) - null worksexecutionCase
- 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 isrprocessingUnit
- executing processing unitmodes
- (optional) - null worksexecutionCase
- 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
- runnableprocessingUnit
- executing processing unitmodes
- (optional) - null worksexecutionCase
- 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 deviationprocessingUnit
- executing processing unitexecutionCase
- 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 needprocessingUnit
- executing processing unitexecutionCase
- 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 deviationhwFeatureCategory
- corresponding feature categoryprocessingUnit
- executing processing unitexecutionCase
- 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 / cyclesfrequency
- 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 secondsfrequency
- 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 timefrequency
- 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 modelmodes
- (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 isrmodes
- (optional) - null works
-
clearRuntimeOfRunnable
public static void clearRuntimeOfRunnable(Runnable runnable, EMap<ModeLabel,String> modes)
Clears all runtime information (execution needs and ticks)- Parameters:
runnable
- runnablemodes
- (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 needrunnableName
- name of new runnablepositon
- 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
- ticksrunnableName
- name of new runnablepositon
- 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 procUnitAssumption (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
-
-