Updated standard schedulers and extended converters accordingly
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.200/src/org/eclipse/app4mc/amalthea/converters200/impl/SchedulerConverter.java b/plugins/org.eclipse.app4mc.amalthea.converters.200/src/org/eclipse/app4mc/amalthea/converters200/impl/SchedulerConverter.java index 9d7d46f..7a32d64 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.200/src/org/eclipse/app4mc/amalthea/converters200/impl/SchedulerConverter.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.200/src/org/eclipse/app4mc/amalthea/converters200/impl/SchedulerConverter.java
@@ -140,7 +140,7 @@ .map(s -> EXTENDED + s) .collect(Collectors.toList()); // add custom scheduler definition with algorithm parameters - SchedulerConverterUtil.addSchedulerDefinition(osModel, name, params, null); + SchedulerConverterUtil.addSchedulerDefinition(osModel, name, null, params, null, null); } // *** add scheduling parameter definitions (for first file only) @@ -296,7 +296,8 @@ return null; } else { // standard case: use type as definition name - return type; + // (and replace old names) + return SchedulerConverterUtil.getNewSchedulerName(type); } }
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.200/src/org/eclipse/app4mc/amalthea/converters200/utils/SchedulerConverterUtil.java b/plugins/org.eclipse.app4mc.amalthea.converters.200/src/org/eclipse/app4mc/amalthea/converters200/utils/SchedulerConverterUtil.java index b5a91f3..f8ed250 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.200/src/org/eclipse/app4mc/amalthea/converters200/utils/SchedulerConverterUtil.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.200/src/org/eclipse/app4mc/amalthea/converters200/utils/SchedulerConverterUtil.java
@@ -14,6 +14,7 @@ package org.eclipse.app4mc.amalthea.converters200.utils; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.regex.Matcher; @@ -102,25 +103,51 @@ } public static void addSchedulerDefinition(Element osModel, String algorithmName) { - Algorithm algorithm = StandardSchedulers.getAlgorithm(algorithmName); + Algorithm algorithm = StandardSchedulers.getAlgorithm(getNewSchedulerName(algorithmName)); - List<String> paramNames1 = (algorithm == null) ? Collections.emptyList() : algorithm.getAlgorithmParameterNames(); - List<String> paramNames2 = (algorithm == null) ? Collections.emptyList() : algorithm.getProcessParameterNames(); - addSchedulerDefinition(osModel, algorithmName, paramNames1, paramNames2); + if (algorithm == null) { + // use name of unknown scheduler + addSchedulerDefinition(osModel, algorithmName, null, null, null, null); + } else { + // use values of standard scheduler + String name = algorithm.getAlgorithmName(); + String description = algorithm.getDescription(); + List<String> paramNames1 = algorithm.getAlgorithmParameterNames(); + List<String> paramNames2 = algorithm.getProcessParameterNames(); + List<Boolean> options = Arrays.asList(algorithm.hasExactlyOneChild(), algorithm.passesParametersUpwards(), algorithm.requiresParentScheduler()); + + addSchedulerDefinition(osModel, name, description, paramNames1, paramNames2, options); + } } - public static void addSchedulerDefinition(Element osModel, String algorithmName, List<String> algorithmParameters, List<String> processParameters) { + public static void addSchedulerDefinition(Element osModel, String name, String description, List<String> algorithmParameters, List<String> processParameters, List<Boolean> options) { Element schedulerDefElement = new Element("schedulerDefinitions"); osModel.addContent(schedulerDefElement); - String idValue = HelperUtil.encodeName(algorithmName) + "?type=SchedulerDefinition"; + String idValue = HelperUtil.encodeName(name) + "?type=SchedulerDefinition"; schedulerDefElement.setAttribute("id", idValue, AmaltheaNamespaceRegistry.getGenericNamespace("xmi")); - schedulerDefElement.setAttribute("name", algorithmName); + + // name + schedulerDefElement.setAttribute("name", name); + + // description + if ((description != null) && (! description.isEmpty())) { + schedulerDefElement.setAttribute("description", description); + } + + // Parameters if ((algorithmParameters != null) && (! algorithmParameters.isEmpty())) { - schedulerDefElement.setAttribute("algorithmParameters", buildParametersString(algorithmParameters)); + schedulerDefElement.setAttribute("algorithmParameters", buildParametersString(algorithmParameters)); } if ((processParameters != null) && (! processParameters.isEmpty())) { - schedulerDefElement.setAttribute("processParameters", buildParametersString(processParameters)); + schedulerDefElement.setAttribute("processParameters", buildParametersString(processParameters)); + } + + // options + if ((options != null) && (options.size() == 3)) { + schedulerDefElement.setAttribute("hasExactlyOneChild", options.get(0).toString()); + schedulerDefElement.setAttribute("passesParametersUpwards", options.get(1).toString()); + schedulerDefElement.setAttribute("requiresParentScheduler", options.get(2).toString()); } } @@ -130,4 +157,12 @@ .collect(Collectors.joining(" ")); } + public static String getNewSchedulerName(String oldName) { + // the following names of standard schedulers were changed in 2.0.0 + if ("Grouping".equals(oldName)) return "GroupingServer"; + if ("PollingPeriodicServer".equals(oldName)) return "PollingServer"; + if ("ConstantBandwidthServerWithCASH".equals(oldName)) return "ConstantBandwidthServerWithCapacitySharing"; + + return oldName; + } }
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.200/src/org/eclipse/app4mc/amalthea/converters200/utils/StandardSchedulers.java b/plugins/org.eclipse.app4mc.amalthea.converters.200/src/org/eclipse/app4mc/amalthea/converters200/utils/StandardSchedulers.java index b8fb1ed..842efb6 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.200/src/org/eclipse/app4mc/amalthea/converters200/utils/StandardSchedulers.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.200/src/org/eclipse/app4mc/amalthea/converters200/utils/StandardSchedulers.java
@@ -29,102 +29,405 @@ public enum Algorithm { // *** ADD PREDEFINED SCHEDULER DEFINITIONS HERE *** - GROUPING( - "Grouping", + GROUPING_SERVER( // only for migration + "GroupingServer", + "This is not a scheduler algorithm. Schedulers using this definition\n" + + "act as a logical grouping of tasks/child-schedulers, e.g. a partition\n" + + "for some tasks for budget accounting reasons.\n\n" + + "This scheduler does not take any scheduling decisions,\n" + + "and a parent scheduler is mandatory.\n\n" + + "Algorithm parameters\n" + + " - capacity [1] Time\n" + + " The fixed budget that can be used by processes.\n" + + " It will be replenished periodically.\n" + + " - period [1] Time\n" + + " Amount of time after which the capacity will be replenished.\n\n" + + "Process parameters\n" + + " -\n\n" + + "Options:\n" + + " - passes parameters upwards\n" + + " - requires parent scheduler\n", + new Parameter[] { Parameter.CAPACITY, Parameter.PRIORITY }, new Parameter[] {}, - new Parameter[] {}), + false, true, true), PRIORITY_BASED( "PriorityBased", + "???\n\n" + + "Algorithm parameters\n" + + " -\n\n" + + "Process parameters\n" + + " - priority [1] Integer\n" + + " The priority of the process (a higher value means a higher priority).\n\n" + + "Options:\n" + + " -\n\n" + + "Reference:\n" + + " - TODO", new Parameter[] {}, - new Parameter[] { Parameter.PRIORITY, Parameter.PREEMPTIBLE }), + new Parameter[] { Parameter.PRIORITY }, + false, false, false), OSEK( "OSEK", + "OSEK compliant Scheduling. A fixed priority preemptive scheduling algorithm\n" + + "with task groups. Tasks belonging to the same task group are scheduled\n" + + "cooperatively (they do not preempt each other), preemptive otherwise.\n" + + "Tasks with the same priority also behave cooperatively.\n\n" + + "Algorithm parameters\n" + + " -\n\n" + + "Process parameters\n" + + " - priority [1] Integer\n" + + " The priority of the process (a higher value means a higher priority).\n" + + " - taskGroup [1] Integer\n" + + " The OSEK task group number (if for two processes the number is equal,\n" + + " that means they are in the same task group).\n\n" + + "Options:\n" + + " -\n\n" + + "Reference:\n" + + " - TODO", new Parameter[] {}, - new Parameter[] { Parameter.PRIORITY, Parameter.PREEMPTIBLE, Parameter.TASK_GROUP }), + new Parameter[] { Parameter.PRIORITY, Parameter.TASK_GROUP }, + false, false, false), FIXED_PRIORITY_PREEMPTIVE( "FixedPriorityPreemptive", + "Fixed Priority Preemptive Scheduling (e.g. AUTOSAR),\n" + + "same as OSEK but without task groups.\n\n" + + "Algorithm parameters\n" + + " -\n\n" + + "Process parameters\n" + + " - priority [1] Integer\n" + + " The priority of the process (a higher value means a higher priority).\n\n" + + "Options:\n" + + " -\n\n" + + "Reference:\n" + + " - TODO", new Parameter[] {}, - new Parameter[] { Parameter.PRIORITY, Parameter.PREEMPTIBLE }), - FIXED_PRIORITY_PREEMPTIVE_WITH_BUDGET_ENFORCEMENT( + new Parameter[] { Parameter.PRIORITY }, + false, false, false), + FIXED_PRIORITY_PREEMPTIVE_WITH_BUDGET_ENFORCEMENT( // only for migration "FixedPriorityPreemptiveWithBudgetEnforcement", + "Works like the Fixed Priority Preemptive Scheduling. But it is possible\n" + + "to put budget boundaries on the execution. Prevents low priority tasks \n" + + "from starving if a higher priority task is trying to constantly occupy the\n" + + "CPU (safety insurance, bounding the execution time of sporadic loads).\n\n" + + "Algorithm parameters\n" + + " -\n\n" + + "Process parameters\n" + + " - priority [1] Integer\n" + + " The priority of the process (a higher value means a higher priority).\n" + + " - minBudget [1] Time\n" + + " The guaranteed amount of budget available to the process within the replenishment period.\n" + + " - maxBudget [1] Time\n" + + " The upper bound of the budget available to the process within the replenishment period.\n" + + " Sets a limit to the usage of a process even if the CPU would be idle\n" + + " (important for algorithms with payback mechanisms).\n" + + " - replenishment [1] Time\n" + + " The periodic time interval after which the budget is set to the configured value.\n\n" + + "Options:\n" + + " -\n\n" + + "Reference:\n" + + " - TODO", new Parameter[] {}, - new Parameter[] { Parameter.PRIORITY, Parameter.PREEMPTIBLE, Parameter.MIN_BUDGET, Parameter.MAX_BUDGET, Parameter.REPLENISHMENT }), - DEADLINE_MONOTONIC( + new Parameter[] { Parameter.PRIORITY, Parameter.MIN_BUDGET, Parameter.MAX_BUDGET, Parameter.REPLENISHMENT }, + false, false, false), + DEADLINE_MONOTONIC( // only for migration "DeadlineMonotonic", + "This is not a scheduling algorithm, it only describes how to derive priorities for a\n" + + "fixed priority scheduler: Task with the shortest deadline gets the highest priority.\n\n" + + "Algorithm parameters\n" + + " -\n\n" + + "Process parameters\n" + + " - deadline [1] Time\n" + + " The time after each activation at which the process must finish.\n\n" + + "Options:\n" + + " -\n\n" + + "Reference:\n" + + " - TODO", new Parameter[] {}, - new Parameter[] { Parameter.PREEMPTIBLE, Parameter.DEADLINE }), - RATE_MONOTONIC( + new Parameter[] { Parameter.DEADLINE }, + false, false, false), + RATE_MONOTONIC( // only for migration "RateMonotonic", + "This is not a scheduling algorithm, it only describes how to derive priorities for a\n" + + "fixed priority scheduler: Task with the shortest period gets the highest priority.\n\n" + + "Algorithm parameters\n" + + " -\n\n" + + "Process parameters\n" + + " - period [1] Integer\n" + + " The time span after the previous activation at which\n" + + " the next instance of the process shall be activated.\n\n" + + "Options:\n" + + " -\n\n" + + "Reference:\n" + + " - TODO", new Parameter[] {}, - new Parameter[] { Parameter.PREEMPTIBLE, Parameter.PERIOD }), + new Parameter[] { Parameter.PERIOD }, + false, false, false), EARLIEST_DEADLINE_FIRST( "EarliestDeadlineFirst", + "Earliest Deadline First (EDF): The task with the closest deadline in relation\n" + + "to the current point in time will be scheduled next.\n\n" + + "Algorithm parameters\n" + + " -\n\n" + + "Process parameters\n" + + " - deadline [1] Time\n" + + " The time after each activation at which the process must finish.\n\n" + + "Options:\n" + + " -\n\n" + + "Reference:\n" + + " - First introduced in: Liu, Chung Laung, and James W. Layland.\n" + + " \"Scheduling algorithms for multiprogramming in a hard-real-time environment.\"\n" + + " Journal of the ACM (JACM) 20.1 (1973): 46-61.", new Parameter[] {}, - new Parameter[] { Parameter.DEADLINE }), - LEAST_LOCAL_REMAINING_EXECUTION_TIME_FIRST( + new Parameter[] { Parameter.DEADLINE }, + false, false, false), + LEAST_LOCAL_REMAINING_EXECUTION_TIME_FIRST( // only for migration "LeastLocalRemainingExecutionTimeFirst", + "Least Local Remaining Execution-time First (LLREF): Task with the\n" + + "smallest local remaining execution time will be scheduled next.\n\n" + + "Algorithm parameters\n" + + " -\n\n" + + "Process parameters\n" + + " - executionTime [1] Time\n" + + " The time which the process will use until it is finished\n" + + " (usually the worst case execution time is used here in order\n" + + " to guarantee that the process can finish).\n\n" + + "Options:\n" + + " -\n\n" + + "Reference:\n" + + " - TODO", new Parameter[] {}, - new Parameter[] { Parameter.EXECUTION_TIME }), + new Parameter[] { Parameter.EXECUTION_TIME }, + false, false, false), PRIORITY_BASED_ROUND_ROBIN( "PriorityBasedRoundRobin", + "Round Robin scheduling algorithm assigns equally sized time slices\n" + + "to each process that it schedules. The priority describes the order\n" + + "in which the processes will be executed. If two processes have the\n" + + "same priority, the order of these two is random (non-deterministic).\n\n" + + "Algorithm parameters\n" + + " - timeSliceLength [1] Time\n" + + " Length of each time slice.\n\n" + + "Process parameters\n" + + " - priority [1] Integer\n" + + " The priority of the process (a higher value means a higher priority).\n\n" + + "Options:\n" + + " -\n\n" + + "Reference:\n" + + " - TODO", new Parameter[] { Parameter.TIME_SLICE_LENGTH }, - new Parameter[] { Parameter.PRIORITY }), + new Parameter[] { Parameter.PRIORITY }, + false, false, false), P_FAIR_PD2( "PFairPD2", + "Proportionate Fair PD2 Scheduling (Pfair-PD2).\n\n" + + "Algorithm parameters\n" + + " - quantSize [0..1] Time = 1ns\n" + + " Length of the minimum schedulable time slot used in Pfair scheduling.\n" + + " It is assumed that execution times are an integer multiple of this\n" + + " time slot length.\n\n" + + "Process parameters\n" + + " -\n\n" + + "Options:\n" + + " -\n\n" + + "Reference:\n" + + " - TODO", new Parameter[] { Parameter.QUANT_SIZE }, - new Parameter[] {}), + new Parameter[] {}, + false, false, false), PARTLY_P_FAIR_PD2( "PartlyPFairPD2", + "Partly Proportionate Fair PD2 Scheduling (PPfair-PD2).\n\n" + + "Algorithm parameters\n" + + " - quantSize [0..1] Time = 1ns\n" + + " Length of the minimum schedulable time slot used in Pfair scheduling.\n" + + " It is assumed that execution times are an integer multiple of this\n" + + " time slot length.\n\n" + + "Process parameters\n" + + " -\n\n" + + "Options:\n" + + " -\n\n" + + "Reference:\n" + + " - TODO", new Parameter[] { Parameter.QUANT_SIZE }, - new Parameter[] {}), + new Parameter[] {}, + false, false, false), EARLY_RELEASE_FAIR_PD2( "EarlyReleaseFairPD2", + "Early Release Fair PD2 Scheduling (ERfair-PD2).\n\n" + + "Algorithm parameters\n" + + " - quantSize [0..1] Time = 1ns\n" + + " Length of the minimum schedulable time slot used in Pfair scheduling.\n" + + " It is assumed that execution times are an integer multiple of this\n" + + " time slot length.\n\n" + + "Process parameters\n" + + " -\n\n" + + "Options:\n" + + " -\n\n" + + "Reference:\n" + + " - TODO", new Parameter[] { Parameter.QUANT_SIZE }, - new Parameter[] {}), + new Parameter[] {}, + false, false, false), PARTLY_EARLY_RELEASE_FAIR_PD2( "PartlyEarlyReleaseFairPD2", + "Partly Early Release Fair PD2 Scheduling (P-ERfair-PD2).\n\n" + + "Algorithm parameters\n" + + " - quantSize [0..1] Time = 1ns\n" + + " Length of the minimum schedulable time slot used in Pfair scheduling.\n" + + " It is assumed that execution times are an integer multiple of this\n" + + " time slot length.\n\n" + + "Process parameters\n" + + " -\n\n" + + "Options:\n" + + " -\n\n" + + "Reference:\n" + + " - TODO", new Parameter[] { Parameter.QUANT_SIZE }, - new Parameter[] {}), + new Parameter[] {}, + false, false, false), DEFERRABLE_SERVER( "DeferrableServer", + "Deferrable Server (DS): provides a fixed budget,\n" + + "in which the budget replenishment is done periodically.\n\n" + + "Algorithm parameters\n" + + " - capacity [1] Time\n" + + " The fixed budget that can be used by processes.\n" + + " It will be replenished periodically.\n" + + " - period [1] Time\n" + + " Amount of time after which the capacity will be replenished.\n\n" + + "Process parameters\n" + + " -\n\n" + + "Options:\n" + + " - has exactly one child\n" + + " - requires parent scheduler\n\n" + + "Reference:\n" + + " - First introduced in: Strosnider, Jay K., John P. Lehoczky, and Lui Sha.\n" + + " \"The deferrable server algorithm for enhanced aperiodic responsiveness in hard real-time environments.\"\n" + + " IEEE Transactions on Computers 44.1 (1995): 73-91.", new Parameter[] { Parameter.CAPACITY, Parameter.PERIOD }, - new Parameter[] {}), - POLLING_PERIODIC_SERVER( - "PollingPeriodicServer", + new Parameter[] {}, + true, false, true), + POLLING_SERVER( + "PollingServer", + "Polling Server (PS): provides a fixed budget periodically that is only\n" + + "available at pre-defined times. If the process is not using the budget\n" + + "at that point in time the budget is lost.\n\n" + + "Algorithm parameters\n" + + " - capacity [1] Time\n" + + " The fixed budget that can be used by processes (usually directly\n" + + " after it has been replenished). The capacity will be consumed even\n" + + " if there is no process using it. It will be replenished periodically.\n" + + " - period [1] Time\n" + + " Amount of time after which the capacity will be replenished.\n\n" + + "Process parameters\n" + + " -\n\n" + + "Options:\n" + + " - has exactly one child\n" + + " - requires parent scheduler\n\n" + + "Reference:\n" + + " - TODO", new Parameter[] { Parameter.CAPACITY, Parameter.PERIOD }, - new Parameter[] {}), + new Parameter[] {}, + true, false, true), SPORADIC_SERVER( "SporadicServer", - new Parameter[] { Parameter.CAPACITY, Parameter.REPLENISHMENT }, - new Parameter[] {}), + "Sporadic Server (SS): provides a fixed budget, in which the budget replenishment\n" + + "is performed with a pre-defined replenishment delay after it was consumed.\n\n" + + "Algorithm parameters\n" + + " - capacity [1] Time\n" + + " The fixed budget that can be used by processes. It will be replenished after\n" + + " the specified amount of time has passed since it has last been consumed.\n" + + " - replenishmentDelay [1] Time\n" + + " Amount of time after which the capacity will be replenished\n" + + " after it has last been consumed.\n\n" + + "Process parameters\n" + + " -\n\n" + + "Options:\n" + + " - has exactly one child\n" + + " - requires parent scheduler\n\n" + + "Reference:\n" + + " - First introduced in: Sprunt, Brinkley, Lui Sha, and John Lehoczky.\n" + + " \"Aperiodic task scheduling for hard-real-time systems.\"\n" + + " Real-Time Systems 1.1 (1989): 27-60.", + new Parameter[] { Parameter.CAPACITY, Parameter.REPLENISHMENT_DELAY }, + new Parameter[] {}, + true, false, true), CONSTANT_BANDWIDTH_SERVER( "ConstantBandwidthServer", + "Constant Bandwidth Server (CBS): provides a fixed utilization for\n" + + "executing jobs, in which the deadline for execution is independent\n" + + "on the execution time of jobs.\n\n" + + "Algorithm parameters\n" + + " - capacity [1] Time\n" + + " The fixed budget that can be used by processes.\n" + + " It will be replenished periodically.\n" + + " - period [1] Time\n" + + " Amount of time after which the capacity will be replenished.\n\n" + + "Process parameters\n" + + " -\n\n" + + "Options:\n" + + " - has exactly one child\n" + + " - requires parent scheduler\n\n" + + "Reference:\n" + + " - First introduced in: Abeni, Luca, and Giorgio Buttazzo.\n" + + " \"Integrating multimedia applications in hard real-time systems.\"\n" + + " Proceedings 19th IEEE Real-Time Systems Symposium (Cat. No. 98CB36279). IEEE, 1998.", new Parameter[] { Parameter.CAPACITY, Parameter.PERIOD }, - new Parameter[] {}), + new Parameter[] {}, + true, false, true), CONSTANT_BANDWIDTH_SERVER_WITH_CAPACITY_SHARING( "ConstantBandwidthServerWithCapacitySharing", + "Constant Bandwidth Server (CBS) with capacity sharing (CASH).\n" + + "Consumes residual slack from other servers (work conserving).\n\n" + + "Algorithm parameters\n" + + " - capacity [1] Time\n" + + " The fixed budget that can be used by processes.\n" + + " It will be replenished periodically.\n" + + " - period [1] Time\n" + + " Amount of time after which the capacity will be replenished.\n\n" + + "Process parameters\n" + + " -\n\n" + + "Options:\n" + + " - has exactly one child\n" + + " - requires parent scheduler\n\n" + + "Reference:\n" + + " - TODO", new Parameter[] { Parameter.CAPACITY, Parameter.PERIOD }, - new Parameter[] {}); + new Parameter[] {}, + true, false, true); private final String algorithmName; + private final String description; private final List<Parameter> algorithmParameters; private final List<Parameter> processParameters; + private final boolean hasExactlyOneChild; + private final boolean passesParametersUpwards; + private final boolean requiresParentScheduler; // private enum constructor - private Algorithm(String algorithmName, Parameter[] algorithmParameters, Parameter[] processParameters) { + private Algorithm(String algorithmName, String description, + Parameter[] algorithmParameters, Parameter[] processParameters, + boolean hasExactlyOneChild, boolean passesParametersUpwards, boolean requiresParentScheduler) { this.algorithmName = algorithmName; + this.description = description; this.algorithmParameters = Arrays.asList(algorithmParameters); this.processParameters = Arrays.asList(processParameters); + this.hasExactlyOneChild = hasExactlyOneChild; + this.passesParametersUpwards = passesParametersUpwards; + this.requiresParentScheduler = requiresParentScheduler; } public String getAlgorithmName() { return algorithmName; } + public String getDescription() { + return description; + } + public List<Parameter> getAlgorithmParameters() { return algorithmParameters; } @@ -132,20 +435,31 @@ public List<String> getAlgorithmParameterNames() { return algorithmParameters.stream().map(Parameter::getParameterName).collect(Collectors.toList()); } - + public List<Parameter> getProcessParameters() { return processParameters; } public List<String> getProcessParameterNames() { return processParameters.stream().map(Parameter::getParameterName).collect(Collectors.toList()); - } + } + + public boolean hasExactlyOneChild() { + return hasExactlyOneChild; + } + + public boolean passesParametersUpwards() { + return passesParametersUpwards; + } + + public boolean requiresParentScheduler() { + return requiresParentScheduler; + } } public enum Parameter { // *** ADD PREDEFINED PARAMETER DEFINITIONS HERE *** PRIORITY("priority", Type.INTEGER, false, true), - PREEMPTIBLE("preemptible", Type.BOOL, false, false, "false"), TASK_GROUP("taskGroup", Type.INTEGER, false, true), MIN_BUDGET("minBudget", Type.TIME, false, true), MAX_BUDGET("maxBudget", Type.TIME, false, true), @@ -221,8 +535,10 @@ private static final Map<String, Algorithm> ALGORITHMS; static { - PARAMETERS = Arrays.stream(Parameter.values()).collect(Collectors.toMap(Parameter::getParameterName, Function.identity())); - ALGORITHMS = Arrays.stream(Algorithm.values()).collect(Collectors.toMap(Algorithm::getAlgorithmName, Function.identity())); + PARAMETERS = Arrays.stream(Parameter.values()) + .collect(Collectors.toMap(Parameter::getParameterName, Function.identity())); + ALGORITHMS = Arrays.stream(Algorithm.values()) + .collect(Collectors.toMap(Algorithm::getAlgorithmName, Function.identity())); } public static Algorithm getAlgorithm(String algorithmName) {
diff --git a/tests/org.eclipse.app4mc.amalthea.converters.200.tests/TestModels/input/schedulers/reservation_based_server/rbs.amxmi b/tests/org.eclipse.app4mc.amalthea.converters.200.tests/TestModels/input/schedulers/reservation_based_server/rbs.amxmi new file mode 100644 index 0000000..a9be829 --- /dev/null +++ b/tests/org.eclipse.app4mc.amalthea.converters.200.tests/TestModels/input/schedulers/reservation_based_server/rbs.amxmi
@@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<am:Amalthea xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:am="http://app4mc.eclipse.org/amalthea/1.2.0"> + <swModel> + <tasks xmi:id="T1?type=Task" name="T1" multipleTaskActivationLimit="0"/> + <tasks xmi:id="T2?type=Task" name="T2" multipleTaskActivationLimit="0"/> + <tasks xmi:id="T3?type=Task" name="T3" multipleTaskActivationLimit="0"/> + <tasks xmi:id="T4?type=Task" name="T4" multipleTaskActivationLimit="0"/> + <tasks xmi:id="T5?type=Task" name="T5" multipleTaskActivationLimit="0"/> + </swModel> + <hwModel> + <definitions xsi:type="am:ProcessingUnitDefinition" xmi:id="Controller1?type=ProcessingUnitDefinition" name="Controller1" puType="CPU"/> + <structures xmi:id="ECU?type=HwStructure" name="ECU"> + <modules xsi:type="am:ProcessingUnit" xmi:id="C1?type=ProcessingUnit" name="C1" definition="Controller1?type=ProcessingUnitDefinition"/> + <modules xsi:type="am:ProcessingUnit" xmi:id="C2?type=ProcessingUnit" name="C2" definition="Controller1?type=ProcessingUnitDefinition"/> + </structures> + </hwModel> + <osModel> + <operatingSystems name="OS"> + <taskSchedulers xmi:id="FPP?type=TaskScheduler" name="FPP"> + <schedulingAlgorithm xsi:type="am:FixedPriorityPreemptive"/> + </taskSchedulers> + <taskSchedulers xmi:id="DS?type=TaskScheduler" name="DS"> + <schedulingAlgorithm xsi:type="am:DeferrableServer"/> + <parentAssociation parent="FPP?type=TaskScheduler"> + <schedulingParameters priority="10"> + <minBudget value="20" unit="ms"/> + <maxBudget value="25" unit="ms"/> + </schedulingParameters> + </parentAssociation> + </taskSchedulers> + <taskSchedulers xmi:id="OSEK?type=TaskScheduler" name="OSEK"> + <schedulingAlgorithm xsi:type="am:OSEK"/> + <parentAssociation parent="DS?type=TaskScheduler"/> + </taskSchedulers> + <taskSchedulers xmi:id="PS?type=TaskScheduler" name="PS"> + <schedulingAlgorithm xsi:type="am:PollingPeriodicServer"/> + <parentAssociation parent="FPP?type=TaskScheduler"> + <schedulingParameters priority="5"> + <minBudget value="20" unit="ms"/> + <maxBudget value="66" unit="ms"/> + </schedulingParameters> + </parentAssociation> + </taskSchedulers> + <taskSchedulers xmi:id="EDF?type=TaskScheduler" name="EDF"> + <schedulingAlgorithm xsi:type="am:EarliestDeadlineFirst"/> + </taskSchedulers> + <taskSchedulers xmi:id="CBS?type=TaskScheduler" name="CBS"> + <schedulingAlgorithm xsi:type="am:ConstantBandwidthServerWithCASH"/> + <parentAssociation parent="EDF?type=TaskScheduler"> + <schedulingParameters> + <minBudget value="20" unit="ms"/> + <maxBudget value="40" unit="ms"/> + <replenishment value="100" unit="ms"/> + </schedulingParameters> + </parentAssociation> + </taskSchedulers> + </operatingSystems> + </osModel> + <mappingModel> + <schedulerAllocation scheduler="FPP?type=TaskScheduler" responsibility="C1?type=ProcessingUnit"/> + <schedulerAllocation scheduler="EDF?type=TaskScheduler" responsibility="C2?type=ProcessingUnit"/> + <taskAllocation task="T1?type=Task" scheduler="OSEK?type=TaskScheduler"/> + <taskAllocation task="T2?type=Task" scheduler="OSEK?type=TaskScheduler"/> + <taskAllocation task="T3?type=Task" scheduler="OSEK?type=TaskScheduler"/> + <taskAllocation task="T4?type=Task" scheduler="PS?type=TaskScheduler"/> + <taskAllocation task="T5?type=Task" scheduler="CBS?type=TaskScheduler"/> + </mappingModel> +</am:Amalthea>
diff --git a/tests/org.eclipse.app4mc.amalthea.converters.200.tests/src/org/eclipse/app4mc/amalthea/converters200/tests/SchedulerConverterTest.java b/tests/org.eclipse.app4mc.amalthea.converters.200.tests/src/org/eclipse/app4mc/amalthea/converters200/tests/SchedulerConverterTest.java index 217a223..becb24c 100644 --- a/tests/org.eclipse.app4mc.amalthea.converters.200.tests/src/org/eclipse/app4mc/amalthea/converters200/tests/SchedulerConverterTest.java +++ b/tests/org.eclipse.app4mc.amalthea.converters.200.tests/src/org/eclipse/app4mc/amalthea/converters200/tests/SchedulerConverterTest.java
@@ -38,7 +38,8 @@ return Arrays.asList(new Object[][] { { new String[] {"/schedulers/model1.amxmi", "/schedulers/model2.amxmi", "/schedulers/model3.amxmi"}, true }, { new String[] {"/schedulers/hierarchical/hierarchicalExample.amxmi"}, true }, - { new String[] {"/schedulers/partitioned_fpp/partitioned_fpp.amxmi"}, true } + { new String[] {"/schedulers/partitioned_fpp/partitioned_fpp.amxmi"}, true }, + { new String[] {"/schedulers/reservation_based_server/rbs.amxmi"}, true } }); }