Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Nagy2019-08-26 13:29:05 +0000
committerDavid Nagy2019-08-26 14:35:33 +0000
commita219fbb5234b0dbcda07cfe87b9d5cc29c1597a8 (patch)
tree58cbb36335ed8d1ddbee36dd4e78f24b07da5f49
parenta2ac421ab0b679a9757ccdb97f9e1482a935fd24 (diff)
downloadorg.eclipse.app4mc-a219fbb5234b0dbcda07cfe87b9d5cc29c1597a8.tar.gz
org.eclipse.app4mc-a219fbb5234b0dbcda07cfe87b9d5cc29c1597a8.tar.xz
org.eclipse.app4mc-a219fbb5234b0dbcda07cfe87b9d5cc29c1597a8.zip
Task Visualizer Rework
Signed-off-by: David Nagy <david.nagy@tu-dortmund.de>
-rwxr-xr-xplugins/org.eclipse.app4mc.multicore.execution.logic/META-INF/MANIFEST.MF2
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/build.properties34
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/Activator.java82
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/ExecutionModel.java283
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/misc/EMTimeType.java106
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/misc/ExecutionModelException.java54
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMCore.java82
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTask.java122
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTaskEvent.java66
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTaskFSM.java142
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTaskHistState.java230
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTaskState.java60
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/AmaltheaModelBuilder.java184
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/MalformedModelException.java56
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMAllocation.java140
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMAttribute.java64
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMCore.java220
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMEdge.java102
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMMapping.java62
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMRunnable.java211
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMScheduler.java84
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMTask.java791
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMUtil.java663
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/ISystemProxy.java80
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/SimException.java54
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/SystemProxyFactory.java132
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/multicoresystem/EMMultiCoreSystem.java80
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/multicoresystem/EMTracer.java326
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/multicoresystem/MultiCoreSystem.java580
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/multicoresystem/SimUtil.java184
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/ISchedulerAlgorithm.java50
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/ISchedulerEventListener.java72
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/ISchedulerTask.java62
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/IStepScheduler.java48
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/SchedulerAlgorithmRegister.java140
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/SchedulerException.java50
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/algo/CooperativeEDFAlgo.java48
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/algo/PreemptiveEDFAlgo.java80
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/algo/PreemptiveRMSAlgo.java66
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/AbstractScheduler.java268
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/Barrier.java198
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/BarrierAccess.java92
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/ISchedulerBase.java56
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/SchedulerTask.java550
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/StepScheduler.java570
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/TaskFSM.java328
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/tracing/ConsoleSchedulerTracer.java48
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/tracing/FileSchedulerTracer.java84
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/tracing/PrintStreamSchedulerTracer.java226
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/executionmodel/test/TaskFSMTest.java90
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/openmapping/test/OMUtilTest.java270
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/CooperativeSchedullerTest.java132
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/PreemptiveRMSTest.java254
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/SimpleEMTaskTracer.java240
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/StepSchedulerTest.java590
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/TestUtil.java88
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/test/MulticorePrecedenceSimulation.java186
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/test/PerformanceTest.java710
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.model/.classpath7
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.model/.gitignore2
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.model/.project28
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.model/.settings/org.eclipse.jdt.core.prefs11
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.model/META-INF/MANIFEST.MF14
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.model/build.properties4
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/XContainer.java753
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/XUtil.java677
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XAccess.java41
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XCore.java28
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XEventChain.java135
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XEventElement.java97
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XLabel.java41
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XMappingUtil.java129
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XRunnable.java60
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XScheduler.java55
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XTasks.java116
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/.classpath14
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/.project56
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/META-INF/MANIFEST.MF3
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/build.properties32
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/Activator.java146
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/handlers/SimMenuHandler.java238
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/SWTAllocationTable.java264
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/TaskVisuDependencyPage.java464
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/TaskVisuOverviewPage.java284
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/TaskVisuSchedulingPage.java505
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/TaskVisuWizard.java541
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/Util.java120
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.widget/META-INF/MANIFEST.MF11
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.widget/build.properties30
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.widget/icons/ganttchart.css59
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/comunication/ComUtil.java1112
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/emtracewidget/EMTraceWidget.java284
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/emtracewidget/IEMTraceWidget.java64
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/eventcanves/EventCanvas.java23
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/eventcanves/SimpleEventChain.java78
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/eventcanves/SimpleLabelChain.java277
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/gantt/FXGanttWidget.java763
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/gantt/IGantt.java58
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/gantt/IntegerStringConverter.java82
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/gantt/elements/AbstractGanttViewElement.java102
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/gantt/elements/Arrow.java53
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/gantt/elements/ArrowElement.java34
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/gantt/elements/ArrowTimeMarkerViewElement.java193
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/gantt/elements/DataFlowArrowViewElement.java198
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/gantt/elements/DataFlowArrowViewElementAlternative.java113
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/gantt/elements/DurationModelElement.java107
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/gantt/elements/FlashTimeMarkerViewElement.java116
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/gantt/elements/FollowingDataFlowArrowViewElement.java94
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/gantt/elements/IntervalViewElement.java98
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/gantt/elements/MultysamplingViewElement.java379
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/gantt/elements/OversamplingViewElement.java46
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/gantt/elements/ProgressViewElement.java112
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/gantt/elements/ProgressWithLabelElementView.java110
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/gantt/elements/TimeMarkModelElement.java78
-rw-r--r--plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/gantt/elements/UndersamplingViewElement.java44
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/misc/FXUtil.java82
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/tracewidget/ITraceWidget.java72
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.app4mc.multicore.execution.ui.widget/src/org/eclipse/app4mc/multicore/execution/ui/widget/tracewidget/TraceWidget.java1460
118 files changed, 13773 insertions, 8296 deletions
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/META-INF/MANIFEST.MF b/plugins/org.eclipse.app4mc.multicore.execution.logic/META-INF/MANIFEST.MF
index 16263fe4..69e1a684 100755
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-Name: APP4MC Multicore Execution Logic
Bundle-SymbolicName: org.eclipse.app4mc.multicore.execution.logic
Bundle-Version: 0.9.4.qualifier
Bundle-Activator: org.eclipse.app4mc.multicore.execution.logic.Activator
-Require-Bundle: org.apache.commons.math,
+Require-Bundle: org.apache.commons.math;resolution:=optional,
org.junit,
org.eclipse.app4mc.amalthea.model,
org.eclipse.app4mc.multicore.sharelibs
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/build.properties b/plugins/org.eclipse.app4mc.multicore.execution.logic/build.properties
index 006e032b..8b91b0bd 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/build.properties
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/build.properties
@@ -1,17 +1,17 @@
-###############################################################################
-# /*******************************************************************************
-# * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
-# * All rights reserved. This program and the accompanying materials
-# * are made available under the terms of the Eclipse Public License 2.0
-# * which accompanies this distribution, and is available at
-# * https://www.eclipse.org/legal/epl-2.0/
-# *
-# * Contributors:
-# * Dortmund University of Applied Sciences and Arts - initial API and implementation
-# *
-# ******************************************************************************/
-###############################################################################
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .
+###############################################################################
+# /*******************************************************************************
+# * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+# * All rights reserved. This program and the accompanying materials
+# * are made available under the terms of the Eclipse Public License 2.0
+# * which accompanies this distribution, and is available at
+# * https://www.eclipse.org/legal/epl-2.0/
+# *
+# * Contributors:
+# * Dortmund University of Applied Sciences and Arts - initial API and implementation
+# *
+# ******************************************************************************/
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/Activator.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/Activator.java
index 053123a0..4991ec52 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/Activator.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/Activator.java
@@ -1,41 +1,41 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *******************************************************************************/
-
-package org.eclipse.app4mc.multicore.execution.logic;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class Activator implements BundleActivator {
-
- private static BundleContext context;
-
- static BundleContext getContext() {
- return context;
- }
-
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext bundleContext) throws Exception {
- Activator.context = bundleContext;
- }
-
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext bundleContext) throws Exception {
- Activator.context = null;
- }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+
+package org.eclipse.app4mc.multicore.execution.logic;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/ExecutionModel.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/ExecutionModel.java
index 8868056a..989cd9fd 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/ExecutionModel.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/ExecutionModel.java
@@ -1,137 +1,146 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.executionmodel;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.function.BiConsumer;
-import java.util.function.Consumer;
-
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.misc.EMTimeType;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMCore;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTask;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskHistState;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTask.DeadlineEntry;
-
-public class ExecutionModel{
-
- private final Map<String,EMCore> cores = new HashMap<>();
-
- private final List<Consumer<EMCore>> coreAddedListener = new LinkedList<>();
-
- private final Map<String,EMTask> tasks = new HashMap<>();
-
- private final List<Consumer<EMTask>> taskAddedListener = new LinkedList<>();
-
- private List<BiConsumer<EMTask, EMTaskHistState>> histEntryListener = new LinkedList<>();
-
- private List<BiConsumer<EMTask, DeadlineEntry>> deadlineListener=new LinkedList<>();
-
- private EMTimeType timeScale=EMTimeType.NONE;
-
- public Map<String, EMCore> getCores() {
- return cores;
- }
-
- /**
- * Tasks in of after execution.
- * @see EMTask
- * @return
- */
- public Map<String, EMTask> getTasks() {
- return tasks;
- }
-
- public void setTimeScale(EMTimeType t){
- this.timeScale=t;
- }
-
- public EMTimeType getTimeScale(){
- return timeScale;
- }
-
- public void addTaskDeadlineMissedEntry(String taskName,String core,Long time){
- final EMTask t =tasks.get(taskName);
- DeadlineEntry d= new DeadlineEntry(time, cores.get(core));
- t.getMissedDeadlines().add(d);
- notifyTaskDeadlineMissed(t, d);
- }
-
- /**
- * Add a history entry to a task (e.g state running from time point 1000 to 1223).
- * By adding the entry with this method observer will be notified about completed task hist entries.
- * @param taskName
- * @param e
- */
- public void addTaskHistEntry(String taskName,EMTaskHistState e){
- final EMTask t =tasks.get(taskName);
- t.getStateHistory().add(e);
- notifyTaskHistEntryListener(t,e);
- }
-
- /**
- * Add a task to the model. Only this method will notify observers about added tasks.
- * @param t
- */
- public synchronized void addTask(EMTask t){
- tasks.put(t.getName(), t);
- notifyTaskAddedListener(t);
- }
-
- /**
- * Add a core to the model. Only this method will notify observers about added cores.
- * @param c
- */
- public void addCore(EMCore c){
- cores.put(c.getName(), c);
- notifyAllCoreAddedObserver(c);
- }
-
- private void notifyAllCoreAddedObserver(EMCore c) {
- coreAddedListener.forEach(x->x.accept(c));
- }
-
- private void notifyTaskAddedListener(EMTask t){
- taskAddedListener.forEach(x->x.accept(t));
- }
-
- private void notifyTaskHistEntryListener(EMTask t, EMTaskHistState e){
- histEntryListener.forEach(x->x.accept(t, e));
- }
-
- public void addTaskHistEntryAddedListener(BiConsumer<EMTask, EMTaskHistState> e ){
- histEntryListener.add(e);
- }
-
- public void addTaskAddedListener(Consumer<EMTask> t){
- taskAddedListener.add(t);
- }
-
- public void addCoreAddedListener(Consumer<EMCore> c){
- coreAddedListener.add(c);
- }
-
- public void addTaskDeadlineListener(BiConsumer<EMTask, DeadlineEntry> e) {
- deadlineListener.add(e);
- }
-
- private void notifyTaskDeadlineMissed(EMTask t, DeadlineEntry e){
- deadlineListener.forEach(x->x.accept(t, e));
- }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.executionmodel;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.function.BiConsumer;
+import java.util.function.Consumer;
+
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.misc.EMTimeType;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMCore;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTask;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskHistState;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTask.DeadlineEntry;
+
+public class ExecutionModel{
+
+ private final Map<String,EMCore> cores = new HashMap<>();
+
+ private final List<Consumer<EMCore>> coreAddedListener = new LinkedList<>();
+
+ private final Map<String,EMTask> tasks = new HashMap<>();
+
+ private final List<Consumer<EMTask>> taskAddedListener = new LinkedList<>();
+
+ private List<BiConsumer<EMTask, EMTaskHistState>> histEntryListener = new LinkedList<>();
+
+ private List<BiConsumer<EMTask, DeadlineEntry>> deadlineListener=new LinkedList<>();
+
+ private EMTimeType timeScale=EMTimeType.NONE;
+
+ private String path="";
+
+ public Map<String, EMCore> getCores() {
+ return cores;
+ }
+
+ /**
+ * Tasks in of after execution.
+ * @see EMTask
+ * @return
+ */
+ public Map<String, EMTask> getTasks() {
+ return tasks;
+ }
+
+ public void setTimeScale(EMTimeType t){
+ this.timeScale=t;
+ }
+
+ public EMTimeType getTimeScale(){
+ return timeScale;
+ }
+
+ public void addTaskDeadlineMissedEntry(String taskName,String core,Long time){
+ final EMTask t =tasks.get(taskName);
+ DeadlineEntry d= new DeadlineEntry(time, cores.get(core));
+ t.getMissedDeadlines().add(d);
+ notifyTaskDeadlineMissed(t, d);
+ }
+
+ /**
+ * Add a history entry to a task (e.g state running from time point 1000 to 1223).
+ * By adding the entry with this method observer will be notified about completed task hist entries.
+ * @param taskName
+ * @param e
+ */
+ public void addTaskHistEntry(String taskName,EMTaskHistState e){
+ final EMTask t =tasks.get(taskName);
+ t.getStateHistory().add(e);
+ notifyTaskHistEntryListener(t,e);
+ }
+
+ /**
+ * Add a task to the model. Only this method will notify observers about added tasks.
+ * @param t
+ */
+ public synchronized void addTask(EMTask t){
+ tasks.put(t.getName(), t);
+ notifyTaskAddedListener(t);
+ }
+
+ /**
+ * Add a core to the model. Only this method will notify observers about added cores.
+ * @param c
+ */
+ public void addCore(EMCore c){
+ cores.put(c.getName(), c);
+ notifyAllCoreAddedObserver(c);
+ }
+
+ private void notifyAllCoreAddedObserver(EMCore c) {
+ coreAddedListener.forEach(x->x.accept(c));
+ }
+
+ private void notifyTaskAddedListener(EMTask t){
+ taskAddedListener.forEach(x->x.accept(t));
+ }
+
+ private void notifyTaskHistEntryListener(EMTask t, EMTaskHistState e){
+ histEntryListener.forEach(x->x.accept(t, e));
+ }
+
+ public void addTaskHistEntryAddedListener(BiConsumer<EMTask, EMTaskHistState> e ){
+ histEntryListener.add(e);
+ }
+
+ public void addTaskAddedListener(Consumer<EMTask> t){
+ taskAddedListener.add(t);
+ }
+
+ public void addCoreAddedListener(Consumer<EMCore> c){
+ coreAddedListener.add(c);
+ }
+
+ public void addTaskDeadlineListener(BiConsumer<EMTask, DeadlineEntry> e) {
+ deadlineListener.add(e);
+ }
+
+ private void notifyTaskDeadlineMissed(EMTask t, DeadlineEntry e){
+ deadlineListener.forEach(x->x.accept(t, e));
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/misc/EMTimeType.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/misc/EMTimeType.java
index 8f4e8151..5a9383b9 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/misc/EMTimeType.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/misc/EMTimeType.java
@@ -1,53 +1,53 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.executionmodel.misc;
-
-public enum EMTimeType {
- NONE(0),
- PS(1),
- NS(1000L),
- US(1000L*1000L),
- MS(1000L*1000L*1000L),
- S(1000L*1000L*1000L*1000L);
-
-
-
- private final long picos;
-
- EMTimeType(final long picos){
- this.picos=picos;
- }
-
- /**
- * Computes the amount of picoseconds depending on the object.
- * Example:
- * EMTimeType.NS.toPicos(2) => 2000
- * @param val
- * @return
- */
- public long toPicos(long val){
- return val*picos;
- }
-
- /**
- * Get amount of pico seconds.
- * @return
- */
- public long picos(){
- return picos;
- }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.executionmodel.misc;
+
+public enum EMTimeType {
+ NONE(0),
+ PS(1),
+ NS(1000L),
+ US(1000L*1000L),
+ MS(1000L*1000L*1000L),
+ S(1000L*1000L*1000L*1000L);
+
+
+
+ private final long picos;
+
+ EMTimeType(final long picos){
+ this.picos=picos;
+ }
+
+ /**
+ * Computes the amount of picoseconds depending on the object.
+ * Example:
+ * EMTimeType.NS.toPicos(2) => 2000
+ * @param val
+ * @return
+ */
+ public long toPicos(long val){
+ return val*picos;
+ }
+
+ /**
+ * Get amount of pico seconds.
+ * @return
+ */
+ public long picos(){
+ return picos;
+ }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/misc/ExecutionModelException.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/misc/ExecutionModelException.java
index e50702db..d484d7d3 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/misc/ExecutionModelException.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/misc/ExecutionModelException.java
@@ -1,27 +1,27 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.executionmodel.misc;
-
-public class ExecutionModelException extends RuntimeException {
- /**
- *
- */
- private static final long serialVersionUID = 119984108923285814L;
-
- public ExecutionModelException(String msg){
- super(msg);
- }
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.executionmodel.misc;
+
+public class ExecutionModelException extends RuntimeException {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 119984108923285814L;
+
+ public ExecutionModelException(String msg){
+ super(msg);
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMCore.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMCore.java
index e1b83b4d..74b8d4fb 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMCore.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMCore.java
@@ -1,41 +1,41 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.executionmodel.types;
-
-public class EMCore {
-
- private final String name;
-
-// private long fequency=0; //example additional data
-
- public EMCore(String name){
- this.name = name;
- }
-
-
- public String getName() {
- return name;
- }
-
-// public long getFequency() {
-// return fequency;
-// }
-//
-// public void setFequency(long fequency) {
-// this.fequency = fequency;
-// }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.executionmodel.types;
+
+public class EMCore {
+
+ private final String name;
+
+// private long fequency=0; //example additional data
+
+ public EMCore(String name){
+ this.name = name;
+ }
+
+
+ public String getName() {
+ return name;
+ }
+
+// public long getFequency() {
+// return fequency;
+// }
+//
+// public void setFequency(long fequency) {
+// this.fequency = fequency;
+// }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTask.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTask.java
index f973498e..1a1290ed 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTask.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTask.java
@@ -1,61 +1,61 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.executionmodel.types;
-
-import java.util.LinkedList;
-import java.util.List;
-
-public class EMTask {
-
- private List<EMTaskHistState> history= new LinkedList<>();
-
- public static class DeadlineEntry{
- public final long time;
- public final EMCore core;
-
- public DeadlineEntry(long time,EMCore core){
- this.time=time;
- this.core=core;
- }
- }
-
- private List<DeadlineEntry> missedDeadlines = new LinkedList<>();
-
- private final String name;
-
- public EMTask(String name){
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public List<EMTaskHistState> getStateHistory() {
- return history;
- }
-
-
- public List<DeadlineEntry> getMissedDeadlines() {
- return missedDeadlines;
- }
-
-
-
-
-
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.executionmodel.types;
+
+import java.util.LinkedList;
+import java.util.List;
+
+public class EMTask {
+
+ private List<EMTaskHistState> history= new LinkedList<>();
+
+ public static class DeadlineEntry{
+ public final long time;
+ public final EMCore core;
+
+ public DeadlineEntry(long time,EMCore core){
+ this.time=time;
+ this.core=core;
+ }
+ }
+
+ private List<DeadlineEntry> missedDeadlines = new LinkedList<>();
+
+ private final String name;
+
+ public EMTask(String name){
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public List<EMTaskHistState> getStateHistory() {
+ return history;
+ }
+
+
+ public List<DeadlineEntry> getMissedDeadlines() {
+ return missedDeadlines;
+ }
+
+
+
+
+
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTaskEvent.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTaskEvent.java
index 636c89e7..38a50b99 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTaskEvent.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTaskEvent.java
@@ -1,33 +1,33 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.executionmodel.types;
-
-public enum EMTaskEvent {
- WAIT(0),
- TERMINATE(1),
- ACTIVATE(2),
- RELEASE(3),
- PREEMPT(4),
- START(5),
- NONE(6);
-
- public final static int COUNT = 5;
-
- private final int id;
- EMTaskEvent(int id) { this.id = id; }
- public int val() { return id; }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.executionmodel.types;
+
+public enum EMTaskEvent {
+ WAIT(0),
+ TERMINATE(1),
+ ACTIVATE(2),
+ RELEASE(3),
+ PREEMPT(4),
+ START(5),
+ NONE(6);
+
+ public final static int COUNT = 5;
+
+ private final int id;
+ EMTaskEvent(int id) { this.id = id; }
+ public int val() { return id; }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTaskFSM.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTaskFSM.java
index b094ecc7..83ea0458 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTaskFSM.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTaskFSM.java
@@ -1,71 +1,71 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.executionmodel.types;
-
-
-public class EMTaskFSM {
-
-
-
- private final static EMTaskState[][] multi = new EMTaskState[EMTaskState.COUNT][EMTaskEvent.COUNT];
-
- static{
- //every non transition is null
- /*outgoing transitions for state RUNNING*/
- makeTransition(EMTaskState.RUNNING,EMTaskEvent.TERMINATE,EMTaskState.SUSPENDED);
- makeTransition(EMTaskState.RUNNING,EMTaskEvent.PREEMPT,EMTaskState.READY);
- makeTransition(EMTaskState.RUNNING,EMTaskEvent.WAIT,EMTaskState.WAITING);
-
- /*outgoing transitions for state READY*/
- makeTransition(EMTaskState.READY,EMTaskEvent.START,EMTaskState.RUNNING);
-
- /*outgoing transitions for state WAITING*/
- makeTransition(EMTaskState.WAITING,EMTaskEvent.RELEASE,EMTaskState.READY);
-
- /*outgoing transitions for state SUSPENDED*/
- makeTransition(EMTaskState.SUSPENDED,EMTaskEvent.ACTIVATE,EMTaskState.READY);
- }
-
- private static void makeTransition(EMTaskState oldState,EMTaskEvent e, EMTaskState newState){
- multi[oldState.val()][e.val()]=newState;
- }
-
- private EMTaskState currentState;
-
- public EMTaskFSM(EMTaskState start){
- currentState=start;
- }
-
- public void setState(EMTaskState state){
- this.currentState=state;
- }
-
- public EMTaskState getState(){
- return currentState;
- }
-
- public boolean dispatchEvent(EMTaskEvent event){
- EMTaskState newState=multi[currentState.val()][event.val()];
- if(newState!=null){
- currentState=newState;
- return true;
- }else{
- //no state change
- return false;
- }
- }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.executionmodel.types;
+
+
+public class EMTaskFSM {
+
+
+
+ private final static EMTaskState[][] multi = new EMTaskState[EMTaskState.COUNT][EMTaskEvent.COUNT];
+
+ static{
+ //every non transition is null
+ /*outgoing transitions for state RUNNING*/
+ makeTransition(EMTaskState.RUNNING,EMTaskEvent.TERMINATE,EMTaskState.SUSPENDED);
+ makeTransition(EMTaskState.RUNNING,EMTaskEvent.PREEMPT,EMTaskState.READY);
+ makeTransition(EMTaskState.RUNNING,EMTaskEvent.WAIT,EMTaskState.WAITING);
+
+ /*outgoing transitions for state READY*/
+ makeTransition(EMTaskState.READY,EMTaskEvent.START,EMTaskState.RUNNING);
+
+ /*outgoing transitions for state WAITING*/
+ makeTransition(EMTaskState.WAITING,EMTaskEvent.RELEASE,EMTaskState.READY);
+
+ /*outgoing transitions for state SUSPENDED*/
+ makeTransition(EMTaskState.SUSPENDED,EMTaskEvent.ACTIVATE,EMTaskState.READY);
+ }
+
+ private static void makeTransition(EMTaskState oldState,EMTaskEvent e, EMTaskState newState){
+ multi[oldState.val()][e.val()]=newState;
+ }
+
+ private EMTaskState currentState;
+
+ public EMTaskFSM(EMTaskState start){
+ currentState=start;
+ }
+
+ public void setState(EMTaskState state){
+ this.currentState=state;
+ }
+
+ public EMTaskState getState(){
+ return currentState;
+ }
+
+ public boolean dispatchEvent(EMTaskEvent event){
+ EMTaskState newState=multi[currentState.val()][event.val()];
+ if(newState!=null){
+ currentState=newState;
+ return true;
+ }else{
+ //no state change
+ return false;
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTaskHistState.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTaskHistState.java
index de089df9..005ed8c5 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTaskHistState.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTaskHistState.java
@@ -1,115 +1,115 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.executionmodel.types;
-
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.misc.ExecutionModelException;
-
-public class EMTaskHistState {
- /*Constants*/
- public static final long UNKNOWN_PAST = Long.MIN_VALUE;
- public static final long UNKNOWN_FUTURE =Long.MAX_VALUE;
-
- private static final String UNKNOWN_STRING="unknown";
-
- private EMCore core;
- /**Time at event occurrence*/
- private long start = UNKNOWN_PAST;
- /**Time the */
- private long end = UNKNOWN_FUTURE;
- /**The state the task remains between start and stop*/
- private EMTaskState state;
- /**Additional information*/
- private String note=UNKNOWN_STRING;
- /**The entity the event fired*/
- private String eventSource=UNKNOWN_STRING;
- /**The event type*/
- private EMTaskEvent event;
- /**Cause of the event. E.g. wait event caused by mutex "mux_xy"*/
- private String eventCause=UNKNOWN_STRING;
-
- public static class EMTaskHistStateFactory{
- public static EMTaskHistState create(EMTaskState state,EMCore core) throws ExecutionModelException {
- if((state == EMTaskState.RUNNING )&& core ==null){
- throw new ExecutionModelException("");
- }
- EMTaskHistState entry = new EMTaskHistState();
- entry.setCore(core);
- entry.setState(state);
- return entry;
- }
- public static EMTaskHistState create(EMTaskState state) throws ExecutionModelException{
- return create(state,null);
- }
- }
-
- private EMTaskHistState(){
- }
-
- public EMCore getCore() {
- return core;
- }
- private void setCore(EMCore core) {
- this.core = core;
- }
- public long getStart() {
- return start;
- }
- public void setStart(long start) {
- this.start = start;
- }
- public long getEnd() {
- return end;
- }
- public void setEnd(long end) {
- this.end = end;
- }
- public EMTaskState getState() {
- return state;
- }
- private void setState(EMTaskState state) {
- this.state = state;
- }
- public String getNote() {
- return note;
- }
- public void setNote(String note) {
- this.note = note;
- }
- public String getEventSource() {
- return eventSource;
- }
- public void setEventSource(String eventSource) {
- this.eventSource = eventSource;
- }
- public void setEventCause(String eventCause){
- this.eventCause=eventCause;
- }
- public String getEventCause(){
- return eventCause;
- }
- public EMTaskEvent getEvent() {
- return event;
- }
- public void setEvent(EMTaskEvent event) {
- this.event = event;
- }
-
- public boolean isCompleted(){
- return start!=UNKNOWN_PAST && end!=UNKNOWN_FUTURE;
- }
-
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.executionmodel.types;
+
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.misc.ExecutionModelException;
+
+public class EMTaskHistState {
+ /*Constants*/
+ public static final long UNKNOWN_PAST = Long.MIN_VALUE;
+ public static final long UNKNOWN_FUTURE =Long.MAX_VALUE;
+
+ private static final String UNKNOWN_STRING="unknown";
+
+ private EMCore core;
+ /**Time at event occurrence*/
+ private long start = UNKNOWN_PAST;
+ /**Time the */
+ private long end = UNKNOWN_FUTURE;
+ /**The state the task remains between start and stop*/
+ private EMTaskState state;
+ /**Additional information*/
+ private String note=UNKNOWN_STRING;
+ /**The entity the event fired*/
+ private String eventSource=UNKNOWN_STRING;
+ /**The event type*/
+ private EMTaskEvent event;
+ /**Cause of the event. E.g. wait event caused by mutex "mux_xy"*/
+ private String eventCause=UNKNOWN_STRING;
+
+ public static class EMTaskHistStateFactory{
+ public static EMTaskHistState create(EMTaskState state,EMCore core) throws ExecutionModelException {
+ if((state == EMTaskState.RUNNING )&& core ==null){
+ throw new ExecutionModelException("");
+ }
+ EMTaskHistState entry = new EMTaskHistState();
+ entry.setCore(core);
+ entry.setState(state);
+ return entry;
+ }
+ public static EMTaskHistState create(EMTaskState state) throws ExecutionModelException{
+ return create(state,null);
+ }
+ }
+
+ private EMTaskHistState(){
+ }
+
+ public EMCore getCore() {
+ return core;
+ }
+ private void setCore(EMCore core) {
+ this.core = core;
+ }
+ public long getStart() {
+ return start;
+ }
+ public void setStart(long start) {
+ this.start = start;
+ }
+ public long getEnd() {
+ return end;
+ }
+ public void setEnd(long end) {
+ this.end = end;
+ }
+ public EMTaskState getState() {
+ return state;
+ }
+ private void setState(EMTaskState state) {
+ this.state = state;
+ }
+ public String getNote() {
+ return note;
+ }
+ public void setNote(String note) {
+ this.note = note;
+ }
+ public String getEventSource() {
+ return eventSource;
+ }
+ public void setEventSource(String eventSource) {
+ this.eventSource = eventSource;
+ }
+ public void setEventCause(String eventCause){
+ this.eventCause=eventCause;
+ }
+ public String getEventCause(){
+ return eventCause;
+ }
+ public EMTaskEvent getEvent() {
+ return event;
+ }
+ public void setEvent(EMTaskEvent event) {
+ this.event = event;
+ }
+
+ public boolean isCompleted(){
+ return start!=UNKNOWN_PAST && end!=UNKNOWN_FUTURE;
+ }
+
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTaskState.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTaskState.java
index a4e3b065..09128fea 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTaskState.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/executionmodel/types/EMTaskState.java
@@ -1,30 +1,30 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.executionmodel.types;
-
-
-public enum EMTaskState {
- SUSPENDED(0),
- RUNNING(1),
- READY(2),
- WAITING(3);
-
- public final static int COUNT= 8;
-
- private final int id;
- EMTaskState(int id) { this.id = id; }
- public int val() { return id; }
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.executionmodel.types;
+
+
+public enum EMTaskState {
+ SUSPENDED(0),
+ RUNNING(1),
+ READY(2),
+ WAITING(3);
+
+ public final static int COUNT= 8;
+
+ private final int id;
+ EMTaskState(int id) { this.id = id; }
+ public int val() { return id; }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/AmaltheaModelBuilder.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/AmaltheaModelBuilder.java
index 7a025ebf..cfd31c91 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/AmaltheaModelBuilder.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/AmaltheaModelBuilder.java
@@ -1,93 +1,93 @@
-/**
- ********************************************************************************
- * Copyright (c) 2015, 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- *
+/**
+ ********************************************************************************
+ * Copyright (c) 2015, 2017 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *
******************************************************************************/
-package org.eclipse.app4mc.multicore.execution.logic.openmapping;
-
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.eclipse.app4mc.amalthea.model.Amalthea;
-import org.eclipse.app4mc.amalthea.model.AmaltheaFactory;
-import org.eclipse.app4mc.amalthea.model.MappingModel;
-import org.eclipse.app4mc.amalthea.model.OSModel;
-import org.eclipse.app4mc.amalthea.model.OperatingSystem;
-import org.eclipse.app4mc.amalthea.model.SchedulerAllocation;
-import org.eclipse.app4mc.amalthea.model.TaskAllocation;
-
-public class AmaltheaModelBuilder {
- private final OMMapping mapping;
- private Amalthea centralModel;
-
- public AmaltheaModelBuilder(final OMMapping mapping) {
- this.mapping = mapping;
- }
-
- public Amalthea getAmaltheaModel() {
- // Build the model if it is not present or has been updated
- if (null == this.centralModel) {
- buildAmaltheaModel();
- }
-
- return this.centralModel;
- }
-
- private void buildAmaltheaModel() {
- // Create an empty MappingModel
- final MappingModel mappingModel = AmaltheaFactory.eINSTANCE.createMappingModel();
- // TODO Ideally, this should be handled by an OSModel Builder
- // Create an OSModel with a parent element "OS"
- final OSModel osModel = AmaltheaFactory.eINSTANCE.createOSModel();
- final OperatingSystem os = AmaltheaFactory.eINSTANCE.createOperatingSystem();
- os.setName("OS");
- osModel.getOperatingSystems().add(os);
-
- // Create the schedulers and the allocations (core<->scheduler && task<->scheduler)
- final HashMap<OMCore, OMScheduler> coreSchedulerMap = new HashMap<OMCore, OMScheduler>();
- final Iterator<OMAllocation> itAllocations = this.mapping.getAllocationList().iterator();
- while (itAllocations.hasNext()) {
- final OMAllocation allocation = itAllocations.next();
- // TODO Allocation Attributes are still missing!
- final OMCore core = allocation.getCore();
- final OMTask task = allocation.getTask();
- OMScheduler scheduler;
-
- // Check if scheduler has been created and store / create and store it
- if (coreSchedulerMap.containsKey(core)) {
- scheduler = coreSchedulerMap.get(core);
- }
- else {
- // Create scheduler
- scheduler = new OMScheduler(core);
- // Add scheduler to os model
- os.getTaskSchedulers().add(scheduler.getSchedulerRef());
- // Create entries in mapping model
- final SchedulerAllocation schedAlloc = AmaltheaFactory.eINSTANCE.createSchedulerAllocation();
- schedAlloc.getResponsibility().add(core.getCoreRef());
- schedAlloc.setScheduler(scheduler.getSchedulerRef());
- mappingModel.getSchedulerAllocation().add(schedAlloc);
- // Remember StepScheduler in map
- coreSchedulerMap.put(core, scheduler);
- }
- // Create Task<->StepScheduler allocation entries in mapping model
- final TaskAllocation taskAlloc = AmaltheaFactory.eINSTANCE.createTaskAllocation();
- taskAlloc.setTask(task.getTaskRef());
- taskAlloc.setScheduler(scheduler.getSchedulerRef());
- mappingModel.getTaskAllocation().add(taskAlloc);
- }
- // Create AMALTHEA (Central) model and store results
- this.centralModel = AmaltheaFactory.eINSTANCE.createAmalthea();
- this.centralModel.setOsModel(osModel);
- this.centralModel.setMappingModel(mappingModel);
- }
-}
+package org.eclipse.app4mc.multicore.execution.logic.openmapping;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.app4mc.amalthea.model.Amalthea;
+import org.eclipse.app4mc.amalthea.model.AmaltheaFactory;
+import org.eclipse.app4mc.amalthea.model.MappingModel;
+import org.eclipse.app4mc.amalthea.model.OSModel;
+import org.eclipse.app4mc.amalthea.model.OperatingSystem;
+import org.eclipse.app4mc.amalthea.model.SchedulerAllocation;
+import org.eclipse.app4mc.amalthea.model.TaskAllocation;
+
+public class AmaltheaModelBuilder {
+ private final OMMapping mapping;
+ private Amalthea centralModel;
+
+ public AmaltheaModelBuilder(final OMMapping mapping) {
+ this.mapping = mapping;
+ }
+
+ public Amalthea getAmaltheaModel() {
+ // Build the model if it is not present or has been updated
+ if (null == this.centralModel) {
+ buildAmaltheaModel();
+ }
+
+ return this.centralModel;
+ }
+
+ private void buildAmaltheaModel() {
+ // Create an empty MappingModel
+ final MappingModel mappingModel = AmaltheaFactory.eINSTANCE.createMappingModel();
+ // TODO Ideally, this should be handled by an OSModel Builder
+ // Create an OSModel with a parent element "OS"
+ final OSModel osModel = AmaltheaFactory.eINSTANCE.createOSModel();
+ final OperatingSystem os = AmaltheaFactory.eINSTANCE.createOperatingSystem();
+ os.setName("OS");
+ osModel.getOperatingSystems().add(os);
+
+ // Create the schedulers and the allocations (core<->scheduler && task<->scheduler)
+ final HashMap<OMCore, OMScheduler> coreSchedulerMap = new HashMap<OMCore, OMScheduler>();
+ final Iterator<OMAllocation> itAllocations = this.mapping.getAllocationList().iterator();
+ while (itAllocations.hasNext()) {
+ final OMAllocation allocation = itAllocations.next();
+ // TODO Allocation Attributes are still missing!
+ final OMCore core = allocation.getCore();
+ final OMTask task = allocation.getTask();
+ OMScheduler scheduler;
+
+ // Check if scheduler has been created and store / create and store it
+ if (coreSchedulerMap.containsKey(core)) {
+ scheduler = coreSchedulerMap.get(core);
+ }
+ else {
+ // Create scheduler
+ scheduler = new OMScheduler(core);
+ // Add scheduler to os model
+ os.getTaskSchedulers().add(scheduler.getSchedulerRef());
+ // Create entries in mapping model
+ final SchedulerAllocation schedAlloc = AmaltheaFactory.eINSTANCE.createSchedulerAllocation();
+ schedAlloc.getResponsibility().add(core.getCoreRef());
+ schedAlloc.setScheduler(scheduler.getSchedulerRef());
+ mappingModel.getSchedulerAllocation().add(schedAlloc);
+ // Remember StepScheduler in map
+ coreSchedulerMap.put(core, scheduler);
+ }
+ // Create Task<->StepScheduler allocation entries in mapping model
+ final TaskAllocation taskAlloc = AmaltheaFactory.eINSTANCE.createTaskAllocation();
+ taskAlloc.setTask(task.getTaskRef());
+ taskAlloc.setScheduler(scheduler.getSchedulerRef());
+ mappingModel.getTaskAllocation().add(taskAlloc);
+ }
+ // Create AMALTHEA (Central) model and store results
+ this.centralModel = AmaltheaFactory.eINSTANCE.createAmalthea();
+ this.centralModel.setOsModel(osModel);
+ this.centralModel.setMappingModel(mappingModel);
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/MalformedModelException.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/MalformedModelException.java
index 8e86160e..8800468c 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/MalformedModelException.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/MalformedModelException.java
@@ -1,28 +1,28 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.app4mc.multicore.execution.logic.openmapping;
-
-public class MalformedModelException extends Exception{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public MalformedModelException(String msg){
- super(msg);
- }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.app4mc.multicore.execution.logic.openmapping;
+
+public class MalformedModelException extends Exception{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public MalformedModelException(String msg){
+ super(msg);
+ }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMAllocation.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMAllocation.java
index d410675e..9373469b 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMAllocation.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMAllocation.java
@@ -1,71 +1,71 @@
-/**
- ********************************************************************************
- * Copyright (c) 2015, 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- *
+/**
+ ********************************************************************************
+ * Copyright (c) 2015, 2017 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *
******************************************************************************/
-package org.eclipse.app4mc.multicore.execution.logic.openmapping;
-
-import java.util.HashMap;
-
-public class OMAllocation {
- private final OMTask task;
- private final OMCore core;
- private final OMScheduler scheduler;
- private final HashMap<String, Object> attributeList = new HashMap<String, Object>();
-
- public OMAllocation(final OMTask task, final OMCore core) {
- this.task = task;
- this.core = core;
- // TODO Likely an unoptimal approach...
- this.scheduler = null;
- }
-
-
- public OMTask getTask() {
- return this.task;
- }
-
- public OMCore getCore() {
- return this.core;
- }
-
- public OMScheduler getScheduler() {
- return this.scheduler;
- }
-
- // TODO Pragmatic solution, this should be improved according to a design
- // schema
- public void addAttribute(final String key, final Object value) {
- this.attributeList.put(key, value);
- }
-
- public Object getAttribute(final String key) {
- return this.attributeList.get(key);
- }
-
- /**
- * Calculates the processing time in pico-seconds (ps) of a Task task on
- * Core core.
- *
- * @param task
- * Task to be executed
- * @param core
- * Core executing the task
- * @return Execution time of Task task on Core core .
- * @throws MalformedModelException
- */
- public long calculateProcessingTime() throws MalformedModelException {
-
- return OMUtil.getProcessingTime(core, task.getInstructionCount());
-
- }
-}
+package org.eclipse.app4mc.multicore.execution.logic.openmapping;
+
+import java.util.HashMap;
+
+public class OMAllocation {
+ private final OMTask task;
+ private final OMCore core;
+ private final OMScheduler scheduler;
+ private final HashMap<String, Object> attributeList = new HashMap<String, Object>();
+
+ public OMAllocation(final OMTask task, final OMCore core) {
+ this.task = task;
+ this.core = core;
+ // TODO Likely an unoptimal approach...
+ this.scheduler = null;
+ }
+
+
+ public OMTask getTask() {
+ return this.task;
+ }
+
+ public OMCore getCore() {
+ return this.core;
+ }
+
+ public OMScheduler getScheduler() {
+ return this.scheduler;
+ }
+
+ // TODO Pragmatic solution, this should be improved according to a design
+ // schema
+ public void addAttribute(final String key, final Object value) {
+ this.attributeList.put(key, value);
+ }
+
+ public Object getAttribute(final String key) {
+ return this.attributeList.get(key);
+ }
+
+ /**
+ * Calculates the processing time in pico-seconds (ps) of a Task task on
+ * Core core.
+ *
+ * @param task
+ * Task to be executed
+ * @param core
+ * Core executing the task
+ * @return Execution time of Task task on Core core .
+ * @throws MalformedModelException
+ */
+ public long calculateProcessingTime() throws MalformedModelException {
+
+ return OMUtil.getProcessingTime(core, task.getInstructionCount());
+
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMAttribute.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMAttribute.java
index b1d79c17..4bca3a6e 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMAttribute.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMAttribute.java
@@ -1,33 +1,33 @@
-/**
- ********************************************************************************
- * Copyright (c) 2015, 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- *
+/**
+ ********************************************************************************
+ * Copyright (c) 2015, 2017 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *
******************************************************************************/
-package org.eclipse.app4mc.multicore.execution.logic.openmapping;
-
-public class OMAttribute<T> {
- private final String key;
- private final T val;
-
- public OMAttribute(final String key, final T val) {
- this.key = key;
- this.val = val;
- }
-
- public String getKey() {
- return this.key;
- }
-
- public T getValue() {
- return this.val;
- }
-}
+package org.eclipse.app4mc.multicore.execution.logic.openmapping;
+
+public class OMAttribute<T> {
+ private final String key;
+ private final T val;
+
+ public OMAttribute(final String key, final T val) {
+ this.key = key;
+ this.val = val;
+ }
+
+ public String getKey() {
+ return this.key;
+ }
+
+ public T getValue() {
+ return this.val;
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMCore.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMCore.java
index 5904e46d..eca676a4 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMCore.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMCore.java
@@ -1,168 +1,52 @@
-/**
- ********************************************************************************
- * Copyright (c) 2015, 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.app4mc.multicore.execution.logic.openmapping;
-
-import org.eclipse.app4mc.amalthea.model.ProcessingUnit;
-
-public class OMCore {
- private final ProcessingUnit coreRef;
- private long instructionsPerSecond = -1;
-
- public OMCore(final ProcessingUnit coreRef) {
- this.coreRef = coreRef;
- }
-
- public ProcessingUnit getCoreRef() {
- return this.coreRef;
- }
-
- /**
- * Calculates and/or returns the number of Instructions Per Second (IPS) the core is capable of precessing. * The
- * number of executed IPS depends on the following attributes:
- *
- * instructionsPerCycle (CoreType), clockRatio (Prescaler), and frequency (Quartz)
- *
- * The formula used for calculating this attribute is: frequency * clockRatio * instructionsPerCycle
- *
- * @return The number of Instructions executed per Second.
- * @throws MalformedModelException
- */
- public long getInstructionsPerSecond() throws MalformedModelException {
- // Return the Value, if it has been initialized before
- if (this.instructionsPerSecond >= 0) {
- return this.instructionsPerSecond;
- }
-
-
- // TODO dummy
- return 1;
-
-// // Calculate the Value otherwise
-// // Check the core's Prescaler element and its attribute
-// final Prescaler prescaler = this.coreRef.getPrescaler();
-// if (prescaler == null) {
-// UniversalHandler.getInstance().log("Invalid Hardware Model, Core '" + this.coreRef.getName()
-// + "' has an invalid or missing reference to its Prescaler.", null);
-// return -1;
-// }
-//
-// final double clockRatio = prescaler.getClockRatio();
-// if (clockRatio <= 0) {
-// UniversalHandler.getInstance().log("Invalid Hardware Model, the refered Prescaler of Core '"
-// + this.coreRef.getName() + "' contains an invalid value in attribute clockRatio.", null);
-// return -1;
-// }
-//
-// // Check the Quartz element and its attribute
-// final Quartz quartz = prescaler.getQuartz();
-// if (quartz == null) {
-// UniversalHandler.getInstance().log("Invalid Hardware Model, the refered Prescaler of Core '"
-// + this.coreRef.getName() + "' has an invalid or missing reference to Quartz.", null);
-// return -1;
-// }
-//
-// final long frequency = getFrequencyHz();
-// if (frequency <= 0) {
-// UniversalHandler.getInstance().log("Invalid Hardware Model, the refered Quartz of Core '"
-// + this.coreRef.getName() + "' contains an invalid value in attribute frequency.", null);
-// return -1;
-// }
-//
-// // Check ProcessingUnitDefinition and its attribute
-// final ProcessingUnitDefinition type = this.coreRef.getDefinition();
-// if (type == null) {
-// UniversalHandler.getInstance().log("Invalid Hardware Model, Core '" + this.coreRef.getName()
-// + "' has an invalid or missing reference to its CoreType.", null);
-// return -1;
-// }
-//
-// final float instructionsPerCycle = type.getInstructionsPerCycle();
-// if (instructionsPerCycle <= 0) {
-// UniversalHandler.getInstance().log("Invalid Hardware Model, the refered CoreType of Core '"
-// + this.coreRef.getName() + "' contains an invalid value in attribute instructionsPerCycle.", null);
-// return -1;
-// }
-//
-// // Calculate the instructions per second as the product of frequency, clockRatio and instructionsPerCycle
-// return (this.instructionsPerSecond = (long) (frequency * clockRatio * instructionsPerCycle));
- }
-
- public long getFrequencyHz() throws MalformedModelException{
-
- // TODO dummy
- return 1;
-
-// if(coreRef==null){
-// throw new MalformedModelException(
-// "No core available!");
-// }else if(coreRef.getPrescaler()==null){
-// throw new MalformedModelException(
-// "No prescaler at core: "+ coreRef.getName());
-// }else if(coreRef.getPrescaler().getQuartz()==null){
-// throw new MalformedModelException(
-// "No quartz at prescaler: "+ coreRef.getPrescaler().getName() +
-// " at core: "+coreRef.getName());
-// }else if (coreRef.getPrescaler().getQuartz().getFrequency()==null){
-// throw new MalformedModelException(
-// "No frequency at quartz: " + coreRef.getPrescaler().getQuartz().getName()+
-// " at prescaler: "+ coreRef.getPrescaler().getName() +
-// " at core: "+coreRef.getName());
-// }
-//
-// BigDecimal frequencyQuartz = AmaltheaServices.convertToHz(coreRef.getPrescaler().getQuartz().getFrequency());
-// if(frequencyQuartz==null){
-// throw new MalformedModelException(
-// "Malformed frequency at quartz: " + coreRef.getPrescaler().getQuartz()+
-// " at prescaler: "+ coreRef.getPrescaler().getName() +
-// " at core: "+coreRef.getName());
-// }
-// long frequency = frequencyQuartz.longValue();
-// return frequency;
-
-// final Frequency f = coreRef.getPrescaler().getQuartz().getFrequency();
-// double frequency = f.getValue();
-// switch (f.getUnit()) {
-// case HZ:
-// frequency *= 1;
-// break;
-// case KHZ:
-// frequency*=1000;
-// break;
-// case MHZ:
-// frequency*=1000000;
-// break;
-// case GHZ:
-// frequency*=1000000000L;
-// break;
-// default:
-// break;
-// }
-// return (long)frequency;
- }
-
- @Override
- public boolean equals(Object obj) {
- if(obj instanceof OMCore){
- OMCore c = (OMCore)obj;
- return coreRef.equals(c.getCoreRef());
- }
- return false;
- };
-
- @Override
- public String toString() {
- return this.coreRef.getUniqueName();
- }
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2015, 2017 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.app4mc.multicore.execution.logic.openmapping;
+
+import org.eclipse.app4mc.amalthea.model.ProcessingUnit;
+import org.eclipse.app4mc.amalthea.model.util.HardwareUtil;
+
+public class OMCore {
+ private final ProcessingUnit coreRef;
+
+ public OMCore(final ProcessingUnit coreRef) {
+ this.coreRef = coreRef;
+ }
+
+ public ProcessingUnit getCoreRef() {
+ return this.coreRef;
+ }
+
+ public long getFrequencyHz() throws MalformedModelException{
+ if(this.coreRef==null){
+ throw new MalformedModelException(
+ "No core available!");
+ }
+ return HardwareUtil.getFrequencyOfModuleInHz(this.coreRef);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if(obj instanceof OMCore){
+ OMCore c = (OMCore)obj;
+ return coreRef.equals(c.getCoreRef());
+ }
+ return false;
+ };
+
+ @Override
+ public String toString() {
+ return this.coreRef.getUniqueName();
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMEdge.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMEdge.java
index 216b36dc..fc1f5f2d 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMEdge.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMEdge.java
@@ -1,51 +1,51 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.app4mc.multicore.execution.logic.openmapping;
-
-/**
- * Edge between two OMTask for pre and post relation (execute before/ after).
- */
-public class OMEdge {
- private final OMTask pre;
- private final OMTask post;
- private final long releaseInstruction;
- private final long waitUntilReleaseInstruction;
-
- public OMEdge(OMTask pre,OMTask post, long releaseInstruction, long waitUntilReleaseInstruction) {
- super();
- this.pre = pre;
- this.post = post;
- this.releaseInstruction = releaseInstruction;
- this.waitUntilReleaseInstruction=waitUntilReleaseInstruction;
- }
-
- public OMTask getPre() {
- return pre;
- }
-
- public OMTask getPost(){
- return post;
- }
-
-
- public long getReleaseInstruction() {
- return releaseInstruction;
- }
-
- public long getWaitUntilReleaseInstruction(){
- return waitUntilReleaseInstruction;
- }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.app4mc.multicore.execution.logic.openmapping;
+
+/**
+ * Edge between two OMTask for pre and post relation (execute before/ after).
+ */
+public class OMEdge {
+ private final OMTask pre;
+ private final OMTask post;
+ private final long releaseInstruction;
+ private final long waitUntilReleaseInstruction;
+
+ public OMEdge(OMTask pre,OMTask post, long releaseInstruction, long waitUntilReleaseInstruction) {
+ super();
+ this.pre = pre;
+ this.post = post;
+ this.releaseInstruction = releaseInstruction;
+ this.waitUntilReleaseInstruction=waitUntilReleaseInstruction;
+ }
+
+ public OMTask getPre() {
+ return pre;
+ }
+
+ public OMTask getPost(){
+ return post;
+ }
+
+
+ public long getReleaseInstruction() {
+ return releaseInstruction;
+ }
+
+ public long getWaitUntilReleaseInstruction(){
+ return waitUntilReleaseInstruction;
+ }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMMapping.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMMapping.java
index 8d8b6108..69ba112b 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMMapping.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMMapping.java
@@ -1,32 +1,32 @@
-/**
- ********************************************************************************
- * Copyright (c) 2015, 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- *
+/**
+ ********************************************************************************
+ * Copyright (c) 2015, 2017 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *
******************************************************************************/
-package org.eclipse.app4mc.multicore.execution.logic.openmapping;
-
-import java.util.ArrayList;
-
-/**
- * The OM Mapping Class stores the allocations from tasks to cores.
- */
-public class OMMapping {
- private final ArrayList<OMAllocation> allocations = new ArrayList<OMAllocation>();
-
- public void addAllocation(final OMAllocation allocation) {
- this.allocations.add(allocation);
- }
-
- public ArrayList<OMAllocation> getAllocationList() {
- return this.allocations;
- }
-}
+package org.eclipse.app4mc.multicore.execution.logic.openmapping;
+
+import java.util.ArrayList;
+
+/**
+ * The OM Mapping Class stores the allocations from tasks to cores.
+ */
+public class OMMapping {
+ private final ArrayList<OMAllocation> allocations = new ArrayList<OMAllocation>();
+
+ public void addAllocation(final OMAllocation allocation) {
+ this.allocations.add(allocation);
+ }
+
+ public ArrayList<OMAllocation> getAllocationList() {
+ return this.allocations;
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMRunnable.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMRunnable.java
index 8a669e86..ff78b792 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMRunnable.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMRunnable.java
@@ -1,136 +1,77 @@
-/**
- ********************************************************************************
- * Copyright (c) 2015, 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- *
+/**
+ ********************************************************************************
+ * Copyright (c) 2015, 2017 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *
******************************************************************************/
-package org.eclipse.app4mc.multicore.execution.logic.openmapping;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.app4mc.amalthea.model.Runnable;
-import org.eclipse.app4mc.amalthea.model.RunnableItem;
-import org.eclipse.app4mc.multicore.sharelibs.UniversalHandler;
-import org.eclipse.emf.common.util.EList;
-
-public class OMRunnable {
- private final Runnable runnableRef;
- private long instructions = -1;
-
-// private final List<OMRunnable> pre = new LinkedList<>();
- private final List<OMRunnable> post = new LinkedList<>();
-
- public OMRunnable(final Runnable ref) {
- this.runnableRef = ref;
- }
-
- public Runnable getRunnableRef() {
- return this.runnableRef;
- }
-
- public long getInstructionCount() {
- // Is the reference set, or do we have a dummy runnable (runtime 0)?
- if (this.runnableRef == null) {
- return 0;
- }
-
- // Has the number of instructions already been calculated?
- if (this.instructions >= 0) {
- return this.instructions;
- }
-
- // Check if list of RunnableItems is empty
- if (this.runnableRef.getRunnableItems().size() <= 0) {
- UniversalHandler.getInstance().log(
- "Invalid Software Model, Runnable '" + this.runnableRef.getName() + "' contains no RunnableItems.",
- null);
- return 0;
- }
-
- return (this.instructions = parseRunnableItems(this.runnableRef.getRunnableItems()));
- }
-
- private long parseRunnableItems(final EList<RunnableItem> runnableItemsList) {
- // Process all RunnableItems and search for instructions
- final Iterator<RunnableItem> itRunnableItems = runnableItemsList.iterator();
- while (itRunnableItems.hasNext()) {
- final RunnableItem runnableItem = itRunnableItems.next();
-
-// if (runnableItem instanceof ExecutionNeed) {
-// final ExecutionNeed execNeed = (ExecutionNeed) runnableItem;
-// final Need abstractNeed = InstructionsUtil.getNeed(execNeed);
-// if (abstractNeed == null) {
-// UniversalHandler.getInstance().log(" Unexpected SWModel.\nexecution need is not set!\nSkipping...",
-// null);
-// return 0;
-// } else if (abstractNeed instanceof NeedConstant) {
-// return processNeedConstant((NeedConstant) abstractNeed);
-// } else if (abstractNeed instanceof NeedDeviation) {
-// return processNeedDeviation((NeedDeviation) abstractNeed);
-// } else {
-// // Report the others (Debug info), as we do not handle them
-// UniversalHandler.getInstance().logCon("Debug Info: Skipping " + runnableItem.getClass().toString());
-// }
-// }
- }
-
- UniversalHandler.getInstance()
- .log("Invalid Software Model, there has been no execution need specified.", null);
- return 0;
- }
-
-// private long processNeedConstant(final NeedConstant needConstant) {
-// if (needConstant.getValue() <= 0) {
-// UniversalHandler.getInstance()
-// .log("Invalid Software Model, NeedConstant contains an invalid value (<= 0).", null);
-// return 0;
-// }
-//
-// return needConstant.getValue();
-// }
-//
-// private long processNeedDeviation(final NeedDeviation needDeviation) {
-// final Deviation<LongObject> deviation;
-// if ((deviation = needDeviation.getDeviation()) == null) {
-// UniversalHandler.getInstance().log(
-// "Invalid Software Model, NeedDeviation has an invalid or missing containment to its Deviation.",
-// null);
-// return 0;
-// }
-//
-// final Long lowerBound = deviation.getLowerBound().getValue();
-// final Long upperBound = deviation.getUpperBound().getValue();
-//
-// // Check if lower and upper bound are set correct
-// // Quick solution, might need to be rewritten in the future
-// if (lowerBound <= 0 || upperBound <= 0) {
-// UniversalHandler.getInstance().log("Unexpected SWModel.\nDeviation not set properly.\nSkipping...", null);
-// return 0;
-// }
-// return ((lowerBound + upperBound) / 2);
-// }
-
-// public List<OMRunnable> getPre() {
-// return pre;
-// }
-
- /**
- * Get the Runnables that should run after the current one concerning to the ConstraintsModel-RunnableSequencingConstraints.
- * @return
- */
- public List<OMRunnable> getPost() {
- return post;
- }
-
-
-}
+package org.eclipse.app4mc.multicore.execution.logic.openmapping;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.app4mc.amalthea.model.Runnable;
+import org.eclipse.app4mc.amalthea.model.Ticks;
+import org.eclipse.app4mc.amalthea.model.util.SoftwareUtil;
+import org.eclipse.app4mc.multicore.sharelibs.UniversalHandler;
+
+public class OMRunnable {
+ private final Runnable runnableRef;
+ private long instructions = -1;
+
+// private final List<OMRunnable> pre = new LinkedList<>();
+ private final List<OMRunnable> post = new LinkedList<>();
+
+ public OMRunnable(final Runnable ref) {
+ this.runnableRef = ref;
+ }
+
+ public Runnable getRunnableRef() {
+ return this.runnableRef;
+ }
+
+ public long getInstructionCount() {
+ // Is the reference set, or do we have a dummy runnable (runtime 0)?
+ if (this.runnableRef == null) {
+ return 0;
+ }
+
+ // Has the number of instructions already been calculated?
+ if (this.instructions >= 0) {
+ return this.instructions;
+ }
+
+ // Check if list of RunnableItems is empty
+ if (this.runnableRef.getRunnableItems().size() <= 0) {
+ UniversalHandler.getInstance().log(
+ "Invalid Software Model, Runnable '" + this.runnableRef.getName() + "' contains no RunnableItems.",
+ null);
+ return 0;
+ }
+
+ List<Ticks> totalTicks = SoftwareUtil.getTicks(getRunnableRef(), null);
+
+ return (this.instructions = totalTicks.stream().mapToLong(t -> t.getDefault().getUpperBound()).sum());
+ }
+
+// public List<OMRunnable> getPre() {
+// return pre;
+// }
+
+ /**
+ * Get the Runnables that should run after the current one concerning to the ConstraintsModel-RunnableSequencingConstraints.
+ * @return
+ */
+ public List<OMRunnable> getPost() {
+ return post;
+ }
+
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMScheduler.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMScheduler.java
index d9ca1122..3b070689 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMScheduler.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMScheduler.java
@@ -1,43 +1,43 @@
-/**
- ********************************************************************************
- * Copyright (c) 2015, 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- *
+/**
+ ********************************************************************************
+ * Copyright (c) 2015, 2017 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *
******************************************************************************/
-package org.eclipse.app4mc.multicore.execution.logic.openmapping;
-
-import org.eclipse.app4mc.amalthea.model.AmaltheaFactory;
-import org.eclipse.app4mc.amalthea.model.ProcessingUnit;
-import org.eclipse.app4mc.amalthea.model.TaskScheduler;
-
-public class OMScheduler {
- private final TaskScheduler schedulerRef;
-
- public OMScheduler(final TaskScheduler schedulerRef) {
- this.schedulerRef = schedulerRef;
- }
-
- public OMScheduler(final OMCore core) {
- final String coreName = core.getCoreRef().getName();
- this.schedulerRef = AmaltheaFactory.eINSTANCE.createTaskScheduler();
- this.schedulerRef.setName("SCHED_" + coreName);
- }
-
- public OMScheduler(final ProcessingUnit core) {
- final String coreName = core.getName();
- this.schedulerRef = AmaltheaFactory.eINSTANCE.createTaskScheduler();
- this.schedulerRef.setName("SCHED_" + coreName);
- }
-
- public TaskScheduler getSchedulerRef() {
- return this.schedulerRef;
- }
-}
+package org.eclipse.app4mc.multicore.execution.logic.openmapping;
+
+import org.eclipse.app4mc.amalthea.model.AmaltheaFactory;
+import org.eclipse.app4mc.amalthea.model.ProcessingUnit;
+import org.eclipse.app4mc.amalthea.model.TaskScheduler;
+
+public class OMScheduler {
+ private final TaskScheduler schedulerRef;
+
+ public OMScheduler(final TaskScheduler schedulerRef) {
+ this.schedulerRef = schedulerRef;
+ }
+
+ public OMScheduler(final OMCore core) {
+ final String coreName = core.getCoreRef().getName();
+ this.schedulerRef = AmaltheaFactory.eINSTANCE.createTaskScheduler();
+ this.schedulerRef.setName("SCHED_" + coreName);
+ }
+
+ public OMScheduler(final ProcessingUnit core) {
+ final String coreName = core.getName();
+ this.schedulerRef = AmaltheaFactory.eINSTANCE.createTaskScheduler();
+ this.schedulerRef.setName("SCHED_" + coreName);
+ }
+
+ public TaskScheduler getSchedulerRef() {
+ return this.schedulerRef;
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMTask.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMTask.java
index 66322d20..de85f7a6 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMTask.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMTask.java
@@ -1,396 +1,395 @@
-/**
- ********************************************************************************
- * Copyright (c) 2015, 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.app4mc.multicore.execution.logic.openmapping;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import org.eclipse.app4mc.amalthea.model.CallGraph;
-import org.eclipse.app4mc.amalthea.model.CallSequence;
-import org.eclipse.app4mc.amalthea.model.CallSequenceItem;
-import org.eclipse.app4mc.amalthea.model.GraphEntryBase;
-import org.eclipse.app4mc.amalthea.model.PeriodicStimulus;
-import org.eclipse.app4mc.amalthea.model.RelativePeriodicStimulus;
-import org.eclipse.app4mc.amalthea.model.Runnable;
-import org.eclipse.app4mc.amalthea.model.Stimulus;
-import org.eclipse.app4mc.amalthea.model.Task;
-import org.eclipse.app4mc.amalthea.model.TaskRunnableCall;
-import org.eclipse.app4mc.amalthea.model.Time;
-import org.eclipse.app4mc.amalthea.model.ITimeDeviation;
-import org.eclipse.app4mc.amalthea.model.Value;
-import org.eclipse.emf.ecore.EAttribute;
-
-/**
- *
- */
-public class OMTask {
-
- private final Task taskRef;
-
- private OMTask predecessor = null;
-
- private long iInstructionCount = -1;
-
- private final List<OMEdge> post = new LinkedList<>();
-
- private List<OMRunnable> runnableSequence;
-
- private long period = -1;
-
- public OMTask(final Task taskRef) {
- this.taskRef = taskRef;
- }
-
- public OMTask(final Task taskRef, final OMTask predecessor) {
- this.taskRef = taskRef;
- this.predecessor = predecessor;
- }
-
- public Task getTaskRef() {
- return this.taskRef;
- }
-
- public OMTask getPredecessor() {
- return this.predecessor;
- }
-
- /**
- *
- * @return
- */
- public long getInstructionCount() {
- if (0 > this.iInstructionCount) {
- // try to get instructioncount from property
- // first
- getPropertyInstructionCount();
- }
-
- if (0 > this.iInstructionCount) {
- iInstructionCount = 0;
- for (OMRunnable r : getRunnableCallSequence()) {
- iInstructionCount += r.getInstructionCount();
- }
- }
- return this.iInstructionCount;
- }
-
- private boolean getPropertyInstructionCount() {
- Value x = getTaskRef().getCustomProperties().get("instructionCount");
- if (x != null) {
- List<EAttribute> a = x.eClass().getEAttributes();
- if (a.size() > 0) {
- Object o = x.eGet(a.get(0));
- long val = Long.parseLong(o.toString());
- if (val > 0) {
- iInstructionCount = val;
- return true;
- }
- }
-
- }
- return false;
- }
-
- public long getRunnableCount() {
- return getRunnableCallSequence().size();
- }
-
- // public long getRunnableCount() {
- // if (0 > this.iRunnableCount) {
- // fetchRunnableAndInstructionCount();
- // }
- // return this.iRunnableCount;
- // }
- //
- // private void fetchRunnableAndInstructionCount() {
- // // Check if a call graph is present in the task and if it is valid
- // final CallGraph callGraph = this.taskRef.getCallGraph();
- // if (callGraph == null) {
- // UniversalHandler.getInstance().log("Invalid Software Model, Task '" +
- // this.taskRef.getName()
- // + "' has an invalid or missing containment to its CallGraph.", null);
- // return;
- // }
- //
- // if (callGraph.getGraphEntries().size() <= 0) {
- // UniversalHandler.getInstance().log(
- // "Invalid Software Model, The CallGraph of Task '" +
- // this.taskRef.getName() + "' is empty", null);
- // return;
- // }
- //
- // // Runnable counter is increased by the child methods. Since we init it
- // with -1, we have to increase it one time
- // // manually.
- // ++this.iRunnableCount;
- //
- // this.iInstructionCount = processCallGraph(callGraph);
- // }
- //
- // /**
- // *
- // * @param callGraph
- // * @return
- // */
- // private long processCallGraph(final CallGraph callGraph) {
- // // Count the total number of Instructions of the CallGraph
- // long tmpInstr = 0;
- //
- // // Create iterator with call graph entries (Runnables) and process them
- // final Iterator<GraphEntryBase> itGraphEntries =
- // callGraph.getGraphEntries().iterator();
- // while (itGraphEntries.hasNext()) {
- // // Check GraphEntry Specialization and process it accordingly
- // final GraphEntryBase graphEntry = itGraphEntries.next();
- // // CallSequence
- // if (graphEntry instanceof CallSequence) {
- // tmpInstr += processCallSequence((CallSequence) graphEntry);
- // }
- //
- // // LabelSwitch
- // else if (graphEntry instanceof ModeSwitch) {
- // UniversalHandler.getInstance().log(
- // "GraphEntry specialisation LabelSwitch is not supported. Skipping...",
- // null, IStatus.WARNING);
- // }
- //
- // // ProbabilitySwitch
- // else if (graphEntry instanceof ProbabiltitySwitch) {
- // UniversalHandler.getInstance().log(
- // "GraphEntry specialisation ProbabiltitySwitch is not supported.
- // Skipping...", null,
- // IStatus.WARNING);
- // }
- //
- // // Unhandled, default Error
- // else {
- // UniversalHandler.getInstance().log("Unkown GraphEntry specialisation.
- // Skipping...", null);
- // }
- // }
- // return tmpInstr;
- // }
- //
- // /**
- // * Processes the <code>CallSequence</code> and fetches the number of
- // Instructions for each of its
- // * <code>TaskRunnableCalls</code>. Further handled elements may be added
- // in the future.
- // *
- // * @param callSeq
- // * The CallSequence to process
- // * @return Number of Instructions in the CallSequence
- // */
- // private long processCallSequence(final CallSequence callSeq) {
- // // Count the total number of Instructions of the CallSequence
- // long tmpInstr = 0;
- //
- // // Check if CallSequence is empty
- // if (callSeq.getCalls().size() <= 0) {
- // UniversalHandler.getInstance().log("Invalid Software Model, CallSequence
- // must not be empty. Skipping...",
- // null);
- // return tmpInstr;
- // }
- //
- // // Process CallSequence items
- // final Iterator<CallSequenceItem> itCallSeqItems =
- // callSeq.getCalls().iterator();
- // while (itCallSeqItems.hasNext()) {
- // final CallSequenceItem callSeqEntry = itCallSeqItems.next();
- // if (callSeqEntry instanceof TaskRunnableCall) {
- // tmpInstr += processTaskRunnableCall((TaskRunnableCall) callSeqEntry);
- // }
- // else {
- // UniversalHandler.getInstance().logWarn("Unkown CallSequenceItem
- // specialisation. Skipping...");
- // }
- // }
- // return tmpInstr;
- // }
- //
- // /**
- // * Processes the <code>TaskRunnableCall</code> and fetches the number of
- // Instructions for each of its
- // * <code>Runnable</code>s.
- // *
- // * @param taskRunnableCall
- // * The TaskRunnableCall to process
- // * @return Number of Instructions in the TaskRunnableCall
- // */
- // private long processTaskRunnableCall(final TaskRunnableCall
- // taskRunnableCall) {
- // final Runnable runnable = taskRunnableCall.getRunnable();
- // // Check if reference to runnable is set
- // if (runnable == null) {
- // UniversalHandler.getInstance()
- // .log("Invalid Software Model, reference to Runnable must not be empty.
- // Skipping...", null);
- // return 0;
- // }
- //
- // ++this.iRunnableCount;
- // final OMRunnable r = new OMRunnable(runnable);
- // // TODO The Runnables should be stored in some way, maybe even the Graph
- // might be build at this point
- // return r.getInstructionCount();
- // }
-
- @Override
- public String toString() {
- return this.taskRef.getUniqueName();
- }
-
- /**
- * Get the period period of the task activation.
- *
- * @param t
- * @return Period of the task in pico seconds or 0 if the task has no period
- */
- public long getPeriod() {
- if (period < 0) {
- for (Stimulus s : getTaskRef().getStimuli()) {
- if (s instanceof PeriodicStimulus) {
- PeriodicStimulus ps = (PeriodicStimulus) s;
- Time x = ps.getRecurrence();
- if (x == null) {
- period = 0;
- return period;
- }
- long val = x.getValue().longValue();
- if (val == 0 || x.getUnit() == null) {
- period = 0;
- return period;
- }
- switch (x.getUnit()) {
- case PS:
- val *= 1; //
- break;
- case NS:
- val *= 1000; //
- break;
- case US:
- val *= 1000000L; //
- break;
- case MS:
- val *= 1000000000L; //
- break;
- case S:
- val *= 1000000000000L; //
- break;
- default:
- period = 0;
- return period;
- }
- period = val;
- return period;
- }
- // Support fot FMTV
- if(s instanceof RelativePeriodicStimulus) {
- RelativePeriodicStimulus spst = (RelativePeriodicStimulus) s;
- ITimeDeviation dev = spst.getNextOccurrence();
- Time x = dev.getLowerBound();
- if (x == null) {
- period = 0;
- return period;
- }
- long val = x.getValue().longValue();
- if (val == 0 || x.getUnit() == null) {
- period = 0;
- return period;
- }
- switch (x.getUnit()) {
- case PS:
- val *= 1; //
- break;
- case NS:
- val *= 1000; //
- break;
- case US:
- val *= 1000000L; //
- break;
- case MS:
- val *= 1000000000L; //
- break;
- case S:
- val *= 1000000000000L; //
- break;
- default:
- period = 0;
- return period;
- }
- period = val;
- return period;
- }
-
- }
- period = 0;// not periodic
- }
- return period;
- }
-
- public List<OMRunnable> getRunnableCallSequence() {
- if (runnableSequence == null) {
- try {
- runnableSequence = createCallSequenceList().stream().map(OMRunnable::new).collect(Collectors.toList());
- } catch (MalformedModelException e) {
- e.printStackTrace();
- runnableSequence = new LinkedList<>();
-
- }
- }
- return runnableSequence;
- }
-
- private List<Runnable> createCallSequenceList() throws MalformedModelException {
- List<Runnable> list = new LinkedList<>();
-
- Task t = getTaskRef();
- if (t == null) {
- throw new MalformedModelException("No Task defined!");
- }
- CallGraph graph = t.getCallGraph();
- if (graph == null) {
- throw new MalformedModelException("No callgraph at task " + t.getName());
- }
-
- for (GraphEntryBase entry : graph.getGraphEntries()) {
- if (entry instanceof CallSequence) {
- CallSequence seq = (CallSequence) entry;
- for (CallSequenceItem item : seq.getCalls()) {
- if (item instanceof TaskRunnableCall) {
- TaskRunnableCall call = (TaskRunnableCall) item;
- Runnable r = call.getRunnable();
- if (r == null) {
- throw new MalformedModelException("Empty Runnable call at task " + t.getName());
- }
- list.add(r);
- }
- }
- if (list.size() == 0) {
- throw new MalformedModelException("Empty CallSequence at task " + t.getName());
- }
- return list;
- }
- }
- throw new MalformedModelException("No CallSequence defined!");
- }
-
- public List<OMEdge> getPosts() {
- return post;
- }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2015, 2017 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.app4mc.multicore.execution.logic.openmapping;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.eclipse.app4mc.amalthea.model.CallGraph;
+import org.eclipse.app4mc.amalthea.model.Group;//CallSequence;
+import org.eclipse.app4mc.amalthea.model.CallGraphItem;//CallSequenceItem;
+import org.eclipse.app4mc.amalthea.model.ITimeDeviation;
+import org.eclipse.app4mc.amalthea.model.PeriodicStimulus;
+import org.eclipse.app4mc.amalthea.model.RelativePeriodicStimulus;
+import org.eclipse.app4mc.amalthea.model.Runnable;
+import org.eclipse.app4mc.amalthea.model.Stimulus;
+import org.eclipse.app4mc.amalthea.model.Task;
+import org.eclipse.app4mc.amalthea.model.RunnableCall;//TaskRunnableCall;
+import org.eclipse.app4mc.amalthea.model.Time;
+import org.eclipse.app4mc.amalthea.model.Value;
+import org.eclipse.emf.ecore.EAttribute;
+
+/**
+ *
+ */
+public class OMTask {
+
+ private final Task taskRef;
+
+ private OMTask predecessor = null;
+
+ private long iInstructionCount = -1;
+
+ private final List<OMEdge> post = new LinkedList<>();
+
+ private List<OMRunnable> runnableSequence;
+
+ private long period = -1;
+
+ public OMTask(final Task taskRef) {
+ this.taskRef = taskRef;
+ }
+
+ public OMTask(final Task taskRef, final OMTask predecessor) {
+ this.taskRef = taskRef;
+ this.predecessor = predecessor;
+ }
+
+ public Task getTaskRef() {
+ return this.taskRef;
+ }
+
+ public OMTask getPredecessor() {
+ return this.predecessor;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public long getInstructionCount() {
+ if (0 > this.iInstructionCount) {
+ // try to get instructioncount from property
+ // first
+ getPropertyInstructionCount();
+ }
+
+ if (0 > this.iInstructionCount) {
+ iInstructionCount = 0;
+ for (OMRunnable r : getRunnableCallSequence()) {
+ iInstructionCount += r.getInstructionCount();
+ }
+ }
+ return this.iInstructionCount;
+ }
+
+ private boolean getPropertyInstructionCount() {
+ Value x = getTaskRef().getCustomProperties().get("instructionCount");
+ if (x != null) {
+ List<EAttribute> a = x.eClass().getEAttributes();
+ if (a.size() > 0) {
+ Object o = x.eGet(a.get(0));
+ long val = Long.parseLong(o.toString());
+ if (val > 0) {
+ iInstructionCount = val;
+ return true;
+ }
+ }
+
+ }
+ return false;
+ }
+
+ public long getRunnableCount() {
+ return getRunnableCallSequence().size();
+ }
+
+ // public long getRunnableCount() {
+ // if (0 > this.iRunnableCount) {
+ // fetchRunnableAndInstructionCount();
+ // }
+ // return this.iRunnableCount;
+ // }
+ //
+ // private void fetchRunnableAndInstructionCount() {
+ // // Check if a call graph is present in the task and if it is valid
+ // final CallGraph callGraph = this.taskRef.getCallGraph();
+ // if (callGraph == null) {
+ // UniversalHandler.getInstance().log("Invalid Software Model, Task '" +
+ // this.taskRef.getName()
+ // + "' has an invalid or missing containment to its CallGraph.", null);
+ // return;
+ // }
+ //
+ // if (callGraph.getGraphEntries().size() <= 0) {
+ // UniversalHandler.getInstance().log(
+ // "Invalid Software Model, The CallGraph of Task '" +
+ // this.taskRef.getName() + "' is empty", null);
+ // return;
+ // }
+ //
+ // // Runnable counter is increased by the child methods. Since we init it
+ // with -1, we have to increase it one time
+ // // manually.
+ // ++this.iRunnableCount;
+ //
+ // this.iInstructionCount = processCallGraph(callGraph);
+ // }
+ //
+ // /**
+ // *
+ // * @param callGraph
+ // * @return
+ // */
+ // private long processCallGraph(final CallGraph callGraph) {
+ // // Count the total number of Instructions of the CallGraph
+ // long tmpInstr = 0;
+ //
+ // // Create iterator with call graph entries (Runnables) and process them
+ // final Iterator<GraphEntryBase> itGraphEntries =
+ // callGraph.getGraphEntries().iterator();
+ // while (itGraphEntries.hasNext()) {
+ // // Check GraphEntry Specialization and process it accordingly
+ // final GraphEntryBase graphEntry = itGraphEntries.next();
+ // // CallSequence
+ // if (graphEntry instanceof CallSequence) {
+ // tmpInstr += processCallSequence((CallSequence) graphEntry);
+ // }
+ //
+ // // LabelSwitch
+ // else if (graphEntry instanceof ModeSwitch) {
+ // UniversalHandler.getInstance().log(
+ // "GraphEntry specialisation LabelSwitch is not supported. Skipping...",
+ // null, IStatus.WARNING);
+ // }
+ //
+ // // ProbabilitySwitch
+ // else if (graphEntry instanceof ProbabiltitySwitch) {
+ // UniversalHandler.getInstance().log(
+ // "GraphEntry specialisation ProbabiltitySwitch is not supported.
+ // Skipping...", null,
+ // IStatus.WARNING);
+ // }
+ //
+ // // Unhandled, default Error
+ // else {
+ // UniversalHandler.getInstance().log("Unkown GraphEntry specialisation.
+ // Skipping...", null);
+ // }
+ // }
+ // return tmpInstr;
+ // }
+ //
+ // /**
+ // * Processes the <code>CallSequence</code> and fetches the number of
+ // Instructions for each of its
+ // * <code>TaskRunnableCalls</code>. Further handled elements may be added
+ // in the future.
+ // *
+ // * @param callSeq
+ // * The CallSequence to process
+ // * @return Number of Instructions in the CallSequence
+ // */
+ // private long processCallSequence(final CallSequence callSeq) {
+ // // Count the total number of Instructions of the CallSequence
+ // long tmpInstr = 0;
+ //
+ // // Check if CallSequence is empty
+ // if (callSeq.getCalls().size() <= 0) {
+ // UniversalHandler.getInstance().log("Invalid Software Model, CallSequence
+ // must not be empty. Skipping...",
+ // null);
+ // return tmpInstr;
+ // }
+ //
+ // // Process CallSequence items
+ // final Iterator<CallSequenceItem> itCallSeqItems =
+ // callSeq.getCalls().iterator();
+ // while (itCallSeqItems.hasNext()) {
+ // final CallSequenceItem callSeqEntry = itCallSeqItems.next();
+ // if (callSeqEntry instanceof TaskRunnableCall) {
+ // tmpInstr += processTaskRunnableCall((TaskRunnableCall) callSeqEntry);
+ // }
+ // else {
+ // UniversalHandler.getInstance().logWarn("Unkown CallSequenceItem
+ // specialisation. Skipping...");
+ // }
+ // }
+ // return tmpInstr;
+ // }
+ //
+ // /**
+ // * Processes the <code>TaskRunnableCall</code> and fetches the number of
+ // Instructions for each of its
+ // * <code>Runnable</code>s.
+ // *
+ // * @param taskRunnableCall
+ // * The TaskRunnableCall to process
+ // * @return Number of Instructions in the TaskRunnableCall
+ // */
+ // private long processTaskRunnableCall(final TaskRunnableCall
+ // taskRunnableCall) {
+ // final Runnable runnable = taskRunnableCall.getRunnable();
+ // // Check if reference to runnable is set
+ // if (runnable == null) {
+ // UniversalHandler.getInstance()
+ // .log("Invalid Software Model, reference to Runnable must not be empty.
+ // Skipping...", null);
+ // return 0;
+ // }
+ //
+ // ++this.iRunnableCount;
+ // final OMRunnable r = new OMRunnable(runnable);
+ // // TODO The Runnables should be stored in some way, maybe even the Graph
+ // might be build at this point
+ // return r.getInstructionCount();
+ // }
+
+ @Override
+ public String toString() {
+ return this.taskRef.getUniqueName();
+ }
+
+ /**
+ * Get the period period of the task activation.
+ *
+ * @param t
+ * @return Period of the task in pico seconds or 0 if the task has no period
+ */
+ public long getPeriod() {
+ if (period < 0) {
+ for (Stimulus s : getTaskRef().getStimuli()) {
+ if (s instanceof PeriodicStimulus) {
+ PeriodicStimulus ps = (PeriodicStimulus) s;
+ Time x = ps.getRecurrence();
+ if (x == null) {
+ period = 0;
+ return period;
+ }
+ long val = x.getValue().longValue();
+ if (val == 0 || x.getUnit() == null) {
+ period = 0;
+ return period;
+ }
+ switch (x.getUnit()) {
+ case PS:
+ val *= 1; //
+ break;
+ case NS:
+ val *= 1000; //
+ break;
+ case US:
+ val *= 1000000L; //
+ break;
+ case MS:
+ val *= 1000000000L; //
+ break;
+ case S:
+ val *= 1000000000000L; //
+ break;
+ default:
+ period = 0;
+ return period;
+ }
+ period = val;
+ return period;
+ }
+ // Support fot FMTV
+ if(s instanceof RelativePeriodicStimulus) {
+ RelativePeriodicStimulus spst = (RelativePeriodicStimulus) s;
+ ITimeDeviation dev = spst.getNextOccurrence();
+ Time x = dev.getLowerBound();
+ if (x == null) {
+ period = 0;
+ return period;
+ }
+ long val = x.getValue().longValue();
+ if (val == 0 || x.getUnit() == null) {
+ period = 0;
+ return period;
+ }
+ switch (x.getUnit()) {
+ case PS:
+ val *= 1; //
+ break;
+ case NS:
+ val *= 1000; //
+ break;
+ case US:
+ val *= 1000000L; //
+ break;
+ case MS:
+ val *= 1000000000L; //
+ break;
+ case S:
+ val *= 1000000000000L; //
+ break;
+ default:
+ period = 0;
+ return period;
+ }
+ period = val;
+ return period;
+ }
+
+ }
+ period = 0;// not periodic
+ }
+ return period;
+ }
+
+ public List<OMRunnable> getRunnableCallSequence() {
+ if (runnableSequence == null) {
+ try {
+ runnableSequence = createCallSequenceList().stream().map(OMRunnable::new).collect(Collectors.toList());
+ } catch (MalformedModelException e) {
+ e.printStackTrace();
+ runnableSequence = new LinkedList<>();
+
+ }
+ }
+ return runnableSequence;
+ }
+
+ private List<Runnable> createCallSequenceList() throws MalformedModelException {
+ List<Runnable> list = new LinkedList<>();
+
+ Task t = getTaskRef();
+ if (t == null) {
+ throw new MalformedModelException("No Task defined!");
+ }
+ CallGraph graph = t.getCallGraph();
+ if (graph == null) {
+ throw new MalformedModelException("No callgraph at task " + t.getName());
+ }
+
+ for (CallGraphItem entry : graph.getItems()) {
+ if (entry instanceof Group) {
+ Group seq = (Group) entry;
+ for (CallGraphItem item : seq.getItems()) {
+ if (item instanceof RunnableCall) {
+ RunnableCall call = (RunnableCall) item;
+ Runnable r = call.getRunnable();
+ if (r == null) {
+ throw new MalformedModelException("Empty Runnable call at task " + t.getName());
+ }
+ list.add(r);
+ }
+ }
+ if (list.size() == 0) {
+ throw new MalformedModelException("Empty CallSequence at task " + t.getName());
+ }
+ return list;
+ }
+ }
+ throw new MalformedModelException("No CallSequence defined!");
+ }
+
+ public List<OMEdge> getPosts() {
+ return post;
+ }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMUtil.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMUtil.java
index c92086b5..3eb8f801 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMUtil.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/openmapping/OMUtil.java
@@ -1,339 +1,324 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.app4mc.multicore.execution.logic.openmapping;
-
-import java.math.BigInteger;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.DoubleAdder;
-import java.util.stream.Collectors;
-
-import org.eclipse.app4mc.amalthea.model.ConstraintsModel;
-import org.eclipse.app4mc.amalthea.model.MappingModel;
-import org.eclipse.app4mc.amalthea.model.ProcessingUnit;
-import org.eclipse.app4mc.amalthea.model.Runnable;
-import org.eclipse.app4mc.amalthea.model.RunnableSequencingConstraint;
-import org.eclipse.app4mc.amalthea.model.Scheduler;
-import org.eclipse.app4mc.amalthea.model.SchedulerAllocation;
-import org.eclipse.app4mc.amalthea.model.Task;
-import org.eclipse.app4mc.amalthea.model.TaskAllocation;
-
-public class OMUtil {
-
- /**
- * Create OMMapping from an AMALTHEA MappingModel object.
- * @param model
- * @return
- */
- public static OMMapping createOMMapping(final MappingModel model){
- List<TaskAllocation> allocations = model.getTaskAllocation();
- List<SchedulerAllocation> schedAllocs = model.getSchedulerAllocation();
-
- final Map<ProcessingUnit,OMCore> cores = new HashMap<>();
- final Map<Scheduler,ProcessingUnit> schedToCore = new HashMap<>();
-
-
- for(SchedulerAllocation sa:schedAllocs) {
- ProcessingUnit c = sa.getResponsibility().get(0);
- Scheduler s = sa.getScheduler();
- schedToCore.put(s, c);
- }
-
- OMMapping m = new OMMapping();
- for(TaskAllocation ta:allocations){
- Task t = ta.getTask();
- Scheduler s = ta.getScheduler();
- ProcessingUnit c = schedToCore.get(s);
- if(!cores.containsKey(c)){
- cores.put(c, new OMCore(c));
- }
- OMAllocation alloc = new OMAllocation(new OMTask(t), cores.get(c));
- m.addAllocation(alloc);
- }
-
- return m;
- }
-
- /**
- * Creates a graph out of the ConstraintsModel and a list of OMTasks.
- * OMTask has a list of runnables. The contained OMRunnables will get interconnected through its pre and post lists.
- * The OMTask pre and post lists containing OMTasks will get interconnected on the level of tasks as well. Therefore
- * this function checks if an RunnableSequencingConstraint of the ConstraintsModel referencing runnables regarding to different tasks.
- * @param omtask
- * @param cm
- * @throws MalformedModelException
- */
- public static void createOMTaskGraph(final List<OMTask> omtask,final ConstraintsModel cm) throws MalformedModelException{
-// Map<OMTask,List<OMRunnable>> resultMap =new HashMap<>();
-
- Map<String,OMRunnable> runnableMap = new HashMap<>();
- Map<OMRunnable,OMTask> runnableTaskMap = new HashMap<>();
-
- for(OMTask task:omtask){
- List<OMRunnable> omlist = task.getRunnableCallSequence();
-// resultMap.put(task, omlist);
-
- for(OMRunnable r: omlist){
- //to check the task of an runnable
- runnableTaskMap.put(r, task);
- runnableMap.put(r.getRunnableRef().getUniqueName(), r);
- }
- }
-
- // with runnableMap we can now get all runnable instances by its name
- // with runnableTaskMap we can get the corresponding task for a runnable
-
- for(RunnableSequencingConstraint c : cm.getRunnableSequencingConstraints()){
- try{
- Runnable pre = c.getRunnableGroups().get(0).getRunnables().get(0);
- Runnable post = c.getRunnableGroups().get(1).getRunnables().get(0);
-
- OMRunnable ompre= runnableMap.get(pre.getUniqueName());
- OMRunnable ompost= runnableMap.get(post.getUniqueName());
- if(ompre == null){
- throw new MalformedModelException("RunnableSequencingContraint for runnable " +pre.getName() + ", but is not present in tasks!");
- }else if ( ompost == null){
- throw new MalformedModelException("RunnableSequencingContraint for runnable " + post.getName() + ", but is not present in tasks!");
- }
- ompre.getPost().add(ompost);
-// ompost.getPre().add(ompre);
-
- OMTask taskOfPre= runnableTaskMap.get(ompre);
- OMTask taskOfPost = runnableTaskMap.get(ompost);
- if(taskOfPost!=taskOfPre){
- //runnables are in different tasks
- // => add pre post relation on task layer
- long release= getReleaseInstructions(taskOfPre,ompre);
- long waitUntilRelease= getReleaseInstructions(taskOfPost, ompost)-ompost.getInstructionCount();
- OMEdge t = new OMEdge(taskOfPre,taskOfPost, release,waitUntilRelease);
- taskOfPre.getPosts().add(t);
- }
-
- }catch(Exception e){
- throw new MalformedModelException(e.getMessage());
- }
- }
- }
-
-
-
- /**
- * Restructure the privieded OMAllocation to a Java-Map with cores as keys and task-list as values.
- * @param list
- * @return
- */
- public static Map<OMCore,List<OMTask>> getCoreTaskMap(final List<OMAllocation> list){
- Map<OMCore, List<OMTask>> result =
- list.stream().collect(
- Collectors.groupingBy(OMAllocation::getCore,
- Collectors.mapping(OMAllocation::getTask, Collectors.toList())
- )
- );
- return result;
- }
-
-
- /**
- * Get the utilization of the core if the provided task-list runs on it.
- * @param c
- * @param tasks
- * @return utilization (1 is 100% utilization)
- */
- public static double getUtilization(final OMCore c, final List<OMTask> tasks)throws MalformedModelException{
- DoubleAdder d = new DoubleAdder();
- for(OMTask t: tasks){
- if(t.getInstructionCount()<=0){
- throw new MalformedModelException("Task " + t.getTaskRef().getName() + " instruction-count is lesser equal zero!");
- }
- d.add(((double)getProcessingTime(c,t.getInstructionCount()))/t.getPeriod());
- }
- return d.doubleValue();
- }
-
- /**
- * Get the major cycle of the provided task-list. Also known as hyper-period.
- * @param tasks
- * @return
- */
- public static long getMajorCycle(final List<OMTask> tasks){
- return lcm(tasks.parallelStream().map(OMTask::getPeriod).collect(Collectors.toList()));
- }
-
-
- /**
- * Get least common multiple of all passed values.
- * @param values
- * @return
- */
- private static long lcm(List<Long> values){
- assert values !=null;
- assert 1 >= values.size();
- long result = values.get(0);
-
- long[] longArr = new long[values.size()];
- int i=0;
- for(Long v:values){
- longArr[i] = v;
- i++;
- }
-
- lcm(longArr);
-
- return result;
- }
-
- private static long lcm(long a, long b)
- {
- return a * (b / gcd(a, b));
- }
-
- private static long lcm(long[] input)
- {
- long result = input[0];
- for(int i = 1; i < input.length; i++) result = lcm(result, input[i]);
- return result;
- }
-
- private static long gcd(long a, long b)
- {
- while (b > 0)
- {
- long temp = b;
- b = a % b;
- a = temp;
- }
- return a;
- }
-
-
-
- /**
- * Adds the instructions of the runnable call sequence from the provided task up to the last
- * occurrence of the passed runnable.
- * @param taskOfPre
- * @param ompre
- * @return
- */
- private static long getReleaseInstructions(final OMTask taskOfPre, final OMRunnable ompre) {
-
- long overallInstructions=0;
- long releaseInstructions = 0;
- for(OMRunnable r: taskOfPre.getRunnableCallSequence()){
- overallInstructions+=r.getInstructionCount();
- if(r==ompre){
- releaseInstructions=overallInstructions;
- }
- }
- return releaseInstructions;
- }
-
- /**
- * Get the time how long the provided core need to process the passed instruction-count.
- * @param core
- * @param instuctionCount
- * @return time in pico-seconds.
- * @throws MalformedModelException
- */
- public static long getProcessingTime(final OMCore core, final long instuctionCount) throws MalformedModelException{
- final BigInteger ips = BigInteger.valueOf(core.getInstructionsPerSecond());
- // Number of Instructions
- final BigInteger ins = BigInteger.valueOf(instuctionCount);
- // Piko-Seconds per Second
- final BigInteger psps = BigInteger.valueOf(1000L * 1000L * 1000L * 1000L);
- final BigInteger computationTime = psps.multiply(ins).divide(ips);
- return computationTime.longValueExact();
- }
-
-
-
- /**
- * Check if the provided graph is acyclic. Therefore the graph gets topologically sorted. If it can't be
- * sorted its cyclic.
- * @param edges
- * @return
- */
- public static boolean isDAG(final Collection<OMEdge> edges){
- return getTopologicallySoretedTasks(edges)!=null;
- }
-
- /**
- * Create a list of tasks from the provided task-graph by topologically sort it.
- * @param edges
- * @return sorted series of tasks or null if the graph is cyclic and can't be sorted.
- */
- public static List<OMTask> getTopologicallySoretedTasks(final Collection<OMEdge> edges){
-
- List<OMTask> resultList= new LinkedList<>();
- Map<OMTask, Set<OMTask>> predecessorMap = new HashMap<>(); //get all predecessor from successor
-
- for(OMEdge e:edges){
- /*put all task to map at first occurrence*/
- if(!predecessorMap.containsKey(e.getPost())){
- //nachfolger nicht in map
- predecessorMap.put(e.getPost(), new HashSet<>());
- }
- if(!predecessorMap.containsKey(e.getPre())){
- predecessorMap.put(e.getPre(), new HashSet<>());
- }
- /*add predecessor task to predecessor list of successor (post task)*/
- predecessorMap.get(e.getPost()).add(e.getPre());
- }
-
- while(predecessorMap.size()>0){
-
- OMTask curTask=null;
- for(Map.Entry<OMTask, Set<OMTask>>t: predecessorMap.entrySet()){
- if(t.getValue().size()==0){
- curTask = t.getKey();
- break;
- }
- }
- if(curTask==null){
- //all remaining tasks have predecessors => cyclic graph
- return null;
- }else{
- resultList.add(curTask);
- predecessorMap.remove(curTask);
- //remove it as predecessor
- for(Set<OMTask> list:predecessorMap.values()){
- list.remove(curTask);
- }
- }
- }
-
- return resultList;
-
- }
-
- /**
- * Search the corresponding core for the provided task in the mapping.
- * @param mapping
- * @param t
- * @return core where the task runs on or null if not found.
- */
- public static OMCore getCoreForTask(OMMapping mapping, OMTask t){
- for(OMAllocation alloc:mapping.getAllocationList()){
- if(alloc.getTask()==t){
- return alloc.getCore();
- }
- }
- return null;
- }
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.app4mc.multicore.execution.logic.openmapping;
+
+import org.eclipse.app4mc.amalthea.model.Runnable;
+import org.eclipse.app4mc.amalthea.model.*;
+
+import java.math.BigInteger;
+import java.util.*;
+import java.util.concurrent.atomic.DoubleAdder;
+import java.util.stream.Collectors;
+
+public class OMUtil {
+
+ /**
+ * Create OMMapping from an AMALTHEA MappingModel object.
+ * @param model
+ * @return
+ */
+ public static OMMapping createOMMapping(final MappingModel model){
+ List<TaskAllocation> allocations = model.getTaskAllocation();
+ List<SchedulerAllocation> schedAllocs = model.getSchedulerAllocation();
+
+ final Map<ProcessingUnit,OMCore> cores = new HashMap<>();
+ final Map<Scheduler,ProcessingUnit> schedToCore = new HashMap<>();
+
+
+ for(SchedulerAllocation sa:schedAllocs) {
+ ProcessingUnit c = sa.getResponsibility().get(0);
+ Scheduler s = sa.getScheduler();
+ schedToCore.put(s, c);
+ }
+
+ OMMapping m = new OMMapping();
+ for(TaskAllocation ta:allocations){
+ Task t = ta.getTask();
+ Scheduler s = ta.getScheduler();
+ ProcessingUnit c = schedToCore.get(s);
+ if(!cores.containsKey(c)){
+ cores.put(c, new OMCore(c));
+ }
+ OMAllocation alloc = new OMAllocation(new OMTask(t), cores.get(c));
+ m.addAllocation(alloc);
+ }
+
+ return m;
+ }
+
+ /**
+ * Creates a graph out of the ConstraintsModel and a list of OMTasks.
+ * OMTask has a list of runnables. The contained OMRunnables will get interconnected through its pre and post lists.
+ * The OMTask pre and post lists containing OMTasks will get interconnected on the level of tasks as well. Therefore
+ * this function checks if an RunnableSequencingConstraint of the ConstraintsModel referencing runnables regarding to different tasks.
+ * @param omtask
+ * @param cm
+ * @throws MalformedModelException
+ */
+ public static void createOMTaskGraph(final List<OMTask> omtask,final ConstraintsModel cm) throws MalformedModelException{
+// Map<OMTask,List<OMRunnable>> resultMap =new HashMap<>();
+
+ Map<String,OMRunnable> runnableMap = new HashMap<>();
+ Map<OMRunnable,OMTask> runnableTaskMap = new HashMap<>();
+
+ for(OMTask task:omtask){
+ List<OMRunnable> omlist = task.getRunnableCallSequence();
+// resultMap.put(task, omlist);
+
+ for(OMRunnable r: omlist){
+ //to check the task of an runnable
+ runnableTaskMap.put(r, task);
+ runnableMap.put(r.getRunnableRef().getUniqueName(), r);
+ }
+ }
+
+ // with runnableMap we can now get all runnable instances by its name
+ // with runnableTaskMap we can get the corresponding task for a runnable
+
+ for(RunnableSequencingConstraint c : cm.getRunnableSequencingConstraints()){
+ try{
+ Runnable pre = c.getRunnableGroups().get(0).getRunnables().get(0);
+ Runnable post = c.getRunnableGroups().get(1).getRunnables().get(0);
+
+ OMRunnable ompre= runnableMap.get(pre.getUniqueName());
+ OMRunnable ompost= runnableMap.get(post.getUniqueName());
+ if(ompre == null){
+ throw new MalformedModelException("RunnableSequencingContraint for runnable " +pre.getName() + ", but is not present in tasks!");
+ }else if ( ompost == null){
+ throw new MalformedModelException("RunnableSequencingContraint for runnable " + post.getName() + ", but is not present in tasks!");
+ }
+ ompre.getPost().add(ompost);
+// ompost.getPre().add(ompre);
+
+ OMTask taskOfPre= runnableTaskMap.get(ompre);
+ OMTask taskOfPost = runnableTaskMap.get(ompost);
+ if(taskOfPost!=taskOfPre){
+ //runnables are in different tasks
+ // => add pre post relation on task layer
+ long release= getReleaseInstructions(taskOfPre,ompre);
+ long waitUntilRelease= getReleaseInstructions(taskOfPost, ompost)-ompost.getInstructionCount();
+ OMEdge t = new OMEdge(taskOfPre,taskOfPost, release,waitUntilRelease);
+ taskOfPre.getPosts().add(t);
+ }
+
+ }catch(Exception e){
+ throw new MalformedModelException(e.getMessage());
+ }
+ }
+ }
+
+
+
+ /**
+ * Restructure the privieded OMAllocation to a Java-Map with cores as keys and task-list as values.
+ * @param list
+ * @return
+ */
+ public static Map<OMCore,List<OMTask>> getCoreTaskMap(final List<OMAllocation> list){
+ Map<OMCore, List<OMTask>> result =
+ list.stream().collect(
+ Collectors.groupingBy(OMAllocation::getCore,
+ Collectors.mapping(OMAllocation::getTask, Collectors.toList())
+ )
+ );
+ return result;
+ }
+
+
+ /**
+ * Get the utilization of the core if the provided task-list runs on it.
+ * @param c
+ * @param tasks
+ * @return utilization (1 is 100% utilization)
+ */
+ public static double getUtilization(final OMCore c, final List<OMTask> tasks)throws MalformedModelException{
+ DoubleAdder d = new DoubleAdder();
+ for(OMTask t: tasks){
+ if(t.getInstructionCount()<=0){
+ throw new MalformedModelException("Task " + t.getTaskRef().getName() + " instruction-count is lesser equal zero!");
+ }
+ d.add(((double)getProcessingTime(c,t.getInstructionCount()))/t.getPeriod());
+ }
+ return d.doubleValue();
+ }
+
+ /**
+ * Get the major cycle of the provided task-list. Also known as hyper-period.
+ * @param tasks
+ * @return
+ */
+ public static long getMajorCycle(final List<OMTask> tasks){
+ return lcm(tasks.parallelStream().map(OMTask::getPeriod).collect(Collectors.toList()));
+ }
+
+
+ /**
+ * Get least common multiple of all passed values.
+ * @param values
+ * @return
+ */
+ private static long lcm(List<Long> values){
+ assert values !=null;
+ assert 1 >= values.size();
+ long result = values.get(0);
+
+ long[] longArr = new long[values.size()];
+ int i=0;
+ for(Long v:values){
+ longArr[i] = v;
+ i++;
+ }
+
+ lcm(longArr);
+
+ return result;
+ }
+
+ private static long lcm(long a, long b)
+ {
+ return a * (b / gcd(a, b));
+ }
+
+ private static long lcm(long[] input)
+ {
+ long result = input[0];
+ for(int i = 1; i < input.length; i++) result = lcm(result, input[i]);
+ return result;
+ }
+
+ private static long gcd(long a, long b)
+ {
+ while (b > 0)
+ {
+ long temp = b;
+ b = a % b;
+ a = temp;
+ }
+ return a;
+ }
+
+
+
+ /**
+ * Adds the instructions of the runnable call sequence from the provided task up to the last
+ * occurrence of the passed runnable.
+ * @param taskOfPre
+ * @param ompre
+ * @return
+ */
+ private static long getReleaseInstructions(final OMTask taskOfPre, final OMRunnable ompre) {
+
+ long overallInstructions=0;
+ long releaseInstructions = 0;
+ for(OMRunnable r: taskOfPre.getRunnableCallSequence()){
+ overallInstructions+=r.getInstructionCount();
+ if(r==ompre){
+ releaseInstructions=overallInstructions;
+ }
+ }
+ return releaseInstructions;
+ }
+
+ /**
+ * Get the time how long the provided core need to process the passed instruction-count.
+ * @param core
+ * @param instuctionCount
+ * @return time in pico-seconds.
+ * @throws MalformedModelException
+ */
+ public static long getProcessingTime(final OMCore core, final long instuctionCount) throws MalformedModelException{
+ final BigInteger ips = BigInteger.valueOf(core.getFrequencyHz());
+ // Number of Instructions
+ final BigInteger ins = BigInteger.valueOf(instuctionCount);
+ // Piko-Seconds per Second
+ final BigInteger psps = BigInteger.valueOf(1000L * 1000L * 1000L * 1000L);
+ final BigInteger computationTime = psps.multiply(ins).divide(ips);
+ return computationTime.longValueExact();
+ }
+
+ /**
+ * Check if the provided graph is acyclic. Therefore the graph gets topologically sorted. If it can't be
+ * sorted its cyclic.
+ * @param edges
+ * @return
+ */
+ public static boolean isDAG(final Collection<OMEdge> edges){
+ return getTopologicallySoretedTasks(edges)!=null;
+ }
+
+ /**
+ * Create a list of tasks from the provided task-graph by topologically sort it.
+ * @param edges
+ * @return sorted series of tasks or null if the graph is cyclic and can't be sorted.
+ */
+ public static List<OMTask> getTopologicallySoretedTasks(final Collection<OMEdge> edges){
+
+ List<OMTask> resultList= new LinkedList<>();
+ Map<OMTask, Set<OMTask>> predecessorMap = new HashMap<>(); //get all predecessor from successor
+
+ for(OMEdge e:edges){
+ /*put all task to map at first occurrence*/
+ if(!predecessorMap.containsKey(e.getPost())){
+ //nachfolger nicht in map
+ predecessorMap.put(e.getPost(), new HashSet<>());
+ }
+ if(!predecessorMap.containsKey(e.getPre())){
+ predecessorMap.put(e.getPre(), new HashSet<>());
+ }
+ /*add predecessor task to predecessor list of successor (post task)*/
+ predecessorMap.get(e.getPost()).add(e.getPre());
+ }
+
+ while(predecessorMap.size()>0){
+
+ OMTask curTask=null;
+ for(Map.Entry<OMTask, Set<OMTask>>t: predecessorMap.entrySet()){
+ if(t.getValue().size()==0){
+ curTask = t.getKey();
+ break;
+ }
+ }
+ if(curTask==null){
+ //all remaining tasks have predecessors => cyclic graph
+ return null;
+ }else{
+ resultList.add(curTask);
+ predecessorMap.remove(curTask);
+ //remove it as predecessor
+ for(Set<OMTask> list:predecessorMap.values()){
+ list.remove(curTask);
+ }
+ }
+ }
+
+ return resultList;
+
+ }
+
+ /**
+ * Search the corresponding core for the provided task in the mapping.
+ * @param mapping
+ * @param t
+ * @return core where the task runs on or null if not found.
+ */
+ public static OMCore getCoreForTask(OMMapping mapping, OMTask t){
+ for(OMAllocation alloc:mapping.getAllocationList()){
+ if(alloc.getTask()==t){
+ return alloc.getCore();
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/ISystemProxy.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/ISystemProxy.java
index ccdf2263..53b27039 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/ISystemProxy.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/ISystemProxy.java
@@ -1,40 +1,40 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy;
-
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerEventListener;
-
-public interface ISystemProxy {
-
- public static int TIME_SCALE_PS=1;
- public static int TIME_SCALE_NS=1000;
- public static int TIME_SCALE_US=1000*1000;
- public static int TIME_SCALE_MS=1000*1000*1000;
-
- public void compute(long time) throws SimException;
-
- public void addTask(String core, String name, long wcet, long period);
-
- public void addCoreScheduler(String corename);
-
- public void addListener(String coreName, ISchedulerEventListener l);
-
- public void addTaskPrecedence(String preCore,String preTask,String postCore,String postTask) throws SimException;
-
- public void addTaskPrecedence(String preCore, String preTask, long releaseTime, String postCore, String postTask) throws SimException;
-
- public void interruptComputation();
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy;
+
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerEventListener;
+
+public interface ISystemProxy {
+
+ public static int TIME_SCALE_PS=1;
+ public static int TIME_SCALE_NS=1000;
+ public static int TIME_SCALE_US=1000*1000;
+ public static int TIME_SCALE_MS=1000*1000*1000;
+
+ public void compute(long time) throws SimException;
+
+ public void addTask(String core, String name, long wcet, long period);
+
+ public void addCoreScheduler(String corename);
+
+ public void addListener(String coreName, ISchedulerEventListener l);
+
+ public void addTaskPrecedence(String preCore,String preTask,String postCore,String postTask) throws SimException;
+
+ public void addTaskPrecedence(String preCore, String preTask, long releaseTime, String postCore, String postTask) throws SimException;
+
+ public void interruptComputation();
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/SimException.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/SimException.java
index fdae5ec0..3343f813 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/SimException.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/SimException.java
@@ -1,27 +1,27 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy;
-
-public class SimException extends Exception{
- /**
- *
- */
- private static final long serialVersionUID = -7093455050805024916L;
-
- public SimException(String msg){
- super(msg);
- }
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy;
+
+public class SimException extends Exception{
+ /**
+ *
+ */
+ private static final long serialVersionUID = -7093455050805024916L;
+
+ public SimException(String msg){
+ super(msg);
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/SystemProxyFactory.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/SystemProxyFactory.java
index 3df4feb4..9ad3f7d5 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/SystemProxyFactory.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/SystemProxyFactory.java
@@ -1,66 +1,66 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy;
-
-import java.util.function.Supplier;
-
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.ExecutionModel;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.MalformedModelException;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMAllocation;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMMapping;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.multicoresystem.EMMultiCoreSystem;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.multicoresystem.MultiCoreSystem;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.multicoresystem.SimUtil;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerAlgorithm;
-
-public class SystemProxyFactory {
-
-
- public static ISystemProxy createSystemProxy(long timeScale, Supplier<ISchedulerAlgorithm> schedulerAlgoFactory){
- return new MultiCoreSystem(timeScale, schedulerAlgoFactory);
- }
-
-
-
- /**
- * Create system proxy which traces to the provided ExecutionModel. Already added content from the provided ExecutionModel
- * will not be considered. Therefore it's advised to pass an empty model.
- * @param timescale
- * @param schedulerAlgoFactory
- * @param m
- * @return
- */
- public static ISystemProxy createEMSystemProxy(long timescale,Supplier<ISchedulerAlgorithm> schedulerAlgoFactory,ExecutionModel m){
- return new EMMultiCoreSystem(timescale, schedulerAlgoFactory, m);
- }
-
-
- public static ISystemProxy createEMSystemProxyFromOMMapping(long timescale,Supplier<ISchedulerAlgorithm> schedulerAlgoFactory,OMMapping omMapping,ExecutionModel m) throws SimException {
-
-
- SimUtil.validateModelForSimulation(omMapping);
-
- ISystemProxy sim = createEMSystemProxy( timescale,schedulerAlgoFactory,m);
- for(OMAllocation a:omMapping.getAllocationList()){
- try {
- sim.addTask(a.getCore().getCoreRef().getName(),a.getTask().getTaskRef().getName(),a.calculateProcessingTime(),a.getTask().getPeriod());
- } catch (MalformedModelException e) {
- throw new SimException(e.getMessage());
- }
- }
- return sim;
- }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy;
+
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.ExecutionModel;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.MalformedModelException;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMAllocation;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMMapping;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.multicoresystem.EMMultiCoreSystem;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.multicoresystem.MultiCoreSystem;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.multicoresystem.SimUtil;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerAlgorithm;
+
+import java.util.function.Supplier;
+
+public class SystemProxyFactory {
+
+
+ public static ISystemProxy createSystemProxy(long timeScale, Supplier<ISchedulerAlgorithm> schedulerAlgoFactory){
+ return new MultiCoreSystem(timeScale, schedulerAlgoFactory);
+ }
+
+
+
+ /**
+ * Create system proxy which traces to the provided ExecutionModel. Already added content from the provided ExecutionModel
+ * will not be considered. Therefore it's advised to pass an empty model.
+ * @param timescale
+ * @param schedulerAlgoFactory
+ * @param m
+ * @return
+ */
+ public static ISystemProxy createEMSystemProxy(long timescale,Supplier<ISchedulerAlgorithm> schedulerAlgoFactory,ExecutionModel m){
+ return new EMMultiCoreSystem(timescale, schedulerAlgoFactory, m);
+ }
+
+
+ public static ISystemProxy createEMSystemProxyFromOMMapping(long timescale,Supplier<ISchedulerAlgorithm> schedulerAlgoFactory,OMMapping omMapping,ExecutionModel m) throws SimException {
+
+
+ SimUtil.validateModelForSimulation(omMapping);
+
+ ISystemProxy sim = createEMSystemProxy( timescale,schedulerAlgoFactory,m);
+ for(OMAllocation a:omMapping.getAllocationList()){
+ try {
+ sim.addTask(a.getCore().getCoreRef().getName(),a.getTask().getTaskRef().getName(),a.calculateProcessingTime(),a.getTask().getPeriod());
+ } catch (MalformedModelException e) {
+ throw new SimException(e.getMessage());
+ }
+ }
+ return sim;
+ }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/multicoresystem/EMMultiCoreSystem.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/multicoresystem/EMMultiCoreSystem.java
index ac806cb3..47b9b267 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/multicoresystem/EMMultiCoreSystem.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/multicoresystem/EMMultiCoreSystem.java
@@ -1,40 +1,40 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.multicoresystem;
-
-import java.util.function.Supplier;
-
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.ExecutionModel;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerAlgorithm;
-
-public class EMMultiCoreSystem extends MultiCoreSystem{
-
- private final ExecutionModel execModel;
-
- public EMMultiCoreSystem(long timeinc,Supplier<ISchedulerAlgorithm> schedulerSuplier,ExecutionModel m) {
- super(timeinc,schedulerSuplier);
- this.execModel=m;
- }
-
- @Override
- public void addCoreScheduler(String corename) {
- if(!getSchedulers().containsKey(corename)){
- super.addCoreScheduler(corename);
- addListener(corename, new EMTracer(corename, execModel));
- }
- }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.multicoresystem;
+
+import java.util.function.Supplier;
+
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.ExecutionModel;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerAlgorithm;
+
+public class EMMultiCoreSystem extends MultiCoreSystem{
+
+ private final ExecutionModel execModel;
+
+ public EMMultiCoreSystem(long timeinc,Supplier<ISchedulerAlgorithm> schedulerSuplier,ExecutionModel m) {
+ super(timeinc,schedulerSuplier);
+ this.execModel=m;
+ }
+
+ @Override
+ public void addCoreScheduler(String corename) {
+ if(!getSchedulers().containsKey(corename)){
+ super.addCoreScheduler(corename);
+ addListener(corename, new EMTracer(corename, execModel));
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/multicoresystem/EMTracer.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/multicoresystem/EMTracer.java
index 3af5e5fb..2ba75501 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/multicoresystem/EMTracer.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/multicoresystem/EMTracer.java
@@ -1,163 +1,163 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.multicoresystem;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.ExecutionModel;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMCore;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTask;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskEvent;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskHistState;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskState;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskHistState.EMTaskHistStateFactory;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerEventListener;
-
-public class EMTracer implements ISchedulerEventListener {
-
- private ExecutionModel executionModel;
-
- private EMCore emCore;
-
- private Map<String,EMTaskHistState> currentHist = new HashMap<>();
-
- public EMTracer(String coreName,ExecutionModel m) {
- this.executionModel=m;
- this.emCore=new EMCore(coreName);
- m.addCore(emCore);
- }
-
- @Override
- public void onTaskAdded(String taskName) {
- executionModel.addTask(new EMTask(taskName));
- }
-
- @Override
- public void onStartTask(String task, long time) {
- EMTaskHistState leaving = currentHist.get(task);
- if(leaving!=null){
- leaving.setEnd(time);
- executionModel.addTaskHistEntry(task, leaving);
- }
-
- EMTaskHistState currentRunning = EMTaskHistStateFactory.create(EMTaskState.RUNNING, emCore);
- currentRunning.setStart(time);
- currentHist.put(task, currentRunning);
-// executionModel.addTaskHistEntry(task, currentRunning);
- }
-
-
- @Override
- public void onTerminateTask(String task, long time) {
- EMTaskHistState leavingRunning= currentHist.get(task);
- if(leavingRunning!=null){
- leavingRunning.setEnd(time);
- executionModel.addTaskHistEntry(task, leavingRunning);
- }
-
-
- EMTaskHistState suspendedTask = EMTaskHistStateFactory.create(EMTaskState.SUSPENDED, emCore);
- suspendedTask.setStart(time);
- suspendedTask.setEvent(EMTaskEvent.TERMINATE);
- currentHist.put(task, suspendedTask);
- }
-
- @Override
- public void onPreemptTask(String task, long time) {
- EMTaskHistState leavingRunning= currentHist.get(task);
- if(leavingRunning!=null){
- leavingRunning.setEnd(time);
- executionModel.addTaskHistEntry(task, leavingRunning);
- }
-
- EMTaskHistState readyTask=EMTaskHistStateFactory.create(EMTaskState.READY, emCore);
- readyTask.setStart(time);
- readyTask.setEvent(EMTaskEvent.PREEMPT);
- currentHist.put(task, readyTask);
- }
-
- @Override
- public void onStartIdleCore(long time) {
- }
-
- @Override
- public void onStopIdleCore(long time) {
- }
-
- @Override
- public void onActivateTask(String task, long time) {
- EMTaskHistState leavingSuspend=currentHist.get(task);
- if(leavingSuspend!=null){
- leavingSuspend.setEnd(time);
- executionModel.addTaskHistEntry(task, leavingSuspend);
- }
-
- EMTaskHistState readyTask=EMTaskHistStateFactory.create(EMTaskState.READY, emCore);
- readyTask.setStart(time);
- readyTask.setEvent(EMTaskEvent.ACTIVATE);
- currentHist.put(task, readyTask);
- }
-
- @Override
- public void onWaitTask(String task, long time, String muxName, String holder) {
- EMTaskHistState leavingRunning= currentHist.get(task);
- if(leavingRunning!=null){
- leavingRunning.setEnd(time);
- executionModel.addTaskHistEntry(task, leavingRunning);
- }
-
- EMTaskHistState waitingTask= EMTaskHistStateFactory.create(EMTaskState.WAITING,emCore);
- waitingTask.setStart(time);
- waitingTask.setEventCause(muxName);
- waitingTask.setNote(holder);
- currentHist.put(task, waitingTask);
- }
-
- @Override
- public void onReleaseTask(String task, long time) {
- EMTaskHistState leavingWaiting=currentHist.get(task);
- if(leavingWaiting!=null){
- leavingWaiting.setEnd(time);
- executionModel.addTaskHistEntry(task, leavingWaiting);
- }
-
- EMTaskHistState readyTask=EMTaskHistStateFactory.create(EMTaskState.READY, emCore);
- readyTask.setStart(time);
- readyTask.setEvent(EMTaskEvent.RELEASE);
- currentHist.put(task, readyTask);
- }
-
- @Override
- public void onTaskMissedDeadline(String task, long time, long remainingExectime) {
- EMTaskHistState before= currentHist.get(task);
- if(before!=null){
- before.setEnd(time);
- executionModel.addTaskHistEntry(task, before);
- currentHist.remove(task); //next will be activation
- }
- executionModel.addTaskDeadlineMissedEntry(task, emCore.getName(), time);
- }
-
- @Override
- public String getCoreName() {
- return emCore.getName();
- }
-
-
-
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.multicoresystem;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.ExecutionModel;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMCore;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTask;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskEvent;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskHistState;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskState;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskHistState.EMTaskHistStateFactory;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerEventListener;
+
+public class EMTracer implements ISchedulerEventListener {
+
+ private ExecutionModel executionModel;
+
+ private EMCore emCore;
+
+ private Map<String,EMTaskHistState> currentHist = new HashMap<>();
+
+ public EMTracer(String coreName,ExecutionModel m) {
+ this.executionModel=m;
+ this.emCore=new EMCore(coreName);
+ m.addCore(emCore);
+ }
+
+ @Override
+ public void onTaskAdded(String taskName) {
+ executionModel.addTask(new EMTask(taskName));
+ }
+
+ @Override
+ public void onStartTask(String task, long time) {
+ EMTaskHistState leaving = currentHist.get(task);
+ if(leaving!=null){
+ leaving.setEnd(time);
+ executionModel.addTaskHistEntry(task, leaving);
+ }
+
+ EMTaskHistState currentRunning = EMTaskHistStateFactory.create(EMTaskState.RUNNING, emCore);
+ currentRunning.setStart(time);
+ currentHist.put(task, currentRunning);
+// executionModel.addTaskHistEntry(task, currentRunning);
+ }
+
+
+ @Override
+ public void onTerminateTask(String task, long time) {
+ EMTaskHistState leavingRunning= currentHist.get(task);
+ if(leavingRunning!=null){
+ leavingRunning.setEnd(time);
+ executionModel.addTaskHistEntry(task, leavingRunning);
+ }
+
+
+ EMTaskHistState suspendedTask = EMTaskHistStateFactory.create(EMTaskState.SUSPENDED, emCore);
+ suspendedTask.setStart(time);
+ suspendedTask.setEvent(EMTaskEvent.TERMINATE);
+ currentHist.put(task, suspendedTask);
+ }
+
+ @Override
+ public void onPreemptTask(String task, long time) {
+ EMTaskHistState leavingRunning= currentHist.get(task);
+ if(leavingRunning!=null){
+ leavingRunning.setEnd(time);
+ executionModel.addTaskHistEntry(task, leavingRunning);
+ }
+
+ EMTaskHistState readyTask=EMTaskHistStateFactory.create(EMTaskState.READY, emCore);
+ readyTask.setStart(time);
+ readyTask.setEvent(EMTaskEvent.PREEMPT);
+ currentHist.put(task, readyTask);
+ }
+
+ @Override
+ public void onStartIdleCore(long time) {
+ }
+
+ @Override
+ public void onStopIdleCore(long time) {
+ }
+
+ @Override
+ public void onActivateTask(String task, long time) {
+ EMTaskHistState leavingSuspend=currentHist.get(task);
+ if(leavingSuspend!=null){
+ leavingSuspend.setEnd(time);
+ executionModel.addTaskHistEntry(task, leavingSuspend);
+ }
+
+ EMTaskHistState readyTask=EMTaskHistStateFactory.create(EMTaskState.READY, emCore);
+ readyTask.setStart(time);
+ readyTask.setEvent(EMTaskEvent.ACTIVATE);
+ currentHist.put(task, readyTask);
+ }
+
+ @Override
+ public void onWaitTask(String task, long time, String muxName, String holder) {
+ EMTaskHistState leavingRunning= currentHist.get(task);
+ if(leavingRunning!=null){
+ leavingRunning.setEnd(time);
+ executionModel.addTaskHistEntry(task, leavingRunning);
+ }
+
+ EMTaskHistState waitingTask= EMTaskHistStateFactory.create(EMTaskState.WAITING,emCore);
+ waitingTask.setStart(time);
+ waitingTask.setEventCause(muxName);
+ waitingTask.setNote(holder);
+ currentHist.put(task, waitingTask);
+ }
+
+ @Override
+ public void onReleaseTask(String task, long time) {
+ EMTaskHistState leavingWaiting=currentHist.get(task);
+ if(leavingWaiting!=null){
+ leavingWaiting.setEnd(time);
+ executionModel.addTaskHistEntry(task, leavingWaiting);
+ }
+
+ EMTaskHistState readyTask=EMTaskHistStateFactory.create(EMTaskState.READY, emCore);
+ readyTask.setStart(time);
+ readyTask.setEvent(EMTaskEvent.RELEASE);
+ currentHist.put(task, readyTask);
+ }
+
+ @Override
+ public void onTaskMissedDeadline(String task, long time, long remainingExectime) {
+ EMTaskHistState before= currentHist.get(task);
+ if(before!=null){
+ before.setEnd(time);
+ executionModel.addTaskHistEntry(task, before);
+ currentHist.remove(task); //next will be activation
+ }
+ executionModel.addTaskDeadlineMissedEntry(task, emCore.getName(), time);
+ }
+
+ @Override
+ public String getCoreName() {
+ return emCore.getName();
+ }
+
+
+
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/multicoresystem/MultiCoreSystem.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/multicoresystem/MultiCoreSystem.java
index 67be462e..de3adad8 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/multicoresystem/MultiCoreSystem.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/multicoresystem/MultiCoreSystem.java
@@ -1,290 +1,290 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.multicoresystem;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.function.Supplier;
-
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.ISystemProxy;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.SimException;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerAlgorithm;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerEventListener;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerTask;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.IStepScheduler;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core.Barrier;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core.StepScheduler;
-
-public class MultiCoreSystem implements ISystemProxy{
-
- private boolean run = false;
-
- /** Factory to create instances of scheduler algorithms */
- private final Supplier<ISchedulerAlgorithm> schedulerAlgoFactory;
-
- /** One scheduler for each core */
- private Map<String, IStepScheduler> schedulers = new HashMap<>();
-
- private final long timeScale;
-
- /**
- * Indicates if synchronization through multiple cores is setup. Depending
- * on this {@link #compute(long time)}uses different scheduling computation.
- */
- private boolean interCoreSynch=false;
-
- private boolean interrupted=false;
-
-// private int computationPercent=0;
-
- public MultiCoreSystem(long timeScale, Supplier<ISchedulerAlgorithm> schedulerFactory) {
- this.timeScale = timeScale;
- this.schedulerAlgoFactory = schedulerFactory;
- }
-
- /**
- * Compute the simulation. This is only permitted once for every instance.
- * Time is passed in pico-seconds. Time is scaled by
- * <code>timeScale</code> (rounding up) provided at creation.
- *
- * @param time Time to scedule until
- * @throws SimException If already run.
- */
- public void compute(long time) throws SimException {
- if (!run) {
- run = true;
- time = SimUtil.scaleRoundUp(time, timeScale);
-
- getSchedulers().values().forEach(IStepScheduler::init);
-
- if (interCoreSynch) {
- simulateSynchronous(time);
- } else {
- simulateAsynchronous(time);
- }
- } else {
- throw new SimException("Cant run sim more than once!");
- }
- }
-
-
-
- public void interruptComputation(){
- interrupted = true;
- }
-
- /**
- * Compute the scheduling for each core-scheduler. As long there is no inter-core-synchronization
- * run absolute independently. Therefore this mehtod parallelize the computation with up to 10 threads.
- * @param simulationTime
- * @throws SimException
- */
- private void simulateAsynchronous(final long simulationTime) throws SimException{
- int num = getSchedulers().size();
-
-// final int eachSchedulerPercentage= 100/num;
-
- List<Callable<Boolean>> cl=new LinkedList<>();
- for (final Map.Entry<String, IStepScheduler> entry : getSchedulers().entrySet()) {
- cl.add(new Callable<Boolean>() {
- @Override
- public Boolean call() throws Exception {
- long timecount = 0;
- while (timecount <= simulationTime) {
- entry.getValue().runTaskOrIdleStep();
- entry.getValue().updateTaskSynchronisation();
- entry.getValue().updateTaskSet();
-
- if(interrupted){
- return false;
- }
- timecount= Math.addExact(timecount, 1);
- }
- return true;
- }
- });
- }
- ExecutorService taskExecutor = Executors.newFixedThreadPool(num>10?10:num);
- try {
- List<Future<Boolean>> results=taskExecutor.invokeAll(cl);
- //invokeAll: Blocks until all callables have finished execution or throw exception
- taskExecutor= null;
- for(Future<Boolean> result:results){
- if(!result.get()){
- throw new SimException("Interrupted scheduling!");
- }
- }
- } catch (InterruptedException e) {
- e.printStackTrace();
- throw new SimException(e.getMessage());
- } catch (ExecutionException e) {
- e.printStackTrace();
- //an error occurred while execution (e.g. scheduler Exception from scheduleUntil)
- throw new SimException(e.getMessage());
- }
-
-// Java 8 via streams...
-// try{
-// getSchedulers().entrySet().parallelStream().forEach(
-// x->{
-// try {
-// x.getValue().runTaskOrIdleStep();
-// x.getValue().updateTaskSynchronisation();
-// x.getValue().updateTaskSet();
-// if (Thread.currentThread().isInterrupted()) {
-// return;
-// }
-// } catch (SchedulerException e) {
-// throw new RuntimeException("Scheduling at core: " + x.getKey() + e.getMessage());
-// }
-// }
-// );
-// }catch(RuntimeException e){
-// throw new SimException(e.getMessage());
-// }
- }
-
- /**
- * This method provides step by step computation of the scheduling.
- * This is necessary if there is inter-core-synchronization.
- * @param simulationTime
- * @throws SimException
- */
- private void simulateSynchronous(final long simulationTime) throws SimException {
- long timecount = 0;
- while (timecount <= simulationTime) {
- getSchedulers().values().forEach(IStepScheduler::runTaskOrIdleStep);
- getSchedulers().values().forEach(IStepScheduler::updateTaskSynchronisation);
- getSchedulers().values().forEach(IStepScheduler::updateTaskSet);
-
- if(interrupted){
- throw new SimException("Interrupted scheduling!");
- }
- try{
- timecount= Math.addExact(timecount, 1);
- }catch(ArithmeticException e){
- throw new SimException(e.getMessage());
- }
-
- }
-
- }
-
-
- protected Map<String, IStepScheduler> getSchedulers() {
- return schedulers;
- }
-
-
-
- /**
- * Add a core to the simulation. Every core has a scheduler which will be
- * created from the scheduler factory passed at creation.
- *
- * @param corename
- */
- public void addCoreScheduler(String corename) {
- if (!getSchedulers().containsKey(corename)) {
- StepScheduler s = new StepScheduler(schedulerAlgoFactory.get());
- getSchedulers().put(corename, s);
- }
- }
-
- /**
- * Add a SchedulerEventListener to a core.
- * Each core has a independent scheduler.
- * @param coreName Name of the core.
- * @param l Listener-instance.
- */
- public void addListener(String coreName, ISchedulerEventListener l) {
- getSchedulers().get(coreName).addSchedulerEventListener(l);
- }
-
- /**
- * Add task to simulation. If provided core does not exist it will be created.
- * @param core
- * @param name
- * @param wcet
- * @param period
- */
- public void addTask(String core, String name, long wcet, long period) {
- IStepScheduler s = getSchedulers().get(core);
- if (s == null) {
- addCoreScheduler(core);
- s = getSchedulers().get(core);
- }
- wcet = SimUtil.scaleRoundUp(wcet, timeScale);
- period = SimUtil.scaleRoundUp(period, timeScale);
-
- s.addTask(name, wcet, period);
- }
-
- public void addTaskPrecedence(String preCore,String preTask,String postCore,String postTask) throws SimException{
- addTaskPrecedence(preCore, preTask, ISchedulerTask.BARRIER_UNLOCK_AT_SUSPENSION, postCore,postTask);
- }
-
- public void addTaskPrecedence(String preCore, String preTask, long releaseTime, String postCore, String postTask) throws SimException{
-
- if(preTask.equals(postTask)){
- throw new SimException("Precedence on Task " + preTask + ": Self-Transition is not possible!");
- }
-
- IStepScheduler preCoreScheduler = getSchedulers().get(preCore);
- IStepScheduler postCoreScheduler = getSchedulers().get(postCore);
-
- if(preCoreScheduler==null){
- throw new SimException("No scheduler available for core: "+ preCore);
- }else if(postCoreScheduler==null){
- throw new SimException("No scheduler available for core: "+ postCore);
- }
-
- ISchedulerTask pre =preCoreScheduler.getTask(preTask);
- ISchedulerTask post = postCoreScheduler.getTask(postTask);
-
- if(pre==null){
- throw new SimException("Task "+preTask + " not available!");
- }else if(post==null){
- throw new SimException("Task "+postTask + " not available!");
- }
-
- if(pre.getPeriod()!=post.getPeriod()){
- throw new SimException("Task " + preTask +" and "+postTask+" do not have an equivalent period! Only equal periods are permitted for task precedence!");
- }
-
- Barrier m = new Barrier();
- m.setName("bar_task_precedence_"+preTask+"->"+postTask);
-
- if(releaseTime!=ISchedulerTask.BARRIER_UNLOCK_AT_SUSPENSION){
- releaseTime = SimUtil.scaleRoundUp(releaseTime,timeScale);
- }
-
- pre.addOwnedBarrier(m,releaseTime);
- post.addDependentBarrier(m);
-
-
- if(!preCore.equals(postCore)){
- interCoreSynch=true;
- }
- }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.multicoresystem;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.function.Supplier;
+
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.ISystemProxy;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.SimException;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerAlgorithm;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerEventListener;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerTask;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.IStepScheduler;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core.Barrier;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core.StepScheduler;
+
+public class MultiCoreSystem implements ISystemProxy{
+
+ private boolean run = false;
+
+ /** Factory to create instances of scheduler algorithms */
+ private final Supplier<ISchedulerAlgorithm> schedulerAlgoFactory;
+
+ /** One scheduler for each core */
+ private Map<String, IStepScheduler> schedulers = new HashMap<>();
+
+ private final long timeScale;
+
+ /**
+ * Indicates if synchronization through multiple cores is setup. Depending
+ * on this {@link #compute(long time)}uses different scheduling computation.
+ */
+ private boolean interCoreSynch=false;
+
+ private boolean interrupted=false;
+
+// private int computationPercent=0;
+
+ public MultiCoreSystem(long timeScale, Supplier<ISchedulerAlgorithm> schedulerFactory) {
+ this.timeScale = timeScale;
+ this.schedulerAlgoFactory = schedulerFactory;
+ }
+
+ /**
+ * Compute the simulation. This is only permitted once for every instance.
+ * Time is passed in pico-seconds. Time is scaled by
+ * <code>timeScale</code> (rounding up) provided at creation.
+ *
+ * @param time Time to scedule until
+ * @throws SimException If already run.
+ */
+ public void compute(long time) throws SimException {
+ if (!run) {
+ run = true;
+ time = SimUtil.scaleRoundUp(time, timeScale);
+
+ getSchedulers().values().forEach(IStepScheduler::init);
+
+ if (interCoreSynch) {
+ simulateSynchronous(time);
+ } else {
+ simulateAsynchronous(time);
+ }
+ } else {
+ throw new SimException("Cant run sim more than once!");
+ }
+ }
+
+
+
+ public void interruptComputation(){
+ interrupted = true;
+ }
+
+ /**
+ * Compute the scheduling for each core-scheduler. As long there is no inter-core-synchronization
+ * run absolute independently. Therefore this mehtod parallelize the computation with up to 10 threads.
+ * @param simulationTime
+ * @throws SimException
+ */
+ private void simulateAsynchronous(final long simulationTime) throws SimException{
+ int num = getSchedulers().size();
+
+// final int eachSchedulerPercentage= 100/num;
+
+ List<Callable<Boolean>> cl=new LinkedList<>();
+ for (final Map.Entry<String, IStepScheduler> entry : getSchedulers().entrySet()) {
+ cl.add(new Callable<Boolean>() {
+ @Override
+ public Boolean call() throws Exception {
+ long timecount = 0;
+ while (timecount <= simulationTime) {
+ entry.getValue().runTaskOrIdleStep();
+ entry.getValue().updateTaskSynchronisation();
+ entry.getValue().updateTaskSet();
+
+ if(interrupted){
+ return false;
+ }
+ timecount= Math.addExact(timecount, 1);
+ }
+ return true;
+ }
+ });
+ }
+ ExecutorService taskExecutor = Executors.newFixedThreadPool(num>10?10:num);
+ try {
+ List<Future<Boolean>> results=taskExecutor.invokeAll(cl);
+ //invokeAll: Blocks until all callables have finished execution or throw exception
+ taskExecutor= null;
+ for(Future<Boolean> result:results){
+ if(!result.get()){
+ throw new SimException("Interrupted scheduling!");
+ }
+ }
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ throw new SimException(e.getMessage());
+ } catch (ExecutionException e) {
+ e.printStackTrace();
+ //an error occurred while execution (e.g. scheduler Exception from scheduleUntil)
+ throw new SimException(e.getMessage());
+ }
+
+// Java 8 via streams...
+// try{
+// getSchedulers().entrySet().parallelStream().forEach(
+// x->{
+// try {
+// x.getValue().runTaskOrIdleStep();
+// x.getValue().updateTaskSynchronisation();
+// x.getValue().updateTaskSet();
+// if (Thread.currentThread().isInterrupted()) {
+// return;
+// }
+// } catch (SchedulerException e) {
+// throw new RuntimeException("Scheduling at core: " + x.getKey() + e.getMessage());
+// }
+// }
+// );
+// }catch(RuntimeException e){
+// throw new SimException(e.getMessage());
+// }
+ }
+
+ /**
+ * This method provides step by step computation of the scheduling.
+ * This is necessary if there is inter-core-synchronization.
+ * @param simulationTime
+ * @throws SimException
+ */
+ private void simulateSynchronous(final long simulationTime) throws SimException {
+ long timecount = 0;
+ while (timecount <= simulationTime) {
+ getSchedulers().values().forEach(IStepScheduler::runTaskOrIdleStep);
+ getSchedulers().values().forEach(IStepScheduler::updateTaskSynchronisation);
+ getSchedulers().values().forEach(IStepScheduler::updateTaskSet);
+
+ if(interrupted){
+ throw new SimException("Interrupted scheduling!");
+ }
+ try{
+ timecount= Math.addExact(timecount, 1);
+ }catch(ArithmeticException e){
+ throw new SimException(e.getMessage());
+ }
+
+ }
+
+ }
+
+
+ protected Map<String, IStepScheduler> getSchedulers() {
+ return schedulers;
+ }
+
+
+
+ /**
+ * Add a core to the simulation. Every core has a scheduler which will be
+ * created from the scheduler factory passed at creation.
+ *
+ * @param corename
+ */
+ public void addCoreScheduler(String corename) {
+ if (!getSchedulers().containsKey(corename)) {
+ StepScheduler s = new StepScheduler(schedulerAlgoFactory.get());
+ getSchedulers().put(corename, s);
+ }
+ }
+
+ /**
+ * Add a SchedulerEventListener to a core.
+ * Each core has a independent scheduler.
+ * @param coreName Name of the core.
+ * @param l Listener-instance.
+ */
+ public void addListener(String coreName, ISchedulerEventListener l) {
+ getSchedulers().get(coreName).addSchedulerEventListener(l);
+ }
+
+ /**
+ * Add task to simulation. If provided core does not exist it will be created.
+ * @param core
+ * @param name
+ * @param wcet
+ * @param period
+ */
+ public void addTask(String core, String name, long wcet, long period) {
+ IStepScheduler s = getSchedulers().get(core);
+ if (s == null) {
+ addCoreScheduler(core);
+ s = getSchedulers().get(core);
+ }
+ wcet = SimUtil.scaleRoundUp(wcet, timeScale);
+ period = SimUtil.scaleRoundUp(period, timeScale);
+
+ s.addTask(name, wcet, period);
+ }
+
+ public void addTaskPrecedence(String preCore,String preTask,String postCore,String postTask) throws SimException{
+ addTaskPrecedence(preCore, preTask, ISchedulerTask.BARRIER_UNLOCK_AT_SUSPENSION, postCore,postTask);
+ }
+
+ public void addTaskPrecedence(String preCore, String preTask, long releaseTime, String postCore, String postTask) throws SimException{
+
+ if(preTask.equals(postTask)){
+ throw new SimException("Precedence on Task " + preTask + ": Self-Transition is not possible!");
+ }
+
+ IStepScheduler preCoreScheduler = getSchedulers().get(preCore);
+ IStepScheduler postCoreScheduler = getSchedulers().get(postCore);
+
+ if(preCoreScheduler==null){
+ throw new SimException("No scheduler available for core: "+ preCore);
+ }else if(postCoreScheduler==null){
+ throw new SimException("No scheduler available for core: "+ postCore);
+ }
+
+ ISchedulerTask pre =preCoreScheduler.getTask(preTask);
+ ISchedulerTask post = postCoreScheduler.getTask(postTask);
+
+ if(pre==null){
+ throw new SimException("Task "+preTask + " not available!");
+ }else if(post==null){
+ throw new SimException("Task "+postTask + " not available!");
+ }
+
+ if(pre.getPeriod()!=post.getPeriod()){
+ throw new SimException("Task " + preTask +" and "+postTask+" do not have an equivalent period! Only equal periods are permitted for task precedence!");
+ }
+
+ Barrier m = new Barrier();
+ m.setName("bar_task_precedence_"+preTask+"->"+postTask);
+
+ if(releaseTime!=ISchedulerTask.BARRIER_UNLOCK_AT_SUSPENSION){
+ releaseTime = SimUtil.scaleRoundUp(releaseTime,timeScale);
+ }
+
+ pre.addOwnedBarrier(m,releaseTime);
+ post.addDependentBarrier(m);
+
+
+ if(!preCore.equals(postCore)){
+ interCoreSynch=true;
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/multicoresystem/SimUtil.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/multicoresystem/SimUtil.java
index 574821d7..307976ea 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/multicoresystem/SimUtil.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/multicoresystem/SimUtil.java
@@ -1,92 +1,92 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.multicoresystem;
-
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.MalformedModelException;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMAllocation;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMCore;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMMapping;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMTask;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMUtil;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.SimException;
-
-public class SimUtil {
-
- public static void validateModelForSimulation(OMMapping mapping) throws SimException {
- validateOnlyPeriodicTasks(mapping);
- try {
- validateUtilizationPerCore(mapping);
- } catch (MalformedModelException e) {
- throw new SimException(e.getMessage());
- }
- }
-
- public static void validateOnlyPeriodicTasks(OMMapping model) throws SimException{
- for(OMAllocation alloc:model.getAllocationList()){
- long p =alloc.getTask().getPeriod();
- if(p==0){
- throw new SimException("Non-periodic or unset period at task: " + alloc.getTask().getTaskRef().getName());
- }
- }
- }
-
- /**
- * Check if every core has a utilization less 100%.
- * @param model
- * @return
- * @throws SimException
- * @throws MalformedModelException
- */
- public static void validateUtilizationPerCore(OMMapping model) throws SimException, MalformedModelException{
- Map<OMCore,List<OMTask>> tasksPerCore = OMUtil.getCoreTaskMap(model.getAllocationList());
- validateUtilizationPerCore(tasksPerCore);
- }
-
- /**
- * Check if every core has a utilization less 100%.
- * @param model
- * @return
- * @throws MalformedModelException
- */
- public static void validateUtilizationPerCore(Map<OMCore,List<OMTask>> model)throws SimException, MalformedModelException{
- for(OMCore c: model.keySet()){
- double utila =OMUtil.getUtilization(c, model.get(c));
- if(utila>1){
-// "Mapping for simulation has at least one core with an utilization greater 1!"
- throw new SimException("Core " + c.getCoreRef().getName() + " has a utilization greater 1 ( " + utila+").");
- }
- }
- }
-
- /**
- * Scale the passed positive value with roundup.
- * Example:
- * <ul>
- * <li> val = 141; scale = 10 => 15</li>
- * <li> val = 2611; scale = 1000 => 3</li>
- * </ul>
- * @param val Value to scale down (rounding up).
- * @param scale Divisor for scale down.
- * @return Scaled down value (rounded up).
- */
- public static long scaleRoundUp(long val, long scale){
- return val/scale + ((val%scale)!=0?1:0);
- }
-}
-
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.multicoresystem;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.MalformedModelException;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMAllocation;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMCore;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMMapping;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMTask;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMUtil;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.SimException;
+
+public class SimUtil {
+
+ public static void validateModelForSimulation(OMMapping mapping) throws SimException {
+ validateOnlyPeriodicTasks(mapping);
+ try {
+ validateUtilizationPerCore(mapping);
+ } catch (MalformedModelException e) {
+ throw new SimException(e.getMessage());
+ }
+ }
+
+ public static void validateOnlyPeriodicTasks(OMMapping model) throws SimException{
+ for(OMAllocation alloc:model.getAllocationList()){
+ long p =alloc.getTask().getPeriod();
+ if(p==0){
+ throw new SimException("Non-periodic or unset period at task: " + alloc.getTask().getTaskRef().getName());
+ }
+ }
+ }
+
+ /**
+ * Check if every core has a utilization less 100%.
+ * @param model
+ * @return
+ * @throws SimException
+ * @throws MalformedModelException
+ */
+ public static void validateUtilizationPerCore(OMMapping model) throws SimException, MalformedModelException{
+ Map<OMCore,List<OMTask>> tasksPerCore = OMUtil.getCoreTaskMap(model.getAllocationList());
+ validateUtilizationPerCore(tasksPerCore);
+ }
+
+ /**
+ * Check if every core has a utilization less 100%.
+ * @param model
+ * @return
+ * @throws MalformedModelException
+ */
+ public static void validateUtilizationPerCore(Map<OMCore,List<OMTask>> model)throws SimException, MalformedModelException{
+ for(OMCore c: model.keySet()){
+ double utila =OMUtil.getUtilization(c, model.get(c));
+ if(utila>1){
+// "Mapping for simulation has at least one core with an utilization greater 1!"
+ throw new SimException("Core " + c.getCoreRef().getName() + " has a utilization greater 1 ( " + utila+").");
+ }
+ }
+ }
+
+ /**
+ * Scale the passed positive value with roundup.
+ * Example:
+ * <ul>
+ * <li> val = 141; scale = 10 => 15</li>
+ * <li> val = 2611; scale = 1000 => 3</li>
+ * </ul>
+ * @param val Value to scale down (rounding up).
+ * @param scale Divisor for scale down.
+ * @return Scaled down value (rounded up).
+ */
+ public static long scaleRoundUp(long val, long scale){
+ return val/scale + ((val%scale)!=0?1:0);
+ }
+}
+
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/ISchedulerAlgorithm.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/ISchedulerAlgorithm.java
index 33865d15..e5031c13 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/ISchedulerAlgorithm.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/ISchedulerAlgorithm.java
@@ -1,25 +1,25 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler;
-
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core.SchedulerTask;
-
-public interface ISchedulerAlgorithm {
-
- public int compare(SchedulerTask t1,SchedulerTask t2);
- public boolean isPreemptiveScheduling();
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler;
+
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core.SchedulerTask;
+
+public interface ISchedulerAlgorithm {
+
+ public int compare(SchedulerTask t1,SchedulerTask t2);
+ public boolean isPreemptiveScheduling();
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/ISchedulerEventListener.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/ISchedulerEventListener.java
index d2e2841c..bfe41134 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/ISchedulerEventListener.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/ISchedulerEventListener.java
@@ -1,36 +1,36 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler;
-
-public interface ISchedulerEventListener {
-
- public String getCoreName();
-
- public void onTaskAdded(String t);
-
- public void onActivateTask(String task, long time);
- public void onStartTask(String task, long time);
- public void onPreemptTask(String task, long time);
- public void onTerminateTask(String task, long time);
- public void onWaitTask(String task, long time, String muxName, String holder);
- public void onReleaseTask(String task, long time);
-
- public void onTaskMissedDeadline(String task, long time, long remainingExectime);
-
- public void onStartIdleCore(long time);
- public void onStopIdleCore(long time);
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler;
+
+public interface ISchedulerEventListener {
+
+ public String getCoreName();
+
+ public void onTaskAdded(String t);
+
+ public void onActivateTask(String task, long time);
+ public void onStartTask(String task, long time);
+ public void onPreemptTask(String task, long time);
+ public void onTerminateTask(String task, long time);
+ public void onWaitTask(String task, long time, String muxName, String holder);
+ public void onReleaseTask(String task, long time);
+
+ public void onTaskMissedDeadline(String task, long time, long remainingExectime);
+
+ public void onStartIdleCore(long time);
+ public void onStopIdleCore(long time);
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/ISchedulerTask.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/ISchedulerTask.java
index 464c681d..290cd98b 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/ISchedulerTask.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/ISchedulerTask.java
@@ -1,31 +1,31 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler;
-
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core.Barrier;
-
-/**
- * API-User Interface for SchedulerTask.
- */
-public interface ISchedulerTask {
-
- public static long BARRIER_LOCK_AT_ACTIVATION=Long.MIN_VALUE;
- public static long BARRIER_UNLOCK_AT_SUSPENSION=Long.MAX_VALUE;
- public long getWCET();
- public long getPeriod();
- public void addDependentBarrier(Barrier m);
- public void addOwnedBarrier(Barrier barrier,long releaseTime);
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler;
+
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core.Barrier;
+
+/**
+ * API-User Interface for SchedulerTask.
+ */
+public interface ISchedulerTask {
+
+ public static long BARRIER_LOCK_AT_ACTIVATION=Long.MIN_VALUE;
+ public static long BARRIER_UNLOCK_AT_SUSPENSION=Long.MAX_VALUE;
+ public long getWCET();
+ public long getPeriod();
+ public void addDependentBarrier(Barrier m);
+ public void addOwnedBarrier(Barrier barrier,long releaseTime);
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/IStepScheduler.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/IStepScheduler.java
index 16342cad..f26552ed 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/IStepScheduler.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/IStepScheduler.java
@@ -1,24 +1,24 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler;
-
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core.ISchedulerBase;
-
-public interface IStepScheduler extends ISchedulerBase{
- public void updateTaskSynchronisation();
- public void updateTaskSet();
- public void runTaskOrIdleStep();
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler;
+
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core.ISchedulerBase;
+
+public interface IStepScheduler extends ISchedulerBase{
+ public void updateTaskSynchronisation();
+ public void updateTaskSet();
+ public void runTaskOrIdleStep();
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/SchedulerAlgorithmRegister.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/SchedulerAlgorithmRegister.java
index 62595f10..47162500 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/SchedulerAlgorithmRegister.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/SchedulerAlgorithmRegister.java
@@ -1,70 +1,70 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.function.Supplier;
-
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.algo.CooperativeEDFAlgo;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.algo.PreemptiveEDFAlgo;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.algo.PreemptiveRMSAlgo;
-
-/**
- * Class referencing all known scheduling-algorithms by name and the factory (through java-funcional-interface supplier).
- * Class is used by the user-interface to provide configurable scheduling.
- */
-public class SchedulerAlgorithmRegister {
-
- static Map<String,Supplier<ISchedulerAlgorithm>> factoryMap = new HashMap<>();
- static{
- factoryMap.put("Cooperative EDF", SchedulerAlgorithmRegister::createCooperativeEDF);
- factoryMap.put("Preemptive RMS", SchedulerAlgorithmRegister::createPreemptiveRMS);
- factoryMap.put("Preemptive EDF", SchedulerAlgorithmRegister::createPreemptiveEDF);
- }
-
- public static void update(String name,Supplier<ISchedulerAlgorithm> algoFactory){
- factoryMap.put(name, algoFactory);
- }
-
- public static String[] schedulerList(){
- return factoryMap.keySet().toArray(new String[factoryMap.keySet().size()]);
- }
-
- public static ISchedulerAlgorithm create(String name){
- Supplier<ISchedulerAlgorithm> sup = schedulerFactoryByName(name);
- if(sup!=null){
- return sup.get();
- }
- return null;
- }
-
- public static Supplier<ISchedulerAlgorithm> schedulerFactoryByName(String name){
- return factoryMap.get(name);
- }
-
- public static ISchedulerAlgorithm createCooperativeEDF(){
- return new CooperativeEDFAlgo();
- }
-
- public static ISchedulerAlgorithm createPreemptiveRMS(){
- return new PreemptiveRMSAlgo();
- }
-
- public static ISchedulerAlgorithm createPreemptiveEDF(){
- return new PreemptiveEDFAlgo();
- }
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.Supplier;
+
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.algo.CooperativeEDFAlgo;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.algo.PreemptiveEDFAlgo;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.algo.PreemptiveRMSAlgo;
+
+/**
+ * Class referencing all known scheduling-algorithms by name and the factory (through java-funcional-interface supplier).
+ * Class is used by the user-interface to provide configurable scheduling.
+ */
+public class SchedulerAlgorithmRegister {
+
+ static Map<String,Supplier<ISchedulerAlgorithm>> factoryMap = new HashMap<>();
+ static{
+ factoryMap.put("Cooperative EDF", SchedulerAlgorithmRegister::createCooperativeEDF);
+ factoryMap.put("Preemptive RMS", SchedulerAlgorithmRegister::createPreemptiveRMS);
+ factoryMap.put("Preemptive EDF", SchedulerAlgorithmRegister::createPreemptiveEDF);
+ }
+
+ public static void update(String name,Supplier<ISchedulerAlgorithm> algoFactory){
+ factoryMap.put(name, algoFactory);
+ }
+
+ public static String[] schedulerList(){
+ return factoryMap.keySet().toArray(new String[factoryMap.keySet().size()]);
+ }
+
+ public static ISchedulerAlgorithm create(String name){
+ Supplier<ISchedulerAlgorithm> sup = schedulerFactoryByName(name);
+ if(sup!=null){
+ return sup.get();
+ }
+ return null;
+ }
+
+ public static Supplier<ISchedulerAlgorithm> schedulerFactoryByName(String name){
+ return factoryMap.get(name);
+ }
+
+ public static ISchedulerAlgorithm createCooperativeEDF(){
+ return new CooperativeEDFAlgo();
+ }
+
+ public static ISchedulerAlgorithm createPreemptiveRMS(){
+ return new PreemptiveRMSAlgo();
+ }
+
+ public static ISchedulerAlgorithm createPreemptiveEDF(){
+ return new PreemptiveEDFAlgo();
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/SchedulerException.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/SchedulerException.java
index 4ae877e3..e46a032b 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/SchedulerException.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/SchedulerException.java
@@ -1,25 +1,25 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler;
-
-public class SchedulerException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- public SchedulerException(String msg) {
- super(msg);
- }
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler;
+
+public class SchedulerException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public SchedulerException(String msg) {
+ super(msg);
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/algo/CooperativeEDFAlgo.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/algo/CooperativeEDFAlgo.java
index 56c3c173..723e3df8 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/algo/CooperativeEDFAlgo.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/algo/CooperativeEDFAlgo.java
@@ -1,24 +1,24 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.algo;
-
-public class CooperativeEDFAlgo extends PreemptiveEDFAlgo{
-
- @Override
- public boolean isPreemptiveScheduling() {
- return false;
- }
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.algo;
+
+public class CooperativeEDFAlgo extends PreemptiveEDFAlgo{
+
+ @Override
+ public boolean isPreemptiveScheduling() {
+ return false;
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/algo/PreemptiveEDFAlgo.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/algo/PreemptiveEDFAlgo.java
index 9d813013..06776c23 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/algo/PreemptiveEDFAlgo.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/algo/PreemptiveEDFAlgo.java
@@ -1,40 +1,40 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.algo;
-
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerAlgorithm;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core.SchedulerTask;
-
-public class PreemptiveEDFAlgo implements ISchedulerAlgorithm{
-
- @Override
- public int compare(SchedulerTask o1, SchedulerTask o2) {
-// int tmp =Long.compare(o1.getDeadline(), o2.getDeadline());
-// if(tmp==0){
-// //same deadline => lowest id wins
-// tmp = Integer.compare(o1.getId(), o2.getId());
-// }
-// return tmp;
-
- return Long.compare(o1.getDeadline(), o2.getDeadline());
- }
-
- @Override
- public boolean isPreemptiveScheduling() {
- return true;
- }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.algo;
+
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerAlgorithm;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core.SchedulerTask;
+
+public class PreemptiveEDFAlgo implements ISchedulerAlgorithm{
+
+ @Override
+ public int compare(SchedulerTask o1, SchedulerTask o2) {
+// int tmp =Long.compare(o1.getDeadline(), o2.getDeadline());
+// if(tmp==0){
+// //same deadline => lowest id wins
+// tmp = Integer.compare(o1.getId(), o2.getId());
+// }
+// return tmp;
+
+ return Long.compare(o1.getDeadline(), o2.getDeadline());
+ }
+
+ @Override
+ public boolean isPreemptiveScheduling() {
+ return true;
+ }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/algo/PreemptiveRMSAlgo.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/algo/PreemptiveRMSAlgo.java
index c396d255..9b976740 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/algo/PreemptiveRMSAlgo.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/algo/PreemptiveRMSAlgo.java
@@ -1,33 +1,33 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.algo;
-
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerAlgorithm;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core.SchedulerTask;
-
-public class PreemptiveRMSAlgo implements ISchedulerAlgorithm{
- @Override
- public int compare(SchedulerTask o1, SchedulerTask o2) {
- return Long.compare(o1.getPeriod(), o2.getPeriod());
- }
-
-
- @Override
- public boolean isPreemptiveScheduling() {
- return true;
- }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.algo;
+
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerAlgorithm;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core.SchedulerTask;
+
+public class PreemptiveRMSAlgo implements ISchedulerAlgorithm{
+ @Override
+ public int compare(SchedulerTask o1, SchedulerTask o2) {
+ return Long.compare(o1.getPeriod(), o2.getPeriod());
+ }
+
+
+ @Override
+ public boolean isPreemptiveScheduling() {
+ return true;
+ }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/AbstractScheduler.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/AbstractScheduler.java
index 49cdeef0..31bd10c6 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/AbstractScheduler.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/AbstractScheduler.java
@@ -1,134 +1,134 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Consumer;
-
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerAlgorithm;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerEventListener;
-
-public abstract class AbstractScheduler implements ISchedulerBase {
-
- /**Simulation time.*/
- protected long simTime = 0;
-
- /**Map of tasks accessible by their names*/
- private final Map<String, SchedulerTask> tasks = new HashMap<>();
-
- /**Listners or observers that gets informed about scheduling information like task state changes.**/
- private List<ISchedulerEventListener> osHookListeners = new LinkedList<>();
-
- /**Algorithm to choose high prio task and determine if is cooperative or preemptive scheduling.**/
- private final ISchedulerAlgorithm schedulingAlgo;
-
- /**Current task in execution**/
- protected SchedulerTask currentTask=null;
-
- public AbstractScheduler(ISchedulerAlgorithm m) {
- this.schedulingAlgo = m;
- }
-
- protected void notifyObserver(Consumer<? super ISchedulerEventListener> action) {
- this.osHookListeners.forEach(action);
- }
-
- protected Map<String, SchedulerTask> getTasks() {
- return this.tasks;
- }
-
- protected List<ISchedulerEventListener> getOsHookListeners() {
- return osHookListeners;
- }
-
- /**
- * Search for the task with the highest priority, which is in ready state.
- * Uses {@link #compare(SchedulerTask, SchedulerTask)} to determine higher/ lower prio.
- * @return Task with highest prio or null if no ready task is available.
- */
- protected SchedulerTask getReadyPriorityTask() {
- SchedulerTask highTask = null;
- for (SchedulerTask t : tasks.values()) {
- if (t.isReady()) {
- if (highTask == null || compare(t, highTask) < 0) {
- highTask = t;
- }
- }
- }
- return highTask;
- }
-
- /**
- * Get simulation time.
- */
- @Override
- public long getSimTime() {
- return simTime;
- }
-
- /**
- * Increment simulation time by one.
- */
- protected void timeStep() {
- simTime++;
- }
-
-
- protected boolean isPreemptiveScheduling(){
- return schedulingAlgo.isPreemptiveScheduling();
- }
-
- /**
- * Compare two tasks regarding its priority.
- * Therefore the provided scheduling algorithm is used. If the algorithm
- * determines the same priority the earliest added task wins.
- * @param t1
- * @param t2
- * @return
- * <ul>
- * <li>t1 has highest priority: < 0 (-1)</li>
- * <li>t2 has highest priority: > 0 (1)</li>
- * <ul>
- */
- protected int compare(SchedulerTask t1,SchedulerTask t2){
- int tmp = schedulingAlgo.compare(t1, t2);
- if(tmp==0){
- //same prio => lowest id wins (earliest added task)
- tmp = Integer.compare(t1.getId(), t2.getId());
- }
- return tmp;
- }
-
- @Override
- public SchedulerTask getTask(String name) {
- return getTasks().get(name);
- }
-
- @Override
- public void addTask(String name,long wcet, long period) {
- SchedulerTask t = new SchedulerTask(name, wcet, period);
- t.setId(getTasks().size());
- getTasks().put(t.getName(), t);
- }
- @Override
- public void addSchedulerEventListener(ISchedulerEventListener l) {
- getOsHookListeners().add(l);
- }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Consumer;
+
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerAlgorithm;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerEventListener;
+
+public abstract class AbstractScheduler implements ISchedulerBase {
+
+ /**Simulation time.*/
+ protected long simTime = 0;
+
+ /**Map of tasks accessible by their names*/
+ private final Map<String, SchedulerTask> tasks = new HashMap<>();
+
+ /**Listners or observers that gets informed about scheduling information like task state changes.**/
+ private List<ISchedulerEventListener> osHookListeners = new LinkedList<>();
+
+ /**Algorithm to choose high prio task and determine if is cooperative or preemptive scheduling.**/
+ private final ISchedulerAlgorithm schedulingAlgo;
+
+ /**Current task in execution**/
+ protected SchedulerTask currentTask=null;
+
+ public AbstractScheduler(ISchedulerAlgorithm m) {
+ this.schedulingAlgo = m;
+ }
+
+ protected void notifyObserver(Consumer<? super ISchedulerEventListener> action) {
+ this.osHookListeners.forEach(action);
+ }
+
+ protected Map<String, SchedulerTask> getTasks() {
+ return this.tasks;
+ }
+
+ protected List<ISchedulerEventListener> getOsHookListeners() {
+ return osHookListeners;
+ }
+
+ /**
+ * Search for the task with the highest priority, which is in ready state.
+ * Uses {@link #compare(SchedulerTask, SchedulerTask)} to determine higher/ lower prio.
+ * @return Task with highest prio or null if no ready task is available.
+ */
+ protected SchedulerTask getReadyPriorityTask() {
+ SchedulerTask highTask = null;
+ for (SchedulerTask t : tasks.values()) {
+ if (t.isReady()) {
+ if (highTask == null || compare(t, highTask) < 0) {
+ highTask = t;
+ }
+ }
+ }
+ return highTask;
+ }
+
+ /**
+ * Get simulation time.
+ */
+ @Override
+ public long getSimTime() {
+ return simTime;
+ }
+
+ /**
+ * Increment simulation time by one.
+ */
+ protected void timeStep() {
+ simTime++;
+ }
+
+
+ protected boolean isPreemptiveScheduling(){
+ return schedulingAlgo.isPreemptiveScheduling();
+ }
+
+ /**
+ * Compare two tasks regarding its priority.
+ * Therefore the provided scheduling algorithm is used. If the algorithm
+ * determines the same priority the earliest added task wins.
+ * @param t1
+ * @param t2
+ * @return
+ * <ul>
+ * <li>t1 has highest priority: < 0 (-1)</li>
+ * <li>t2 has highest priority: > 0 (1)</li>
+ * <ul>
+ */
+ protected int compare(SchedulerTask t1,SchedulerTask t2){
+ int tmp = schedulingAlgo.compare(t1, t2);
+ if(tmp==0){
+ //same prio => lowest id wins (earliest added task)
+ tmp = Integer.compare(t1.getId(), t2.getId());
+ }
+ return tmp;
+ }
+
+ @Override
+ public SchedulerTask getTask(String name) {
+ return getTasks().get(name);
+ }
+
+ @Override
+ public void addTask(String name,long wcet, long period) {
+ SchedulerTask t = new SchedulerTask(name, wcet, period);
+ t.setId(getTasks().size());
+ getTasks().put(t.getName(), t);
+ }
+ @Override
+ public void addSchedulerEventListener(ISchedulerEventListener l) {
+ getOsHookListeners().add(l);
+ }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/Barrier.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/Barrier.java
index 47abb39c..daec95ed 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/Barrier.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/Barrier.java
@@ -1,99 +1,99 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core;
-
-
-/**
- * Represents a barrier which can be locked or unlocked.
- * e.g. it is used for implement task precedence.
- */
-public class Barrier {
-
- private String name;
-
- private String holder;
-
- private boolean locked = false;
-
- /**
- * Try to lock barrier.
- * @param requester Name of the requesting task.
- * @see
- * #unlock()
- * @return
- * <ul>
- * <li>true if barrier is unlocked and is now held by the requester</li>
- * <li>false if it is locked</li>
- * </ul>
- */
- public boolean tryLock(String requester){
- if(locked){
- return false;
- }else {
- locked=true;
- holder = requester;
- return true;
- }
- }
-
- /**
- * Unlock barrier and reset the current holder.
- */
- public void unlock(){
- locked=false;
- holder="";
- }
-
- /**
- * Check if barrier is currently locked.
- * @return
- * <ul>
- * <li>true if is locked</li>
- * <li>false if it is unlocked</li>
- * </ul>
- * @see #tryLock(String)
- * @see #unlock()
- */
- public boolean isLocked(){
- return locked;
- }
-
- /**
- * Get the name of the barrier. e.g. "mux_task_precedence_C1T1->C2T1"
- * @see #setName(String)
- * @return
- */
- public String getName() {
- return name;
- }
-
- /**
- * Set the name of the barrier.
- * @see #getName()
- * @param name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * If barrier is locked this method returns the name of the task which holds the task currently.
- * @return
- */
- public String getHolder(){
- return holder;
- }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core;
+
+
+/**
+ * Represents a barrier which can be locked or unlocked.
+ * e.g. it is used for implement task precedence.
+ */
+public class Barrier {
+
+ private String name;
+
+ private String holder;
+
+ private boolean locked = false;
+
+ /**
+ * Try to lock barrier.
+ * @param requester Name of the requesting task.
+ * @see
+ * #unlock()
+ * @return
+ * <ul>
+ * <li>true if barrier is unlocked and is now held by the requester</li>
+ * <li>false if it is locked</li>
+ * </ul>
+ */
+ public boolean tryLock(String requester){
+ if(locked){
+ return false;
+ }else {
+ locked=true;
+ holder = requester;
+ return true;
+ }
+ }
+
+ /**
+ * Unlock barrier and reset the current holder.
+ */
+ public void unlock(){
+ locked=false;
+ holder="";
+ }
+
+ /**
+ * Check if barrier is currently locked.
+ * @return
+ * <ul>
+ * <li>true if is locked</li>
+ * <li>false if it is unlocked</li>
+ * </ul>
+ * @see #tryLock(String)
+ * @see #unlock()
+ */
+ public boolean isLocked(){
+ return locked;
+ }
+
+ /**
+ * Get the name of the barrier. e.g. "mux_task_precedence_C1T1->C2T1"
+ * @see #setName(String)
+ * @return
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Set the name of the barrier.
+ * @see #getName()
+ * @param name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * If barrier is locked this method returns the name of the task which holds the task currently.
+ * @return
+ */
+ public String getHolder(){
+ return holder;
+ }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/BarrierAccess.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/BarrierAccess.java
index 10b9f4ee..88170af5 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/BarrierAccess.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/BarrierAccess.java
@@ -1,46 +1,46 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core;
-
-public class BarrierAccess {
-
-
- //not used yet... but future use
- private final long lockTime;
- private final long releaseTime;
- private final Barrier barrier;
-
- public BarrierAccess(long lockTime, long releaseTime, Barrier mutex) {
- super();
- this.lockTime = lockTime;
- this.releaseTime = releaseTime;
- this.barrier = mutex;
- }
-
- public long getLockTime() {
- return lockTime;
- }
-
- public long getReleaseTime() {
- return releaseTime;
- }
-
- public Barrier getBarrier() {
- return barrier;
- }
-
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core;
+
+public class BarrierAccess {
+
+
+ //not used yet... but future use
+ private final long lockTime;
+ private final long releaseTime;
+ private final Barrier barrier;
+
+ public BarrierAccess(long lockTime, long releaseTime, Barrier mutex) {
+ super();
+ this.lockTime = lockTime;
+ this.releaseTime = releaseTime;
+ this.barrier = mutex;
+ }
+
+ public long getLockTime() {
+ return lockTime;
+ }
+
+ public long getReleaseTime() {
+ return releaseTime;
+ }
+
+ public Barrier getBarrier() {
+ return barrier;
+ }
+
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/ISchedulerBase.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/ISchedulerBase.java
index 8abdbc5e..123f5e9a 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/ISchedulerBase.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/ISchedulerBase.java
@@ -1,28 +1,28 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core;
-
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerEventListener;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerTask;
-
-public interface ISchedulerBase {
- public void init();
- public long getSimTime();
- public void addSchedulerEventListener(ISchedulerEventListener l);
- public void addTask(String name, long wcet,long period);
- public ISchedulerTask getTask(String name);
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core;
+
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerEventListener;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerTask;
+
+public interface ISchedulerBase {
+ public void init();
+ public long getSimTime();
+ public void addSchedulerEventListener(ISchedulerEventListener l);
+ public void addTask(String name, long wcet,long period);
+ public ISchedulerTask getTask(String name);
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/SchedulerTask.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/SchedulerTask.java
index 1827680e..ebe8ae79 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/SchedulerTask.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/SchedulerTask.java
@@ -1,275 +1,275 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerTask;
-public class SchedulerTask extends TaskFSM implements ISchedulerTask{
-
- /**
- * Barriers are task-synchronization-points. This implementation relies on simulated barriers.
- * All owned barriers will be locked at beginning of every task-period. It will be
- * released after barrier release time is reached.
- */
- private final List<BarrierAccess> ownedBarriers = new LinkedList<>();
-
- /**
- * Barriers are used for synchronization of dependent tasks. The current task
- * has to wait until all dependentMutexes are unlocked.
- */
- private final List<Barrier> dependentBarrier = new LinkedList<>();
-
- /**Task name*/
- private final String name;
-
- /**Worst case execution time.*/
- private final long wcet;
-
- /**Fix period of the task.*/
- private final long period;
-
- /**Count of the current period.*/
- private int periodCount = 0;
-
- /**Relative earliest start time or activation time.*/
- private long esTime=0;
-
- /**Current consumed execution time.*/
- private long currentExecTime = 0;
-
- /**Unique upcounting number in a scheduler*/
- private int id;
-
- public SchedulerTask(String name, long wcet, long period) {
- super(TState.READY);
- this.name = name;
- this.wcet = wcet;
- this.period = period;
- this.esTime = 0;
- }
-
- public String getName() {
- return name;
- }
-
- @Override
- public long getWCET() {
- return wcet;
- }
-
- @Override
- public long getPeriod() {
- return period;
- }
-
- /**
- * @return the periodCount
- */
- public int getPeriodCount() {
- return periodCount;
- }
-
- /**
- * @param periodCount
- * the periodCount to set
- */
- public void incrementPeriodCount() {
- this.periodCount++;
- }
-
- public long getCurrentExecTime() {
- return currentExecTime;
- }
-
- /**
- * Run one time slot.
- */
- public void run() {
- assert isRunning();
- currentExecTime= Math.addExact(currentExecTime, 1); //one time step
- assert currentExecTime <= wcet;
- }
-
- /**
- * Check if current execution time of the task reached WCET.
- * @return
- */
- public boolean reachedWCET() {
- return currentExecTime == wcet;
- }
-
-
- /**
- * Get the remaining execution time to WCET.
- * @return
- */
- public long remainingExecutionTime() {
- return wcet - currentExecTime;
- }
-
-
- /**
- * Reset the task to be ready for the next period.
- * <ul>
- * <li>set current execution time to zero</li>
- * <li>set the next earliest start time to the start of the next period</li>
- * </ul>
- */
- public void resetForNextPeriod() {
- this.currentExecTime = 0;
- this.esTime += period;
- lockOwnedBarriers();
- incrementPeriodCount();
- }
-
-
- /**
- * Get current absolute earliest start time.
- *
- * @return
- */
- public long getEearliestStartTime() {
- return esTime;
- }
-
- public long getNextActivationTime() {
- return getEearliestStartTime() + period;
- }
-
- /**
- * Check if has blocking barriers (by mutexes).
- * @return
- */
- public boolean hasBlockingBarrier() {
- for (Barrier m : dependentBarrier) {
- if (m.isLocked()) {
- return true;
- }
- }
- return false;
- }
-
- public Barrier getFirstBlockingMutex(){
- for(Barrier m: dependentBarrier){
- if(m.isLocked()){
- return m;
- }
- }
- return null;
- }
-
- /**
- * Get the current (absolute) deadline.
- *
- * @return
- */
- public long getDeadline() {
- return getEearliestStartTime() + getPeriod();
- }
-
-
- /**
- * Unlock owned barriers/ mutexes that reached release time.
- */
- public void updateOwnedBarriers(){
- for(BarrierAccess ma:ownedBarriers){
- long releaseTime = ma.getReleaseTime();
- assert releaseTime <=getCurrentExecTime() ||releaseTime==ISchedulerTask.BARRIER_UNLOCK_AT_SUSPENSION;
- if(releaseTime==getCurrentExecTime()){
- ma.getBarrier().unlock();
- }else if(releaseTime==ISchedulerTask.BARRIER_UNLOCK_AT_SUSPENSION&& isSuspended()){
- ma.getBarrier().unlock();
- }
- }
- }
-
- /**
- * Lock all owned barriers (mutexes)
- */
- public void lockOwnedBarriers(){
-
- for(BarrierAccess ma:ownedBarriers){
- if(!ma.getBarrier().tryLock(getName())){
- //with owned mutexes the locking will always be possible
- //because current thread have to be the only task
- //that locks it.
-
- //Despite the task overrun an deadline and some owned barriers
- //arent
- }
- }
- }
-
- /**
- * Get identifier for the task. Unique in a scheduler.
- * Indicates the adding order for the scheduler.
- * @return
- */
- public int getId(){
- return id;
- }
-
- /**
- * Set identification.
- * @param id
- */
- public void setId(int id){
- this.id=id;
- }
-
- /**
- * Add an owned barrier to the task. Owned barriers are used for setting up task precedence.
- * The owner is the predecessor task. The successor task is dependent of the same barrier instance ({@link #addDependentBarrier(Barrier m)}).
- *
- * Barrier requirements
- * <ul>
- * <li>Passed instance have to be unlocked (free)</li>
- * <li>Passed instance have to be added to one owning task and to one or multiple depending tasks</li>
- * <li>Only the owner task locks and unlocks the barrier. Dependants only query if is unlocked</li>
- * </ul>
- * @see
- * #addDependentBarrier(Barrier)
- * @param barrier Barrier that have to be unlocked.
- * @param releaseTime Execution time of the task when the barrier gets unlocked in each period.
- */
- @Override
- public void addOwnedBarrier(Barrier barrier,long releaseTime) {
- //implementation through barriers and not through predecessor task
- //so unlocking can happen at random release times and not only at suspension
- //lock initially
- if(!barrier.tryLock(getName())){
- //not free
- assert false; //precondition free
- }
- BarrierAccess ma= new BarrierAccess(ISchedulerTask.BARRIER_LOCK_AT_ACTIVATION, releaseTime, barrier);
- ownedBarriers.add(ma);
- }
-
- /**
- * Add dependent barrier.
- * @see
- * #addOwnedBarrier(Barrier, long)
- * @param m
- */
- @Override
- public void addDependentBarrier(Barrier m){
- dependentBarrier.add(m);
- }
-
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerTask;
+public class SchedulerTask extends TaskFSM implements ISchedulerTask{
+
+ /**
+ * Barriers are task-synchronization-points. This implementation relies on simulated barriers.
+ * All owned barriers will be locked at beginning of every task-period. It will be
+ * released after barrier release time is reached.
+ */
+ private final List<BarrierAccess> ownedBarriers = new LinkedList<>();
+
+ /**
+ * Barriers are used for synchronization of dependent tasks. The current task
+ * has to wait until all dependentMutexes are unlocked.
+ */
+ private final List<Barrier> dependentBarrier = new LinkedList<>();
+
+ /**Task name*/
+ private final String name;
+
+ /**Worst case execution time.*/
+ private final long wcet;
+
+ /**Fix period of the task.*/
+ private final long period;
+
+ /**Count of the current period.*/
+ private int periodCount = 0;
+
+ /**Relative earliest start time or activation time.*/
+ private long esTime=0;
+
+ /**Current consumed execution time.*/
+ private long currentExecTime = 0;
+
+ /**Unique upcounting number in a scheduler*/
+ private int id;
+
+ public SchedulerTask(String name, long wcet, long period) {
+ super(TState.READY);
+ this.name = name;
+ this.wcet = wcet;
+ this.period = period;
+ this.esTime = 0;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public long getWCET() {
+ return wcet;
+ }
+
+ @Override
+ public long getPeriod() {
+ return period;
+ }
+
+ /**
+ * @return the periodCount
+ */
+ public int getPeriodCount() {
+ return periodCount;
+ }
+
+ /**
+ * @param periodCount
+ * the periodCount to set
+ */
+ public void incrementPeriodCount() {
+ this.periodCount++;
+ }
+
+ public long getCurrentExecTime() {
+ return currentExecTime;
+ }
+
+ /**
+ * Run one time slot.
+ */
+ public void run() {
+ assert isRunning();
+ currentExecTime= Math.addExact(currentExecTime, 1); //one time step
+ assert currentExecTime <= wcet;
+ }
+
+ /**
+ * Check if current execution time of the task reached WCET.
+ * @return
+ */
+ public boolean reachedWCET() {
+ return currentExecTime == wcet;
+ }
+
+
+ /**
+ * Get the remaining execution time to WCET.
+ * @return
+ */
+ public long remainingExecutionTime() {
+ return wcet - currentExecTime;
+ }
+
+
+ /**
+ * Reset the task to be ready for the next period.
+ * <ul>
+ * <li>set current execution time to zero</li>
+ * <li>set the next earliest start time to the start of the next period</li>
+ * </ul>
+ */
+ public void resetForNextPeriod() {
+ this.currentExecTime = 0;
+ this.esTime += period;
+ lockOwnedBarriers();
+ incrementPeriodCount();
+ }
+
+
+ /**
+ * Get current absolute earliest start time.
+ *
+ * @return
+ */
+ public long getEearliestStartTime() {
+ return esTime;
+ }
+
+ public long getNextActivationTime() {
+ return getEearliestStartTime() + period;
+ }
+
+ /**
+ * Check if has blocking barriers (by mutexes).
+ * @return
+ */
+ public boolean hasBlockingBarrier() {
+ for (Barrier m : dependentBarrier) {
+ if (m.isLocked()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public Barrier getFirstBlockingMutex(){
+ for(Barrier m: dependentBarrier){
+ if(m.isLocked()){
+ return m;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get the current (absolute) deadline.
+ *
+ * @return
+ */
+ public long getDeadline() {
+ return getEearliestStartTime() + getPeriod();
+ }
+
+
+ /**
+ * Unlock owned barriers/ mutexes that reached release time.
+ */
+ public void updateOwnedBarriers(){
+ for(BarrierAccess ma:ownedBarriers){
+ long releaseTime = ma.getReleaseTime();
+ assert releaseTime <=getCurrentExecTime() ||releaseTime==ISchedulerTask.BARRIER_UNLOCK_AT_SUSPENSION;
+ if(releaseTime==getCurrentExecTime()){
+ ma.getBarrier().unlock();
+ }else if(releaseTime==ISchedulerTask.BARRIER_UNLOCK_AT_SUSPENSION&& isSuspended()){
+ ma.getBarrier().unlock();
+ }
+ }
+ }
+
+ /**
+ * Lock all owned barriers (mutexes)
+ */
+ public void lockOwnedBarriers(){
+
+ for(BarrierAccess ma:ownedBarriers){
+ if(!ma.getBarrier().tryLock(getName())){
+ //with owned mutexes the locking will always be possible
+ //because current thread have to be the only task
+ //that locks it.
+
+ //Despite the task overrun an deadline and some owned barriers
+ //arent
+ }
+ }
+ }
+
+ /**
+ * Get identifier for the task. Unique in a scheduler.
+ * Indicates the adding order for the scheduler.
+ * @return
+ */
+ public int getId(){
+ return id;
+ }
+
+ /**
+ * Set identification.
+ * @param id
+ */
+ public void setId(int id){
+ this.id=id;
+ }
+
+ /**
+ * Add an owned barrier to the task. Owned barriers are used for setting up task precedence.
+ * The owner is the predecessor task. The successor task is dependent of the same barrier instance ({@link #addDependentBarrier(Barrier m)}).
+ *
+ * Barrier requirements
+ * <ul>
+ * <li>Passed instance have to be unlocked (free)</li>
+ * <li>Passed instance have to be added to one owning task and to one or multiple depending tasks</li>
+ * <li>Only the owner task locks and unlocks the barrier. Dependants only query if is unlocked</li>
+ * </ul>
+ * @see
+ * #addDependentBarrier(Barrier)
+ * @param barrier Barrier that have to be unlocked.
+ * @param releaseTime Execution time of the task when the barrier gets unlocked in each period.
+ */
+ @Override
+ public void addOwnedBarrier(Barrier barrier,long releaseTime) {
+ //implementation through barriers and not through predecessor task
+ //so unlocking can happen at random release times and not only at suspension
+ //lock initially
+ if(!barrier.tryLock(getName())){
+ //not free
+ assert false; //precondition free
+ }
+ BarrierAccess ma= new BarrierAccess(ISchedulerTask.BARRIER_LOCK_AT_ACTIVATION, releaseTime, barrier);
+ ownedBarriers.add(ma);
+ }
+
+ /**
+ * Add dependent barrier.
+ * @see
+ * #addOwnedBarrier(Barrier, long)
+ * @param m
+ */
+ @Override
+ public void addDependentBarrier(Barrier m){
+ dependentBarrier.add(m);
+ }
+
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/StepScheduler.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/StepScheduler.java
index 44ad3c51..7ed81f57 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/StepScheduler.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/StepScheduler.java
@@ -1,285 +1,285 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core;
-
-import java.util.function.Consumer;
-
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerAlgorithm;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.IStepScheduler;
-
-public class StepScheduler extends AbstractScheduler implements IStepScheduler{
-
- private boolean startedIdle =false;
-
- private enum ScheduleState{
- EXECUTED_RUN,EXECUTED_UPDATESYNC,EXECUTED_UPDATESET,UNINIT,EXECUTED_INIT
- }
-
- private ScheduleState currentState = ScheduleState.UNINIT;
-
- /**
- * Run Sequence:
- * {@link #runTaskOrIdleStep()}
- * {@link #updateTaskSynchronisation()}
- * {@link #updateTaskSet()}
- */
- public StepScheduler(ISchedulerAlgorithm m) {
- super(m);
- }
-
- @Override
- public void init(){
- if(currentState==ScheduleState.UNINIT){
- for(String task:getTasks().keySet()){
- notifyObserver(x -> x.onTaskAdded(task));
- notifyObserver(x->x.onActivateTask(task, 0));
- }
- currentState=ScheduleState.EXECUTED_INIT;
- }else{
- throw new IllegalStateException("Init the scheduler once before start");
- }
- }
-
- @Override
- public void updateTaskSynchronisation() {
- if(currentState==ScheduleState.EXECUTED_RUN){
- updateTaskSynchronisationIntern();
- currentState=ScheduleState.EXECUTED_UPDATESYNC;
- }else{
- throw new IllegalStateException("Wrong method sequencing!");
- }
- }
-
- /**
- * For all tasks free owned barrier if release-time is reached.
- */
- private void updateTaskSynchronisationIntern() {
- getTasks().values().forEach(SchedulerTask::updateOwnedBarriers);
- }
-
- @Override
- public void updateTaskSet() {
- if(currentState==ScheduleState.EXECUTED_UPDATESYNC){
- updateTaskSetIntern();
- currentState=ScheduleState.EXECUTED_UPDATESET;
- }else{
- throw new IllegalStateException("Wrong method sequencing!");
- }
- }
-
- /**
- * Call for each task:
- * <ul>
- * <li>{@link #updateTaskActivate(SchedulerTask)} </li>
- * <li>{@link #updateTaskRelease(SchedulerTask)} </li>
- * </ul>
- */
- private void updateTaskSetIntern() {
- getTasks().values().forEach(
- ((Consumer<SchedulerTask>)this::updateTaskActivate)
- .andThen(this::updateTaskRelease)
- );
- }
-
-
-
- /**
- * If the next period is intersected the task gets the activation event. If
- * the task was in suspended state (OSEK-Task-Model) the task is now in
- * ready state and deadline etc. will be setup for next period.
- *
- * @param t
- */
- private void updateTaskActivate(SchedulerTask t) {
- if (getSimTime()>=t.getNextActivationTime()) {
-
- if (t.reachedWCET()) {
- if (t.ev_activate()) {
- // task was suspended and is now ready (normal activation)
- assert t.isReady();
- }else{
- //task wasn't in suspended mode but reached wcet...
- //not possible
- assert false;
- }
- }else{
- //missed deadline
- assert t.remainingExecutionTime() > 0;
- notifyObserver(x -> x.onTaskMissedDeadline(t.getName(), getSimTime(), t.remainingExecutionTime()));
- t.hardResetFSM();
- }
-
- assert t.isReady();
- t.resetForNextPeriod();
- notifyObserver(x -> x.onActivateTask(t.getName(), getSimTime()));
-
-// if (t.reachedWCET()) {
-// if (t.ev_activate()) {
-// // task was suspended and is now ready (normal activation)
-// assert t.isReady();
-// t.resetForNextPeriod();
-// notifyObserver(x -> x.onActivateTask(t.getName(), getSimTime()));
-// }else{
-// //task wasn't in suspended mode but reached wcet...
-// //not possible
-// assert false;
-// }
-// }else{
-// assert t.remainingExecutionTime() > 0;
-// notifyObserver(x -> x.onTaskMissedDeadline(t.getName(), getSimTime(), t.remainingExecutionTime()));
-// t.hardResetFSM();
-// t.resetForNextPeriod();
-// notifyObserver(x -> x.onActivateTask(t.getName(), getSimTime()));
-// }
- }
- }
-
-
-
- /**
- * If the task has no blocking mutexes it gets the release event. If the
- * current state was waiting the new state is ready.
- */
- protected void updateTaskRelease(SchedulerTask t) {
- if (!t.hasBlockingBarrier()) {
- if (t.ev_release()) {
- assert t.isReady();
- notifyObserver(x -> x.onReleaseTask(t.getName(), getSimTime()));
- }
- }
- }
-
-
-
-
-
-
- @Override
- public void runTaskOrIdleStep(){
- if(currentState==ScheduleState.EXECUTED_UPDATESET||currentState==ScheduleState.EXECUTED_INIT){
- runTaskOrIdleStepIntern();
- currentState=ScheduleState.EXECUTED_RUN;
- }else{
- throw new IllegalStateException("Wrong method sequencing!");
- }
- }
-
- /**
- * <ul>
- * <li>preempt currentTask if is set, is preemtive scheduling and there is a higher prio task</li>
- * <li>
- */
- protected void runTaskOrIdleStepIntern() {
-// updateTaskSetIntern();
- updatePreemptCurrentTask();
-
- do{
- if (currentTask == null) {
- currentTask = getReadyPriorityTask();
- }
- if(currentTask==null){
- //no rdy task
- if(!startedIdle){
- //starting idle
- startedIdle=true;
- notifyObserver((x) -> x.onStartIdleCore(getSimTime()));
- }
- timeStep();
- return; //nothing more to do
- }else if (currentTask!=null && startedIdle){
- //got task after idle
- notifyObserver((x) -> x.onStopIdleCore(getSimTime()));
- startedIdle=false;
- }
-
- assert currentTask!=null;
- assert currentTask.isReady()||currentTask.isRunning();
-
- if (currentTask.ev_start()) {
- //only if task was ready
- notifyObserver(x -> x.onStartTask(currentTask.getName(), getSimTime()));
- }else{
- //task were already running
- }
-
- assert currentTask.isRunning();
-
- //if task is blocked by mutexes set it to wait
- if(currentTask.hasBlockingBarrier()){
- if(currentTask.ev_wait()){
- //should always be true but for convention we use if for notify regarding task state changes
- Barrier m = currentTask.getFirstBlockingMutex();
- notifyObserver(x -> x.onWaitTask(currentTask.getName(), getSimTime(), m.getName(), m.getHolder()));
- }
- assert currentTask.isWaiting();
- currentTask=null; //drop task
- }
- }while(currentTask==null); //look for new task because current one (before set to null) is now waiting
-
- assert currentTask !=null;
- assert !currentTask.hasBlockingBarrier();
- assert currentTask.isRunning();
-
- currentTask.run();
- timeStep();
-
- updateCurrenTaskSuspension();
- }
-
-
-
- private void updatePreemptCurrentTask(){
- if (currentTask != null && isPreemptiveScheduling()) {
- assert currentTask.isRunning();
-
- // scheduling with preemption, so high prio tasks
- // can suppress lower tasks
- SchedulerTask t = getReadyPriorityTask();
- if (t != null && compare(t, currentTask) < 0) {
- // current task has a lower prio than t
- if (currentTask.ev_preempt()) {
- notifyObserver(x -> x.onPreemptTask(currentTask.getName(), getSimTime()));
- }
- assert currentTask.isReady();
- currentTask = null;// look for other task next round
- }
- }
- }
-
-
- /**
- * If a currenTask is set and this have reached WCET terminate it, so new state is suspended.
- * Unset currentTaks.
- */
- private void updateCurrenTaskSuspension(){
- if (currentTask != null && currentTask.reachedWCET()) {
- // currentTask.unlockOwnedMutexes();
- if (currentTask.ev_terminate()) {
- //should always be true
- notifyObserver(x -> x.onTerminateTask(currentTask.getName(), getSimTime()));
- }
- assert currentTask.isSuspended();
- // currentTask execution finished for this period or is (newly)
- // blocked
- // => next round we have to lookup for a new task
- currentTask = null;// look for other task next round
- }
- }
-
-
-
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core;
+
+import java.util.function.Consumer;
+
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerAlgorithm;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.IStepScheduler;
+
+public class StepScheduler extends AbstractScheduler implements IStepScheduler{
+
+ private boolean startedIdle =false;
+
+ private enum ScheduleState{
+ EXECUTED_RUN,EXECUTED_UPDATESYNC,EXECUTED_UPDATESET,UNINIT,EXECUTED_INIT
+ }
+
+ private ScheduleState currentState = ScheduleState.UNINIT;
+
+ /**
+ * Run Sequence:
+ * {@link #runTaskOrIdleStep()}
+ * {@link #updateTaskSynchronisation()}
+ * {@link #updateTaskSet()}
+ */
+ public StepScheduler(ISchedulerAlgorithm m) {
+ super(m);
+ }
+
+ @Override
+ public void init(){
+ if(currentState==ScheduleState.UNINIT){
+ for(String task:getTasks().keySet()){
+ notifyObserver(x -> x.onTaskAdded(task));
+ notifyObserver(x->x.onActivateTask(task, 0));
+ }
+ currentState=ScheduleState.EXECUTED_INIT;
+ }else{
+ throw new IllegalStateException("Init the scheduler once before start");
+ }
+ }
+
+ @Override
+ public void updateTaskSynchronisation() {
+ if(currentState==ScheduleState.EXECUTED_RUN){
+ updateTaskSynchronisationIntern();
+ currentState=ScheduleState.EXECUTED_UPDATESYNC;
+ }else{
+ throw new IllegalStateException("Wrong method sequencing!");
+ }
+ }
+
+ /**
+ * For all tasks free owned barrier if release-time is reached.
+ */
+ private void updateTaskSynchronisationIntern() {
+ getTasks().values().forEach(SchedulerTask::updateOwnedBarriers);
+ }
+
+ @Override
+ public void updateTaskSet() {
+ if(currentState==ScheduleState.EXECUTED_UPDATESYNC){
+ updateTaskSetIntern();
+ currentState=ScheduleState.EXECUTED_UPDATESET;
+ }else{
+ throw new IllegalStateException("Wrong method sequencing!");
+ }
+ }
+
+ /**
+ * Call for each task:
+ * <ul>
+ * <li>{@link #updateTaskActivate(SchedulerTask)} </li>
+ * <li>{@link #updateTaskRelease(SchedulerTask)} </li>
+ * </ul>
+ */
+ private void updateTaskSetIntern() {
+ getTasks().values().forEach(
+ ((Consumer<SchedulerTask>)this::updateTaskActivate)
+ .andThen(this::updateTaskRelease)
+ );
+ }
+
+
+
+ /**
+ * If the next period is intersected the task gets the activation event. If
+ * the task was in suspended state (OSEK-Task-Model) the task is now in
+ * ready state and deadline etc. will be setup for next period.
+ *
+ * @param t
+ */
+ private void updateTaskActivate(SchedulerTask t) {
+ if (getSimTime()>=t.getNextActivationTime()) {
+
+ if (t.reachedWCET()) {
+ if (t.ev_activate()) {
+ // task was suspended and is now ready (normal activation)
+ assert t.isReady();
+ }else{
+ //task wasn't in suspended mode but reached wcet...
+ //not possible
+ assert false;
+ }
+ }else{
+ //missed deadline
+ assert t.remainingExecutionTime() > 0;
+ notifyObserver(x -> x.onTaskMissedDeadline(t.getName(), getSimTime(), t.remainingExecutionTime()));
+ t.hardResetFSM();
+ }
+
+ assert t.isReady();
+ t.resetForNextPeriod();
+ notifyObserver(x -> x.onActivateTask(t.getName(), getSimTime()));
+
+// if (t.reachedWCET()) {
+// if (t.ev_activate()) {
+// // task was suspended and is now ready (normal activation)
+// assert t.isReady();
+// t.resetForNextPeriod();
+// notifyObserver(x -> x.onActivateTask(t.getName(), getSimTime()));
+// }else{
+// //task wasn't in suspended mode but reached wcet...
+// //not possible
+// assert false;
+// }
+// }else{
+// assert t.remainingExecutionTime() > 0;
+// notifyObserver(x -> x.onTaskMissedDeadline(t.getName(), getSimTime(), t.remainingExecutionTime()));
+// t.hardResetFSM();
+// t.resetForNextPeriod();
+// notifyObserver(x -> x.onActivateTask(t.getName(), getSimTime()));
+// }
+ }
+ }
+
+
+
+ /**
+ * If the task has no blocking mutexes it gets the release event. If the
+ * current state was waiting the new state is ready.
+ */
+ protected void updateTaskRelease(SchedulerTask t) {
+ if (!t.hasBlockingBarrier()) {
+ if (t.ev_release()) {
+ assert t.isReady();
+ notifyObserver(x -> x.onReleaseTask(t.getName(), getSimTime()));
+ }
+ }
+ }
+
+
+
+
+
+
+ @Override
+ public void runTaskOrIdleStep(){
+ if(currentState==ScheduleState.EXECUTED_UPDATESET||currentState==ScheduleState.EXECUTED_INIT){
+ runTaskOrIdleStepIntern();
+ currentState=ScheduleState.EXECUTED_RUN;
+ }else{
+ throw new IllegalStateException("Wrong method sequencing!");
+ }
+ }
+
+ /**
+ * <ul>
+ * <li>preempt currentTask if is set, is preemtive scheduling and there is a higher prio task</li>
+ * <li>
+ */
+ protected void runTaskOrIdleStepIntern() {
+// updateTaskSetIntern();
+ updatePreemptCurrentTask();
+
+ do{
+ if (currentTask == null) {
+ currentTask = getReadyPriorityTask();
+ }
+ if(currentTask==null){
+ //no rdy task
+ if(!startedIdle){
+ //starting idle
+ startedIdle=true;
+ notifyObserver((x) -> x.onStartIdleCore(getSimTime()));
+ }
+ timeStep();
+ return; //nothing more to do
+ }else if (currentTask!=null && startedIdle){
+ //got task after idle
+ notifyObserver((x) -> x.onStopIdleCore(getSimTime()));
+ startedIdle=false;
+ }
+
+ assert currentTask!=null;
+ assert currentTask.isReady()||currentTask.isRunning();
+
+ if (currentTask.ev_start()) {
+ //only if task was ready
+ notifyObserver(x -> x.onStartTask(currentTask.getName(), getSimTime()));
+ }else{
+ //task were already running
+ }
+
+ assert currentTask.isRunning();
+
+ //if task is blocked by mutexes set it to wait
+ if(currentTask.hasBlockingBarrier()){
+ if(currentTask.ev_wait()){
+ //should always be true but for convention we use if for notify regarding task state changes
+ Barrier m = currentTask.getFirstBlockingMutex();
+ notifyObserver(x -> x.onWaitTask(currentTask.getName(), getSimTime(), m.getName(), m.getHolder()));
+ }
+ assert currentTask.isWaiting();
+ currentTask=null; //drop task
+ }
+ }while(currentTask==null); //look for new task because current one (before set to null) is now waiting
+
+ assert currentTask !=null;
+ assert !currentTask.hasBlockingBarrier();
+ assert currentTask.isRunning();
+
+ currentTask.run();
+ timeStep();
+
+ updateCurrenTaskSuspension();
+ }
+
+
+
+ private void updatePreemptCurrentTask(){
+ if (currentTask != null && isPreemptiveScheduling()) {
+ assert currentTask.isRunning();
+
+ // scheduling with preemption, so high prio tasks
+ // can suppress lower tasks
+ SchedulerTask t = getReadyPriorityTask();
+ if (t != null && compare(t, currentTask) < 0) {
+ // current task has a lower prio than t
+ if (currentTask.ev_preempt()) {
+ notifyObserver(x -> x.onPreemptTask(currentTask.getName(), getSimTime()));
+ }
+ assert currentTask.isReady();
+ currentTask = null;// look for other task next round
+ }
+ }
+ }
+
+
+ /**
+ * If a currenTask is set and this have reached WCET terminate it, so new state is suspended.
+ * Unset currentTaks.
+ */
+ private void updateCurrenTaskSuspension(){
+ if (currentTask != null && currentTask.reachedWCET()) {
+ // currentTask.unlockOwnedMutexes();
+ if (currentTask.ev_terminate()) {
+ //should always be true
+ notifyObserver(x -> x.onTerminateTask(currentTask.getName(), getSimTime()));
+ }
+ assert currentTask.isSuspended();
+ // currentTask execution finished for this period or is (newly)
+ // blocked
+ // => next round we have to lookup for a new task
+ currentTask = null;// look for other task next round
+ }
+ }
+
+
+
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/TaskFSM.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/TaskFSM.java
index ef9ff496..922db74e 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/TaskFSM.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/core/TaskFSM.java
@@ -1,164 +1,164 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core;
-
-/**
- * Implementation of the OSEK Task Model.
- * Note: We do not use state design pattern because every event delegates only to one state.
- * Therefore the design pattern would produce overhead.
- */
-public class TaskFSM {
-
-
- public enum TState{
- NONE,WAITING,RUNNING,READY,SUSPENDED
- }
-
- private TState currentState;
- private TState previousState;
-
- @SuppressWarnings("unused")
- private final TState startState;
-
-
- public TaskFSM(final TState startState){
- this.startState=startState;
- this.currentState=startState;
- this.previousState=TState.NONE;
- }
-
- /**
- * Set current-state to READY. Previous state will be saved.
- */
- public void hardResetFSM(){
- this.previousState=currentState;
- this.currentState=TState.READY;
- }
-
- public boolean isReady() {
- return currentState == TState.READY;
- }
-
- public boolean isSuspended() {
- return currentState == TState.SUSPENDED;
- }
-
- public boolean isWaiting() {
- return currentState == TState.WAITING;
- }
-
- public boolean isRunning() {
- return currentState == TState.RUNNING;
- }
-
-//
-// private class State{
-// public boolean ev_wait(){
-// return false;
-// }
-// public boolean ev_terminate(){
-// return false;
-// }
-// public boolean ev_activate(){
-// return false;
-// }
-// public boolean ev_release(){
-// return false;
-// }
-// public boolean ev_start(){
-// return false;
-// }
-// public boolean ev_preempt(){
-// return false;
-// }
-// }
-//
-// public class StateRunning extends State{
-// public boolean ev_terminate(){
-// setState(newState);
-// }
-// }
-
-
-
-
- public boolean ev_preempt() {
- if(isRunning()){
- setState(TState.READY);
- return true;
- }
- return false;
- }
-
- public boolean ev_terminate(){
- if(isRunning()){
- setState(TState.SUSPENDED);
- return true;
- }
- return false;
- }
-
- public boolean ev_start() {
- if(isReady()){
- setState(TState.RUNNING);
- return true;
- }
- return false;
- }
-
- public boolean ev_wait(){
- if(isRunning()){
- setState(TState.WAITING);
- return true;
- }
- return false;
- }
-
- public boolean ev_release(){
- if(isWaiting()){
- setState(TState.READY);
- return true;
- }
- return false;
- }
-
- public boolean ev_activate(){
- if(isSuspended()){
- setState(TState.READY);
- return true;
- }
- return false;
- }
-
-
- protected void setState(TState newState) {
- this.previousState=this.currentState;
- this.currentState=newState;
- }
-
- public TState getCurrentState() {
- return currentState;
- }
-
- public TState getPreviousState() {
- return previousState;
- }
-
-
-
-
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core;
+
+/**
+ * Implementation of the OSEK Task Model.
+ * Note: We do not use state design pattern because every event delegates only to one state.
+ * Therefore the design pattern would produce overhead.
+ */
+public class TaskFSM {
+
+
+ public enum TState{
+ NONE,WAITING,RUNNING,READY,SUSPENDED
+ }
+
+ private TState currentState;
+ private TState previousState;
+
+ @SuppressWarnings("unused")
+ private final TState startState;
+
+
+ public TaskFSM(final TState startState){
+ this.startState=startState;
+ this.currentState=startState;
+ this.previousState=TState.NONE;
+ }
+
+ /**
+ * Set current-state to READY. Previous state will be saved.
+ */
+ public void hardResetFSM(){
+ this.previousState=currentState;
+ this.currentState=TState.READY;
+ }
+
+ public boolean isReady() {
+ return currentState == TState.READY;
+ }
+
+ public boolean isSuspended() {
+ return currentState == TState.SUSPENDED;
+ }
+
+ public boolean isWaiting() {
+ return currentState == TState.WAITING;
+ }
+
+ public boolean isRunning() {
+ return currentState == TState.RUNNING;
+ }
+
+//
+// private class State{
+// public boolean ev_wait(){
+// return false;
+// }
+// public boolean ev_terminate(){
+// return false;
+// }
+// public boolean ev_activate(){
+// return false;
+// }
+// public boolean ev_release(){
+// return false;
+// }
+// public boolean ev_start(){
+// return false;
+// }
+// public boolean ev_preempt(){
+// return false;
+// }
+// }
+//
+// public class StateRunning extends State{
+// public boolean ev_terminate(){
+// setState(newState);
+// }
+// }
+
+
+
+
+ public boolean ev_preempt() {
+ if(isRunning()){
+ setState(TState.READY);
+ return true;
+ }
+ return false;
+ }
+
+ public boolean ev_terminate(){
+ if(isRunning()){
+ setState(TState.SUSPENDED);
+ return true;
+ }
+ return false;
+ }
+
+ public boolean ev_start() {
+ if(isReady()){
+ setState(TState.RUNNING);
+ return true;
+ }
+ return false;
+ }
+
+ public boolean ev_wait(){
+ if(isRunning()){
+ setState(TState.WAITING);
+ return true;
+ }
+ return false;
+ }
+
+ public boolean ev_release(){
+ if(isWaiting()){
+ setState(TState.READY);
+ return true;
+ }
+ return false;
+ }
+
+ public boolean ev_activate(){
+ if(isSuspended()){
+ setState(TState.READY);
+ return true;
+ }
+ return false;
+ }
+
+
+ protected void setState(TState newState) {
+ this.previousState=this.currentState;
+ this.currentState=newState;
+ }
+
+ public TState getCurrentState() {
+ return currentState;
+ }
+
+ public TState getPreviousState() {
+ return previousState;
+ }
+
+
+
+
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/tracing/ConsoleSchedulerTracer.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/tracing/ConsoleSchedulerTracer.java
index ebd46d18..9c8a0b2d 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/tracing/ConsoleSchedulerTracer.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/tracing/ConsoleSchedulerTracer.java
@@ -1,24 +1,24 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.tracing;
-
-public class ConsoleSchedulerTracer extends PrintStreamSchedulerTracer{
-
- public ConsoleSchedulerTracer(String label) {
- super(label,System.out);
- }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.tracing;
+
+public class ConsoleSchedulerTracer extends PrintStreamSchedulerTracer{
+
+ public ConsoleSchedulerTracer(String label) {
+ super(label,System.out);
+ }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/tracing/FileSchedulerTracer.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/tracing/FileSchedulerTracer.java
index eda27e17..75ba1459 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/tracing/FileSchedulerTracer.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/tracing/FileSchedulerTracer.java
@@ -1,42 +1,42 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.tracing;
-
-import java.io.IOException;
-import java.io.PrintStream;
-import java.nio.file.FileSystems;
-import java.nio.file.Files;
-import java.nio.file.Path;
-
-public class FileSchedulerTracer extends PrintStreamSchedulerTracer{
-
- String stringPath;
- String stringFile;
-
- public FileSchedulerTracer(String stringPath,String stringFile) {
- super(stringFile);
- this.stringFile=stringFile;
- this.stringPath=stringPath;
- }
-
- public void init() throws IOException{
- Path dir = FileSystems.getDefault().getPath(stringPath);
- Files.createDirectories(dir);
- Path path = FileSystems.getDefault().getPath(stringPath,stringFile);
- setPtrintStream(new PrintStream(Files.newOutputStream(path)));
- }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.tracing;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+public class FileSchedulerTracer extends PrintStreamSchedulerTracer{
+
+ String stringPath;
+ String stringFile;
+
+ public FileSchedulerTracer(String stringPath,String stringFile) {
+ super(stringFile);
+ this.stringFile=stringFile;
+ this.stringPath=stringPath;
+ }
+
+ public void init() throws IOException{
+ Path dir = FileSystems.getDefault().getPath(stringPath);
+ Files.createDirectories(dir);
+ Path path = FileSystems.getDefault().getPath(stringPath,stringFile);
+ setPtrintStream(new PrintStream(Files.newOutputStream(path)));
+ }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/tracing/PrintStreamSchedulerTracer.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/tracing/PrintStreamSchedulerTracer.java
index 8127cd6f..ab71a749 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/tracing/PrintStreamSchedulerTracer.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/src/org/eclipse/app4mc/multicore/execution/logic/systemproxy/tracing/PrintStreamSchedulerTracer.java
@@ -1,113 +1,113 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.tracing;
-
-import java.io.PrintStream;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
-
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerEventListener;
-
-public class PrintStreamSchedulerTracer implements ISchedulerEventListener {
-
- private PrintStream out;
-
- private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("mm:ss:SSS");
-
- private final String label;
-
- public PrintStreamSchedulerTracer(String label,PrintStream s){
- out=s;
- this.label=label;
- }
-
- public PrintStreamSchedulerTracer(String label) {
- this.label=label;
- }
-
- public void setPtrintStream(PrintStream s){
- this.out=s;
- }
-
- public PrintStream getPrintStream(){
- return out;
- }
-
- @Override
- public void onTaskAdded(String taskName) {
- write("Added task to StepScheduler: "+taskName);
- }
-
- @Override
- public void onActivateTask(String task, long time) {
- write(time + " | onActivateTask "+ task );
- }
-
- @Override
- public void onStartTask(String task, long time) {
- write(time + " | onStartTask "+ task );
- }
-
-
- @Override
- public void onTerminateTask(String task, long time) {
- write(time + " | onTerminateTask "+ task );
- }
-
- @Override
- public void onPreemptTask(String task, long time) {
- write(time + " | onPreemptTask "+ task );
- }
-
- @Override
- public void onWaitTask(String task, long time, String muxName, String holder) {
- write(time + " | onWaitTask " + task);
- }
-
- @Override
- public void onReleaseTask(String task, long time) {
- write(time + " | onReleaseTask " + task);
- }
-
- @Override
- public void onTaskMissedDeadline(String task, long time, long remainingExectime) {
- write(time + " | onTaskMissedDeadline "+task);
- }
-
- @Override
- public void onStartIdleCore(long time) {
- write(time + " | onStartIdleCore " );
- }
-
- @Override
- public void onStopIdleCore(long time) {
- write(time + " | onStopIdleCore " );
- }
-
- private void write(String w){
- String x = LocalDateTime.now().format(formatter);
- out.println(x + " "+getCoreName()+" -> " + w);
- }
-
- @Override
- public String getCoreName() {
- return label;
- }
-
-
-
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.tracing;
+
+import java.io.PrintStream;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerEventListener;
+
+public class PrintStreamSchedulerTracer implements ISchedulerEventListener {
+
+ private PrintStream out;
+
+ private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("mm:ss:SSS");
+
+ private final String label;
+
+ public PrintStreamSchedulerTracer(String label,PrintStream s){
+ out=s;
+ this.label=label;
+ }
+
+ public PrintStreamSchedulerTracer(String label) {
+ this.label=label;
+ }
+
+ public void setPtrintStream(PrintStream s){
+ this.out=s;
+ }
+
+ public PrintStream getPrintStream(){
+ return out;
+ }
+
+ @Override
+ public void onTaskAdded(String taskName) {
+ write("Added task to StepScheduler: "+taskName);
+ }
+
+ @Override
+ public void onActivateTask(String task, long time) {
+ write(time + " | onActivateTask "+ task );
+ }
+
+ @Override
+ public void onStartTask(String task, long time) {
+ write(time + " | onStartTask "+ task );
+ }
+
+
+ @Override
+ public void onTerminateTask(String task, long time) {
+ write(time + " | onTerminateTask "+ task );
+ }
+
+ @Override
+ public void onPreemptTask(String task, long time) {
+ write(time + " | onPreemptTask "+ task );
+ }
+
+ @Override
+ public void onWaitTask(String task, long time, String muxName, String holder) {
+ write(time + " | onWaitTask " + task);
+ }
+
+ @Override
+ public void onReleaseTask(String task, long time) {
+ write(time + " | onReleaseTask " + task);
+ }
+
+ @Override
+ public void onTaskMissedDeadline(String task, long time, long remainingExectime) {
+ write(time + " | onTaskMissedDeadline "+task);
+ }
+
+ @Override
+ public void onStartIdleCore(long time) {
+ write(time + " | onStartIdleCore " );
+ }
+
+ @Override
+ public void onStopIdleCore(long time) {
+ write(time + " | onStopIdleCore " );
+ }
+
+ private void write(String w){
+ String x = LocalDateTime.now().format(formatter);
+ out.println(x + " "+getCoreName()+" -> " + w);
+ }
+
+ @Override
+ public String getCoreName() {
+ return label;
+ }
+
+
+
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/executionmodel/test/TaskFSMTest.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/executionmodel/test/TaskFSMTest.java
index 685f9b34..712fc616 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/executionmodel/test/TaskFSMTest.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/executionmodel/test/TaskFSMTest.java
@@ -1,45 +1,45 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.executionmodel.test;
-
-import static org.junit.Assert.*;
-
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskEvent;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskFSM;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskState;
-import org.junit.Test;
-
-public class TaskFSMTest {
-
- @Test
- public void test() {
-// EMTaskFSM fsm = new EMTaskFSM(EMTaskState.READY);
-// assertEquals(fsm.getState(), EMTaskState.READY);
-// assertFalse(fsm.dispatchEvent(EMTaskEvent.WAIT));
-// assertEquals(fsm.getState(), EMTaskState.READY);
-// assertTrue(fsm.dispatchEvent(EMTaskEvent.START));
-// assertEquals(fsm.getState(), EMTaskState.RUNNING);
-//
-// fsm.dispatchEvent(EMTaskEvent.TERMINATE);
-// fsm.dispatchEvent(EMTaskEvent.ACTIVATE);
-// fsm.dispatchEvent(EMTaskEvent.START);
-// fsm.dispatchEvent(EMTaskEvent.WAIT);
-// fsm.dispatchEvent(EMTaskEvent.RELEASE);
-// fsm.dispatchEvent(EMTaskEvent.START);
-// assertEquals(fsm.getState(), EMTaskState.RUNNING);
- }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.executionmodel.test;
+
+import static org.junit.Assert.*;
+
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskEvent;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskFSM;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskState;
+import org.junit.Test;
+
+public class TaskFSMTest {
+
+ @Test
+ public void test() {
+// EMTaskFSM fsm = new EMTaskFSM(EMTaskState.READY);
+// assertEquals(fsm.getState(), EMTaskState.READY);
+// assertFalse(fsm.dispatchEvent(EMTaskEvent.WAIT));
+// assertEquals(fsm.getState(), EMTaskState.READY);
+// assertTrue(fsm.dispatchEvent(EMTaskEvent.START));
+// assertEquals(fsm.getState(), EMTaskState.RUNNING);
+//
+// fsm.dispatchEvent(EMTaskEvent.TERMINATE);
+// fsm.dispatchEvent(EMTaskEvent.ACTIVATE);
+// fsm.dispatchEvent(EMTaskEvent.START);
+// fsm.dispatchEvent(EMTaskEvent.WAIT);
+// fsm.dispatchEvent(EMTaskEvent.RELEASE);
+// fsm.dispatchEvent(EMTaskEvent.START);
+// assertEquals(fsm.getState(), EMTaskState.RUNNING);
+ }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/openmapping/test/OMUtilTest.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/openmapping/test/OMUtilTest.java
index a15ad16d..84319585 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/openmapping/test/OMUtilTest.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/openmapping/test/OMUtilTest.java
@@ -1,135 +1,135 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.openmapping.test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.app4mc.amalthea.model.AmaltheaFactory;
-import org.eclipse.app4mc.amalthea.model.ProcessingUnit;
-import org.eclipse.app4mc.amalthea.model.Task;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMAllocation;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMCore;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMEdge;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMTask;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMUtil;
-import org.junit.Test;
-
-public class OMUtilTest {
-
- @Test
- public void testGetCoreTaskMap() {
- ProcessingUnit c1= AmaltheaFactory.eINSTANCE.createProcessingUnit();
- c1.setName("Core1");
- OMCore omc1 = new OMCore(c1);
-
- ProcessingUnit c2= AmaltheaFactory.eINSTANCE.createProcessingUnit();
- c2.setName("Core2");
- OMCore omc2 = new OMCore(c2);
-
- Task t1_c1= createTask("T1_CORE1");
- Task t2_c1= createTask("T2_CORE1");
- Task t3_c1= createTask("T3_CORE1");
-
- Task t1_c2= createTask("T1_CORE2");
- Task t2_c2= createTask("T2_CORE2");
-
- List<OMAllocation> allocs= new LinkedList<>();
- allocs.add(new OMAllocation(new OMTask(t1_c1), omc1));
- allocs.add(new OMAllocation(new OMTask(t2_c1), omc1));
- allocs.add(new OMAllocation(new OMTask(t3_c1), omc1));
- allocs.add(new OMAllocation(new OMTask(t1_c2), omc2));
- allocs.add(new OMAllocation(new OMTask(t2_c2), omc2));
-
- assertEquals(new OMCore(c1), new OMCore(c1));
-
-
- Map<OMCore,List<OMTask>> map = OMUtil.getCoreTaskMap(allocs);
-
- assertEquals(map.keySet().size(),2);
-
-
-
- boolean checkedC1=false;
- boolean checkedC2=false;
-
-
-
- for(OMCore c: map.keySet()){
- if(c.getCoreRef()==c1){
- List<OMTask> tasks = map.get(c);
- assertEquals(3, tasks.size());
- assertEquals("T1_CORE1",tasks.get(0).getTaskRef().getName());
- assertEquals("T2_CORE1",tasks.get(1).getTaskRef().getName());
- assertEquals("T3_CORE1",tasks.get(2).getTaskRef().getName());
- checkedC1=true;
- }else if (c.getCoreRef().getName().equals("Core2")){
- List<OMTask> tasks = map.get(c);
- assertEquals(2, tasks.size());
- assertEquals("T1_CORE2",tasks.get(0).getTaskRef().getName());
- assertEquals("T2_CORE2",tasks.get(1).getTaskRef().getName());
- checkedC2=true;
- }else{
- assertTrue(false);
- }
- }
-
- assertTrue(checkedC1);
- assertTrue(checkedC2);
-
-
-
- }
- private static Task createTask(String name){
- Task t = AmaltheaFactory.eINSTANCE.createTask();
- t.setName(name);
- return t;
- }
-
-
- @Test
- public void testIsDAG(){
- List<OMEdge> list =new LinkedList<>();
-
- OMTask a= new OMTask(null);
- OMTask b=new OMTask(null);
- OMTask c=new OMTask(null);
-
- list.add(new OMEdge(a,b, 0,0));
- list.add(new OMEdge(a, c, 0,0));
- list.add(new OMEdge(b, c, 0,0));
-
- assertTrue(OMUtil.isDAG(list));
-
- OMTask d=new OMTask(null);
-
- list.add(new OMEdge(d, a, 0,0));
- assertTrue(OMUtil.isDAG(list));
-
- list.add(new OMEdge(c, d, 0,0));
-
- assertFalse(OMUtil.isDAG(list));
-
- }
-
-
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.openmapping.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.app4mc.amalthea.model.AmaltheaFactory;
+import org.eclipse.app4mc.amalthea.model.ProcessingUnit;
+import org.eclipse.app4mc.amalthea.model.Task;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMAllocation;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMCore;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMEdge;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMTask;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMUtil;
+import org.junit.Test;
+
+public class OMUtilTest {
+
+ @Test
+ public void testGetCoreTaskMap() {
+ ProcessingUnit c1= AmaltheaFactory.eINSTANCE.createProcessingUnit();
+ c1.setName("Core1");
+ OMCore omc1 = new OMCore(c1);
+
+ ProcessingUnit c2= AmaltheaFactory.eINSTANCE.createProcessingUnit();
+ c2.setName("Core2");
+ OMCore omc2 = new OMCore(c2);
+
+ Task t1_c1= createTask("T1_CORE1");
+ Task t2_c1= createTask("T2_CORE1");
+ Task t3_c1= createTask("T3_CORE1");
+
+ Task t1_c2= createTask("T1_CORE2");
+ Task t2_c2= createTask("T2_CORE2");
+
+ List<OMAllocation> allocs= new LinkedList<>();
+ allocs.add(new OMAllocation(new OMTask(t1_c1), omc1));
+ allocs.add(new OMAllocation(new OMTask(t2_c1), omc1));
+ allocs.add(new OMAllocation(new OMTask(t3_c1), omc1));
+ allocs.add(new OMAllocation(new OMTask(t1_c2), omc2));
+ allocs.add(new OMAllocation(new OMTask(t2_c2), omc2));
+
+ assertEquals(new OMCore(c1), new OMCore(c1));
+
+
+ Map<OMCore,List<OMTask>> map = OMUtil.getCoreTaskMap(allocs);
+
+ assertEquals(map.keySet().size(),2);
+
+
+
+ boolean checkedC1=false;
+ boolean checkedC2=false;
+
+
+
+ for(OMCore c: map.keySet()){
+ if(c.getCoreRef()==c1){
+ List<OMTask> tasks = map.get(c);
+ assertEquals(3, tasks.size());
+ assertEquals("T1_CORE1",tasks.get(0).getTaskRef().getName());
+ assertEquals("T2_CORE1",tasks.get(1).getTaskRef().getName());
+ assertEquals("T3_CORE1",tasks.get(2).getTaskRef().getName());
+ checkedC1=true;
+ }else if (c.getCoreRef().getName().equals("Core2")){
+ List<OMTask> tasks = map.get(c);
+ assertEquals(2, tasks.size());
+ assertEquals("T1_CORE2",tasks.get(0).getTaskRef().getName());
+ assertEquals("T2_CORE2",tasks.get(1).getTaskRef().getName());
+ checkedC2=true;
+ }else{
+ assertTrue(false);
+ }
+ }
+
+ assertTrue(checkedC1);
+ assertTrue(checkedC2);
+
+
+
+ }
+ private static Task createTask(String name){
+ Task t = AmaltheaFactory.eINSTANCE.createTask();
+ t.setName(name);
+ return t;
+ }
+
+
+ @Test
+ public void testIsDAG(){
+ List<OMEdge> list =new LinkedList<>();
+
+ OMTask a= new OMTask(null);
+ OMTask b=new OMTask(null);
+ OMTask c=new OMTask(null);
+
+ list.add(new OMEdge(a,b, 0,0));
+ list.add(new OMEdge(a, c, 0,0));
+ list.add(new OMEdge(b, c, 0,0));
+
+ assertTrue(OMUtil.isDAG(list));
+
+ OMTask d=new OMTask(null);
+
+ list.add(new OMEdge(d, a, 0,0));
+ assertTrue(OMUtil.isDAG(list));
+
+ list.add(new OMEdge(c, d, 0,0));
+
+ assertFalse(OMUtil.isDAG(list));
+
+ }
+
+
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/CooperativeSchedullerTest.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/CooperativeSchedullerTest.java
index 8981ebd1..51af1f1c 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/CooperativeSchedullerTest.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/CooperativeSchedullerTest.java
@@ -1,66 +1,66 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.test;
-
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTask;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskHistState;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.SchedulerException;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.algo.CooperativeEDFAlgo;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core.StepScheduler;
-import org.junit.Test;
-
-public class CooperativeSchedullerTest {
-
- int[][] example1_edf_1_core_t1_42 = { { 2, 5 }, { 15, 18 }, { 32, 35 } };
- int[][] example1_edf_1_core_t2_42 =
- { { 0, 2 }, { 7, 9 }, { 12, 14 }, { 18, 20 }, { 24, 26 }, { 30, 32 },{ 36, 38 } };
- int[][] example1_edf_1_core_t3_42 = { { 5, 7 }, { 22, 24 } };
-
- @Test
- public void test_example1_edf_1_core() throws SchedulerException {
- StepScheduler s = new StepScheduler(new CooperativeEDFAlgo());
-
- SimpleEMTaskTracer tracer = new SimpleEMTaskTracer("TestCore");
- s.addSchedulerEventListener(tracer);
-// s.addOSHookListener(new ConsoleSchedulerTracer("TestCore"));
-
- s.addTask("T1", 3, 15);
- s.addTask("T2", 2, 6);
- s.addTask("T3", 2, 22);
-
- s.init();
- for(int i = 0;i<=42;i++){
- s.runTaskOrIdleStep();
- s.updateTaskSynchronisation();
- s.updateTaskSet();
- }
-
- Map<String, EMTask> result = tracer.getEMTasks();
-
- List<EMTaskHistState> t1 = result.get("T1").getStateHistory();
- TestUtil.testTaskHistoryRunningStates(example1_edf_1_core_t1_42, t1);
-
- List<EMTaskHistState> t2 = result.get("T2").getStateHistory();
- TestUtil.testTaskHistoryRunningStates(example1_edf_1_core_t2_42, t2);
-
- List<EMTaskHistState> t3 = result.get("T3").getStateHistory();
- TestUtil.testTaskHistoryRunningStates(example1_edf_1_core_t3_42, t3);
- }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.test;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTask;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskHistState;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.SchedulerException;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.algo.CooperativeEDFAlgo;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core.StepScheduler;
+import org.junit.Test;
+
+public class CooperativeSchedullerTest {
+
+ int[][] example1_edf_1_core_t1_42 = { { 2, 5 }, { 15, 18 }, { 32, 35 } };
+ int[][] example1_edf_1_core_t2_42 =
+ { { 0, 2 }, { 7, 9 }, { 12, 14 }, { 18, 20 }, { 24, 26 }, { 30, 32 },{ 36, 38 } };
+ int[][] example1_edf_1_core_t3_42 = { { 5, 7 }, { 22, 24 } };
+
+ @Test
+ public void test_example1_edf_1_core() throws SchedulerException {
+ StepScheduler s = new StepScheduler(new CooperativeEDFAlgo());
+
+ SimpleEMTaskTracer tracer = new SimpleEMTaskTracer("TestCore");
+ s.addSchedulerEventListener(tracer);
+// s.addOSHookListener(new ConsoleSchedulerTracer("TestCore"));
+
+ s.addTask("T1", 3, 15);
+ s.addTask("T2", 2, 6);
+ s.addTask("T3", 2, 22);
+
+ s.init();
+ for(int i = 0;i<=42;i++){
+ s.runTaskOrIdleStep();
+ s.updateTaskSynchronisation();
+ s.updateTaskSet();
+ }
+
+ Map<String, EMTask> result = tracer.getEMTasks();
+
+ List<EMTaskHistState> t1 = result.get("T1").getStateHistory();
+ TestUtil.testTaskHistoryRunningStates(example1_edf_1_core_t1_42, t1);
+
+ List<EMTaskHistState> t2 = result.get("T2").getStateHistory();
+ TestUtil.testTaskHistoryRunningStates(example1_edf_1_core_t2_42, t2);
+
+ List<EMTaskHistState> t3 = result.get("T3").getStateHistory();
+ TestUtil.testTaskHistoryRunningStates(example1_edf_1_core_t3_42, t3);
+ }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/PreemptiveRMSTest.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/PreemptiveRMSTest.java
index 76993fbd..596b4e8d 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/PreemptiveRMSTest.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/PreemptiveRMSTest.java
@@ -1,127 +1,127 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.test;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTask;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskHistState;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.IStepScheduler;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.SchedulerAlgorithmRegister;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.SchedulerException;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core.StepScheduler;
-import org.junit.Test;
-
-public class PreemptiveRMSTest {
-
- int[][] example2_rms_1_core_t1_38 =
- { { 2, 5 }, { 15, 18 }, { 32, 35 }};
-
- int[][] example2_rms_1_core_t2_38 =
- { { 0, 2 }, { 6, 8 }, { 12, 14 }, { 18, 20 }, { 24, 26 } , { 30, 32 }, { 36, 38 } };
-
- int[][] example2_rms_1_core_t3_38 =
- { { 5, 6 }, { 8, 12 }, { 14, 15 }, { 20, 21 }, { 22, 24 }, { 26, 30 }, { 35, 36 } };
-
-// @Test
-// public void test_example2_rms_1_core() throws SchedulerException {
-//
-// StepScheduler s = SchedulerAlgorithmFactory.createPreemptiveRMSScheduler();
-// SimpleEMTaskTracer tracer = new SimpleEMTaskTracer("TestCore");
-// s.addOSHookListener(tracer);
-//// s.addListener(new ConsoleSchedulerTracer());
-//
-// SchedulerTask t = new SchedulerTask("T1", 3, 15);
-// s.addTask(t);
-// t = new SchedulerTask("T2", 2, 6);
-// s.addTask(t);
-// t = new SchedulerTask("T3", 7, 22);
-// s.addTask(t);
-//
-// s.init();
-// s.scheduleUntil(38);
-//
-// Map<String, EMTask> result = tracer.getEMTasks();
-//
-// List<EMTaskHistState> t1 = result.get("T1").getHistory();
-// TestUtil.testTaskHistoryRunningStates(example2_rms_1_core_t1_38, t1);
-//
-// List<EMTaskHistState> t2 = result.get("T2").getHistory();
-// TestUtil.testTaskHistoryRunningStates(example2_rms_1_core_t2_38, t2);
-//
-// List<EMTaskHistState> t3 = result.get("T3").getHistory();
-// TestUtil.testTaskHistoryRunningStates(example2_rms_1_core_t3_38, t3);
-// }
-
- @Test
- public void test_example2_rms_1_core_single_steps() throws SchedulerException {
-
- IStepScheduler s = new StepScheduler(SchedulerAlgorithmRegister.createPreemptiveRMS());
-
- SimpleEMTaskTracer tracer = new SimpleEMTaskTracer("TestCore");
- s.addSchedulerEventListener(tracer);
-// s.addSchedulerEventListener(new ConsoleSchedulerTracer("TestCore"));
-
- s.addTask("T1", 3, 15);
- s.addTask("T2", 2, 6);
- s.addTask("T3", 7, 22);
-
- s.init();
- for(int i =0; i<38;i++){
- s.runTaskOrIdleStep();
- s.updateTaskSynchronisation();
- s.updateTaskSet();
- }
- assertEquals(38, s.getSimTime());
-
- Map<String, EMTask> result = tracer.getEMTasks();
-
- List<EMTaskHistState> t1 = result.get("T1").getStateHistory();
- TestUtil.testTaskHistoryRunningStates(example2_rms_1_core_t1_38, t1);
-
- List<EMTaskHistState> t2 = result.get("T2").getStateHistory();
- TestUtil.testTaskHistoryRunningStates(example2_rms_1_core_t2_38, t2);
-
- List<EMTaskHistState> t3 = result.get("T3").getStateHistory();
- TestUtil.testTaskHistoryRunningStates(example2_rms_1_core_t3_38, t3);
- }
-
-// @Test
-// public void test_example5_rms_1_core_single_steps(){
-// StepScheduler s = new StepScheduler(SchedulerAlgorithmRegister.createPreemptiveRMS());
-//
-// SimpleEMTaskTracer tracer = new SimpleEMTaskTracer("TestCore");
-// s.addSchedulerEventListener(tracer);
-// s.addSchedulerEventListener(new ConsoleSchedulerTracer("TestCore"));
-//
-// SchedulerTask t = new SchedulerTask("T1", 3, 15);
-// s.addTask(t);
-// t = new SchedulerTask("T2", 2, 6);
-// s.addTask(t);
-// t = new SchedulerTask("T3", 9, 22);
-// s.addTask(t);
-//
-// s.init();
-// for(int i =0; i<38;i++){
-// s.runTaskOrIdleStep();
-// s.updateTaskSynchronisation();
-//// s.updateTaskSet();
-// }
-// }
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.test;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTask;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskHistState;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.IStepScheduler;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.SchedulerAlgorithmRegister;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.SchedulerException;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core.StepScheduler;
+import org.junit.Test;
+
+public class PreemptiveRMSTest {
+
+ int[][] example2_rms_1_core_t1_38 =
+ { { 2, 5 }, { 15, 18 }, { 32, 35 }};
+
+ int[][] example2_rms_1_core_t2_38 =
+ { { 0, 2 }, { 6, 8 }, { 12, 14 }, { 18, 20 }, { 24, 26 } , { 30, 32 }, { 36, 38 } };
+
+ int[][] example2_rms_1_core_t3_38 =
+ { { 5, 6 }, { 8, 12 }, { 14, 15 }, { 20, 21 }, { 22, 24 }, { 26, 30 }, { 35, 36 } };
+
+// @Test
+// public void test_example2_rms_1_core() throws SchedulerException {
+//
+// StepScheduler s = SchedulerAlgorithmFactory.createPreemptiveRMSScheduler();
+// SimpleEMTaskTracer tracer = new SimpleEMTaskTracer("TestCore");
+// s.addOSHookListener(tracer);
+//// s.addListener(new ConsoleSchedulerTracer());
+//
+// SchedulerTask t = new SchedulerTask("T1", 3, 15);
+// s.addTask(t);
+// t = new SchedulerTask("T2", 2, 6);
+// s.addTask(t);
+// t = new SchedulerTask("T3", 7, 22);
+// s.addTask(t);
+//
+// s.init();
+// s.scheduleUntil(38);
+//
+// Map<String, EMTask> result = tracer.getEMTasks();
+//
+// List<EMTaskHistState> t1 = result.get("T1").getHistory();
+// TestUtil.testTaskHistoryRunningStates(example2_rms_1_core_t1_38, t1);
+//
+// List<EMTaskHistState> t2 = result.get("T2").getHistory();
+// TestUtil.testTaskHistoryRunningStates(example2_rms_1_core_t2_38, t2);
+//
+// List<EMTaskHistState> t3 = result.get("T3").getHistory();
+// TestUtil.testTaskHistoryRunningStates(example2_rms_1_core_t3_38, t3);
+// }
+
+ @Test
+ public void test_example2_rms_1_core_single_steps() throws SchedulerException {
+
+ IStepScheduler s = new StepScheduler(SchedulerAlgorithmRegister.createPreemptiveRMS());
+
+ SimpleEMTaskTracer tracer = new SimpleEMTaskTracer("TestCore");
+ s.addSchedulerEventListener(tracer);
+// s.addSchedulerEventListener(new ConsoleSchedulerTracer("TestCore"));
+
+ s.addTask("T1", 3, 15);
+ s.addTask("T2", 2, 6);
+ s.addTask("T3", 7, 22);
+
+ s.init();
+ for(int i =0; i<38;i++){
+ s.runTaskOrIdleStep();
+ s.updateTaskSynchronisation();
+ s.updateTaskSet();
+ }
+ assertEquals(38, s.getSimTime());
+
+ Map<String, EMTask> result = tracer.getEMTasks();
+
+ List<EMTaskHistState> t1 = result.get("T1").getStateHistory();
+ TestUtil.testTaskHistoryRunningStates(example2_rms_1_core_t1_38, t1);
+
+ List<EMTaskHistState> t2 = result.get("T2").getStateHistory();
+ TestUtil.testTaskHistoryRunningStates(example2_rms_1_core_t2_38, t2);
+
+ List<EMTaskHistState> t3 = result.get("T3").getStateHistory();
+ TestUtil.testTaskHistoryRunningStates(example2_rms_1_core_t3_38, t3);
+ }
+
+// @Test
+// public void test_example5_rms_1_core_single_steps(){
+// StepScheduler s = new StepScheduler(SchedulerAlgorithmRegister.createPreemptiveRMS());
+//
+// SimpleEMTaskTracer tracer = new SimpleEMTaskTracer("TestCore");
+// s.addSchedulerEventListener(tracer);
+// s.addSchedulerEventListener(new ConsoleSchedulerTracer("TestCore"));
+//
+// SchedulerTask t = new SchedulerTask("T1", 3, 15);
+// s.addTask(t);
+// t = new SchedulerTask("T2", 2, 6);
+// s.addTask(t);
+// t = new SchedulerTask("T3", 9, 22);
+// s.addTask(t);
+//
+// s.init();
+// for(int i =0; i<38;i++){
+// s.runTaskOrIdleStep();
+// s.updateTaskSynchronisation();
+//// s.updateTaskSet();
+// }
+// }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/SimpleEMTaskTracer.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/SimpleEMTaskTracer.java
index 09d663bf..b11ed8da 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/SimpleEMTaskTracer.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/SimpleEMTaskTracer.java
@@ -1,120 +1,120 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.test;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMCore;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTask;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskHistState;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskState;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskHistState.EMTaskHistStateFactory;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerEventListener;
-/**
- * Logs only running states into Execution Model tasks.
- */
-public class SimpleEMTaskTracer implements ISchedulerEventListener{
-
- private final Map<String,EMTask> tasks;
- private final EMCore core;
-
- private EMTaskHistState currentRunning;
-
- public SimpleEMTaskTracer(String corename) {
- core = new EMCore(corename);
- tasks=new HashMap<>();
- }
- public SimpleEMTaskTracer(Map<String,EMTask> tasks,EMCore c){
- this.core = c;
- this.tasks=tasks;
- }
-
-
- @Override
- public void onTaskAdded(String taskName) {
- tasks.put(taskName,new EMTask(taskName));
- }
-
- @Override
- public void onActivateTask(String task, long time) {
- }
-
- @Override
- public void onStartTask(String task, long time) {
- currentRunning = EMTaskHistStateFactory.create(EMTaskState.RUNNING, core);
- currentRunning.setEventSource(task);
- currentRunning.setStart(time);
- }
-
- @Override
- public void onTerminateTask(String task, long time) {
- currentRunning.setEnd(time);
- tasks.get(task).getStateHistory().add(currentRunning);
- currentRunning = null;
- }
-
- @Override
- public void onPreemptTask(String task, long time) {
- currentRunning.setEnd(time);
- tasks.get(task).getStateHistory().add(currentRunning);
- currentRunning = null;
- }
-
-
- @Override
- public void onStartIdleCore(long time) {
-
- }
-
- @Override
- public void onStopIdleCore(long time) {
-
- }
-
- public Map<String, EMTask> getEMTasks() {
- return tasks;
- }
- @Override
- public void onWaitTask(String task, long time, String muxName, String holder) {
- currentRunning.setEnd(time);
- tasks.get(task).getStateHistory().add(currentRunning);
- currentRunning = null;
- }
-
- @Override
- public void onReleaseTask(String task, long time) {
- }
-
- @Override
- public void onTaskMissedDeadline(String task, long time, long remainingExectime) {
- if(currentRunning!=null && currentRunning.getEventSource()==task){
- currentRunning.setEnd(time);
- tasks.get(task).getStateHistory().add(currentRunning);
- currentRunning = null;
- }
- }
-
- @Override
- public String getCoreName() {
- return core.getName();
- }
-
-
-
-
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMCore;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTask;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskHistState;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskState;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskHistState.EMTaskHistStateFactory;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerEventListener;
+/**
+ * Logs only running states into Execution Model tasks.
+ */
+public class SimpleEMTaskTracer implements ISchedulerEventListener{
+
+ private final Map<String,EMTask> tasks;
+ private final EMCore core;
+
+ private EMTaskHistState currentRunning;
+
+ public SimpleEMTaskTracer(String corename) {
+ core = new EMCore(corename);
+ tasks=new HashMap<>();
+ }
+ public SimpleEMTaskTracer(Map<String,EMTask> tasks,EMCore c){
+ this.core = c;
+ this.tasks=tasks;
+ }
+
+
+ @Override
+ public void onTaskAdded(String taskName) {
+ tasks.put(taskName,new EMTask(taskName));
+ }
+
+ @Override
+ public void onActivateTask(String task, long time) {
+ }
+
+ @Override
+ public void onStartTask(String task, long time) {
+ currentRunning = EMTaskHistStateFactory.create(EMTaskState.RUNNING, core);
+ currentRunning.setEventSource(task);
+ currentRunning.setStart(time);
+ }
+
+ @Override
+ public void onTerminateTask(String task, long time) {
+ currentRunning.setEnd(time);
+ tasks.get(task).getStateHistory().add(currentRunning);
+ currentRunning = null;
+ }
+
+ @Override
+ public void onPreemptTask(String task, long time) {
+ currentRunning.setEnd(time);
+ tasks.get(task).getStateHistory().add(currentRunning);
+ currentRunning = null;
+ }
+
+
+ @Override
+ public void onStartIdleCore(long time) {
+
+ }
+
+ @Override
+ public void onStopIdleCore(long time) {
+
+ }
+
+ public Map<String, EMTask> getEMTasks() {
+ return tasks;
+ }
+ @Override
+ public void onWaitTask(String task, long time, String muxName, String holder) {
+ currentRunning.setEnd(time);
+ tasks.get(task).getStateHistory().add(currentRunning);
+ currentRunning = null;
+ }
+
+ @Override
+ public void onReleaseTask(String task, long time) {
+ }
+
+ @Override
+ public void onTaskMissedDeadline(String task, long time, long remainingExectime) {
+ if(currentRunning!=null && currentRunning.getEventSource()==task){
+ currentRunning.setEnd(time);
+ tasks.get(task).getStateHistory().add(currentRunning);
+ currentRunning = null;
+ }
+ }
+
+ @Override
+ public String getCoreName() {
+ return core.getName();
+ }
+
+
+
+
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/StepSchedulerTest.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/StepSchedulerTest.java
index 8bfb9e50..2daced54 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/StepSchedulerTest.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/StepSchedulerTest.java
@@ -1,295 +1,295 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.test;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTask;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskHistState;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerTask;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.IStepScheduler;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.SchedulerAlgorithmRegister;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core.Barrier;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core.StepScheduler;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.tracing.ConsoleSchedulerTracer;
-import org.junit.Test;
-
-public class StepSchedulerTest {
- int[][] example2_rms_1_core_t1_38 = { { 2, 5 }, { 15, 18 }, { 32, 35 } };
-
- int[][] example2_rms_1_core_t2_38 = { { 0, 2 }, { 6, 8 }, { 12, 14 }, { 18, 20 }, { 24, 26 }, { 30, 32 },
- { 36, 38 } };
-
- int[][] example2_rms_1_core_t3_38 = { { 5, 6 }, { 8, 12 }, { 14, 15 }, { 20, 21 }, { 22, 24 }, { 26, 30 },
- { 35, 36 } };
-
- // @Test
- // public void testNormale() throws SchedulerException{
- //
- //
- // StepScheduler sched= new StepScheduler(new PreemptiveRMSAlgo());
- //
- // SimpleEMTaskTracer tracer = new SimpleEMTaskTracer("TestCore");
- // sched.addOSHookListener(tracer);
- //// sched.addOSHookListener(new ConsoleSchedulerTracer("TestCore"));
- //
- //
- // SchedulerTask t = new SchedulerTask("T1", 3, 15);
- // sched.addTask(t);
- // t = new SchedulerTask("T2", 2, 6);
- // sched.addTask(t);
- // t = new SchedulerTask("T3", 7, 22);
- // sched.addTask(t);
- //
- // for(int i = 0; i<=38;i++){
- // sched.update();
- // sched.timeStep();
- // }
- // sched.update();
- //
- //
- // Map<String, EMTask> result = tracer.getEMTasks();
- //
- // List<EMTaskHistState> t1 = result.get("T1").getHistory();
- // TestUtil.testTaskHistoryRunningStates(example2_rms_1_core_t1_38, t1);
- //
- // List<EMTaskHistState> t2 = result.get("T2").getHistory();
- // TestUtil.testTaskHistoryRunningStates(example2_rms_1_core_t2_38, t2);
- //
- // List<EMTaskHistState> t3 = result.get("T3").getHistory();
- // TestUtil.testTaskHistoryRunningStates(example2_rms_1_core_t3_38, t3);
- //
- // }
-
- int[][] example4_edf_3_core_c1t1_30 = { { 4, 6 }, { 8, 9 }, { 17, 18 }, { 20, 22 } };
- int[][] example4_edf_3_core_c1t2_30 = { { 0, 2 }, { 6, 8 }, { 12, 14 }, { 18, 20 }, { 24, 26 } };
- int[][] example4_edf_3_core_c1t3_30 = { { 2, 4 }, { 15, 17 } };
-
- int[][] example4_edf_3_core_c2t1_30 = { { 0, 2 }, { 5, 7 }, { 10, 12 }, { 15, 17 }, { 20, 22 }, { 25, 27 } };
- int[][] example4_edf_3_core_c2t2_30 = { { 9, 10 }, { 12, 15 }, { 22, 25 }, { 27, 28 } };
-
- @Test
- public void testTaskPrecedenceScheduling() {
-
- Map<String, IStepScheduler> schedulers = new HashMap<>();
-
- /* setup cores */
- schedulers.put("C1", new StepScheduler(SchedulerAlgorithmRegister.createPreemptiveEDF()));
- schedulers.put("C2", new StepScheduler(SchedulerAlgorithmRegister.createPreemptiveEDF()));
-
- /* add listener */
- SimpleEMTaskTracer c1tracer = new SimpleEMTaskTracer("C1");
- schedulers.get("C1").addSchedulerEventListener(c1tracer);
- schedulers.get("C1").addSchedulerEventListener(new ConsoleSchedulerTracer("C1"));
- SimpleEMTaskTracer c2tracer = new SimpleEMTaskTracer("C2");
- schedulers.get("C2").addSchedulerEventListener(c2tracer);
- schedulers.get("C2").addSchedulerEventListener(new ConsoleSchedulerTracer("C2"));
-
- /* Setup tasks */
- schedulers.get("C1").addTask("C1T1", 3, 15);
- schedulers.get("C1").addTask("C1T2", 2, 6);
- schedulers.get("C1").addTask("C1T3", 2, 15);
-
- schedulers.get("C2").addTask("C2T1", 2, 5);
- schedulers.get("C2").addTask("C2T2", 4, 15);
-
- /* Setup precedence */
- // C1T3 have to be executed before C1T1
- Barrier m1 = new Barrier();
- ISchedulerTask s = schedulers.get("C1").getTask("C1T3");
- s.addOwnedBarrier(m1, ISchedulerTask.BARRIER_UNLOCK_AT_SUSPENSION);
- s = schedulers.get("C1").getTask("C1T1");
- s.addDependentBarrier(m1);
- // C1T1 have to be executed before C2T2 (other core/scheduler)
- Barrier m2 = new Barrier();
- s = schedulers.get("C1").getTask("C1T1");
- s.addOwnedBarrier(m2, ISchedulerTask.BARRIER_UNLOCK_AT_SUSPENSION);
- s = schedulers.get("C2").getTask("C2T2");
- s.addDependentBarrier(m2);
-
- schedulers.values().forEach(IStepScheduler::init);
- for (int i = 0; i <= 30; i++) {
- schedulers.values().forEach(IStepScheduler::runTaskOrIdleStep);
- schedulers.values().forEach(IStepScheduler::updateTaskSynchronisation);
- schedulers.values().forEach(IStepScheduler::updateTaskSet);
- }
-
- Map<String, EMTask> result = c1tracer.getEMTasks();
-
- List<EMTaskHistState> c1t1 = result.get("C1T1").getStateHistory();
- TestUtil.testTaskHistoryRunningStates(example4_edf_3_core_c1t1_30, c1t1);
-
- List<EMTaskHistState> c1t2 = result.get("C1T2").getStateHistory();
- TestUtil.testTaskHistoryRunningStates(example4_edf_3_core_c1t2_30, c1t2);
-
- List<EMTaskHistState> c1t3 = result.get("C1T3").getStateHistory();
- TestUtil.testTaskHistoryRunningStates(example4_edf_3_core_c1t3_30, c1t3);
-
- result = c2tracer.getEMTasks();
-
- List<EMTaskHistState> c2t1 = result.get("C2T1").getStateHistory();
- TestUtil.testTaskHistoryRunningStates(example4_edf_3_core_c2t1_30, c2t1);
-
- List<EMTaskHistState> c2t2 = result.get("C2T2").getStateHistory();
- TestUtil.testTaskHistoryRunningStates(example4_edf_3_core_c2t2_30, c2t2);
- }
-
- @Test
- public void testSchedulerChaining() {
-
- IStepScheduler c1 = new StepScheduler(SchedulerAlgorithmRegister.createPreemptiveEDF());
- IStepScheduler c2 = new StepScheduler(SchedulerAlgorithmRegister.createPreemptiveEDF());
- /* setup cores */
-
- /* add listener */
- SimpleEMTaskTracer c1tracer = new SimpleEMTaskTracer("C1");
- c1.addSchedulerEventListener(c1tracer);
- c1.addSchedulerEventListener(new ConsoleSchedulerTracer("C1"));
- SimpleEMTaskTracer c2tracer = new SimpleEMTaskTracer("C2");
- c2.addSchedulerEventListener(c2tracer);
- c2.addSchedulerEventListener(new ConsoleSchedulerTracer("C2"));
-
- /* Setup tasks */
- c1.addTask("C1T1", 3, 15);
- c1.addTask("C1T2", 2, 6);
- c1.addTask("C1T3", 2, 15);
-
- c2.addTask("C2T1", 2, 5);
- c2.addTask("C2T2", 4, 15);
-
- /* Setup precedence */
- // C1T3 have to be executed before C1T1
- Barrier m1 = new Barrier();
- ISchedulerTask s = c1.getTask("C1T3");
- s.addOwnedBarrier(m1, ISchedulerTask.BARRIER_UNLOCK_AT_SUSPENSION);
- s = c1.getTask("C1T1");
- s.addDependentBarrier(m1);
- // C1T1 have to be executed before C2T2 (other core/scheduler)
- Barrier m2 = new Barrier();
- s = c1.getTask("C1T1");
- s.addOwnedBarrier(m2, ISchedulerTask.BARRIER_UNLOCK_AT_SUSPENSION);
- s = c2.getTask("C2T2");
- s.addDependentBarrier(m2);
-
- c1.init();
- c2.init();
- for (int i = 0; i <= 30; i++) {
- c2.runTaskOrIdleStep();
- c1.runTaskOrIdleStep();
-
- c1.updateTaskSynchronisation();
- c2.updateTaskSynchronisation();
-
-
- c2.updateTaskSet();
- c1.updateTaskSet();
-
- }
-
- Map<String, EMTask> result = c1tracer.getEMTasks();
-
- List<EMTaskHistState> c1t1 = result.get("C1T1").getStateHistory();
- TestUtil.testTaskHistoryRunningStates(example4_edf_3_core_c1t1_30, c1t1);
-
- List<EMTaskHistState> c1t2 = result.get("C1T2").getStateHistory();
- TestUtil.testTaskHistoryRunningStates(example4_edf_3_core_c1t2_30, c1t2);
-
- List<EMTaskHistState> c1t3 = result.get("C1T3").getStateHistory();
- TestUtil.testTaskHistoryRunningStates(example4_edf_3_core_c1t3_30, c1t3);
-
- result = c2tracer.getEMTasks();
-
- List<EMTaskHistState> c2t1 = result.get("C2T1").getStateHistory();
- TestUtil.testTaskHistoryRunningStates(example4_edf_3_core_c2t1_30, c2t1);
-
- List<EMTaskHistState> c2t2 = result.get("C2T2").getStateHistory();
- TestUtil.testTaskHistoryRunningStates(example4_edf_3_core_c2t2_30, c2t2);
- }
-
- int[][] example5_edf_3_core_c1t1_30 = { { 4, 6 }, { 8, 9 }, { 17, 18 }, { 20, 22 } };
- int[][] example5_edf_3_core_c1t2_30 = { { 0, 2 }, { 6, 8 }, { 12, 14 }, { 18, 20 }, { 24, 26 } };
- int[][] example5_edf_3_core_c1t3_30 = { { 2, 4 }, { 15, 17 } };
-
- int[][] example5_edf_3_core_c2t1_30 = { { 0, 2 }, { 5, 7 }, { 10, 12 }, { 15, 17 }, { 20, 22 }, { 25, 27 } };
- int[][] example5_edf_3_core_c2t2_30 = { { 7, 10 }, { 12, 13 }, { 18, 20 }, { 22, 24 } };
-
- @Test
- public void testTaskPrecedenceSchedulingExtended() {
-// Map<String, IStepScheduler> schedulers = new HashMap<>();
-//
-// /* setup cores */
-// schedulers.put("C1", new StepScheduler(SchedulerAlgorithmRegister.createPreemptiveEDF()));
-// schedulers.put("C2", new StepScheduler(SchedulerAlgorithmRegister.createPreemptiveEDF()));
-//
-// /* add listener */
-// SimpleEMTaskTracer c1tracer = new SimpleEMTaskTracer("C1");
-// schedulers.get("C1").addSchedulerEventListener(c1tracer);
-// schedulers.get("C1").addSchedulerEventListener(new ConsoleSchedulerTracer("C1"));
-// SimpleEMTaskTracer c2tracer = new SimpleEMTaskTracer("C2");
-// schedulers.get("C2").addSchedulerEventListener(c2tracer);
-// schedulers.get("C2").addSchedulerEventListener(new ConsoleSchedulerTracer("C2"));
-//
-// /* Setup tasks */
-// schedulers.get("C1").addTask("C1T1", 3, 15);
-// schedulers.get("C1").addTask("C1T2", 2, 6);
-// schedulers.get("C1").addTask("C1T3", 2, 15);
-//
-// schedulers.get("C2").addTask("C2T1", 2, 5);
-// schedulers.get("C2").addTask("C2T2", 4, 15);
-//
-// /* Setup precedence */
-// // C1T3 have to be executed before C1T1
-// Barrier m1 = new Barrier();
-// ISchedulerTask s = schedulers.get("C1").getTask("C1T3");
-// s.addOwnedBarrier(m1, ISchedulerTask.BARRIER_UNLOCK_AT_SUSPENSION);
-// s = schedulers.get("C1").getTask("C1T1");
-// s.addDependentBarrier(m1);
-// // C1T1 have to be executed before C2T2 (other core/scheduler)
-// Barrier m2 = new Barrier();
-// s = schedulers.get("C1").getTask("C1T1");
-// s.addOwnedBarrier(m2, 1); //difference
-// s = schedulers.get("C2").getTask("C2T2");
-// s.addDependentBarrier(m2);
-//
-// schedulers.values().forEach(IStepScheduler::init);
-// for (int i = 0; i <= 30; i++) {
-// schedulers.values().forEach(IStepScheduler::runTaskOrIdleStep);
-// schedulers.values().forEach(IStepScheduler::updateTaskSynchronisation);
-// schedulers.values().forEach(IStepScheduler::updateTaskSet);
-// }
-//
-// Map<String, EMTask> result = c1tracer.getEMTasks();
-//
-// List<EMTaskHistState> c1t1 = result.get("C1T1").getStateHistory();
-// TestUtil.testTaskHistoryRunningStates(example5_edf_3_core_c1t1_30, c1t1);
-//
-// List<EMTaskHistState> c1t2 = result.get("C1T2").getStateHistory();
-// TestUtil.testTaskHistoryRunningStates(example5_edf_3_core_c1t2_30, c1t2);
-//
-// List<EMTaskHistState> c1t3 = result.get("C1T3").getStateHistory();
-// TestUtil.testTaskHistoryRunningStates(example5_edf_3_core_c1t3_30, c1t3);
-//
-// result = c2tracer.getEMTasks();
-//
-// List<EMTaskHistState> c2t1 = result.get("C2T1").getStateHistory();
-// TestUtil.testTaskHistoryRunningStates(example5_edf_3_core_c2t1_30, c2t1);
-//
-// List<EMTaskHistState> c2t2 = result.get("C2T2").getStateHistory();
-// TestUtil.testTaskHistoryRunningStates(example5_edf_3_core_c2t2_30, c2t2);
- }
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.test;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTask;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskHistState;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.ISchedulerTask;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.IStepScheduler;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.SchedulerAlgorithmRegister;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core.Barrier;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.core.StepScheduler;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.tracing.ConsoleSchedulerTracer;
+import org.junit.Test;
+
+public class StepSchedulerTest {
+ int[][] example2_rms_1_core_t1_38 = { { 2, 5 }, { 15, 18 }, { 32, 35 } };
+
+ int[][] example2_rms_1_core_t2_38 = { { 0, 2 }, { 6, 8 }, { 12, 14 }, { 18, 20 }, { 24, 26 }, { 30, 32 },
+ { 36, 38 } };
+
+ int[][] example2_rms_1_core_t3_38 = { { 5, 6 }, { 8, 12 }, { 14, 15 }, { 20, 21 }, { 22, 24 }, { 26, 30 },
+ { 35, 36 } };
+
+ // @Test
+ // public void testNormale() throws SchedulerException{
+ //
+ //
+ // StepScheduler sched= new StepScheduler(new PreemptiveRMSAlgo());
+ //
+ // SimpleEMTaskTracer tracer = new SimpleEMTaskTracer("TestCore");
+ // sched.addOSHookListener(tracer);
+ //// sched.addOSHookListener(new ConsoleSchedulerTracer("TestCore"));
+ //
+ //
+ // SchedulerTask t = new SchedulerTask("T1", 3, 15);
+ // sched.addTask(t);
+ // t = new SchedulerTask("T2", 2, 6);
+ // sched.addTask(t);
+ // t = new SchedulerTask("T3", 7, 22);
+ // sched.addTask(t);
+ //
+ // for(int i = 0; i<=38;i++){
+ // sched.update();
+ // sched.timeStep();
+ // }
+ // sched.update();
+ //
+ //
+ // Map<String, EMTask> result = tracer.getEMTasks();
+ //
+ // List<EMTaskHistState> t1 = result.get("T1").getHistory();
+ // TestUtil.testTaskHistoryRunningStates(example2_rms_1_core_t1_38, t1);
+ //
+ // List<EMTaskHistState> t2 = result.get("T2").getHistory();
+ // TestUtil.testTaskHistoryRunningStates(example2_rms_1_core_t2_38, t2);
+ //
+ // List<EMTaskHistState> t3 = result.get("T3").getHistory();
+ // TestUtil.testTaskHistoryRunningStates(example2_rms_1_core_t3_38, t3);
+ //
+ // }
+
+ int[][] example4_edf_3_core_c1t1_30 = { { 4, 6 }, { 8, 9 }, { 17, 18 }, { 20, 22 } };
+ int[][] example4_edf_3_core_c1t2_30 = { { 0, 2 }, { 6, 8 }, { 12, 14 }, { 18, 20 }, { 24, 26 } };
+ int[][] example4_edf_3_core_c1t3_30 = { { 2, 4 }, { 15, 17 } };
+
+ int[][] example4_edf_3_core_c2t1_30 = { { 0, 2 }, { 5, 7 }, { 10, 12 }, { 15, 17 }, { 20, 22 }, { 25, 27 } };
+ int[][] example4_edf_3_core_c2t2_30 = { { 9, 10 }, { 12, 15 }, { 22, 25 }, { 27, 28 } };
+
+ @Test
+ public void testTaskPrecedenceScheduling() {
+
+ Map<String, IStepScheduler> schedulers = new HashMap<>();
+
+ /* setup cores */
+ schedulers.put("C1", new StepScheduler(SchedulerAlgorithmRegister.createPreemptiveEDF()));
+ schedulers.put("C2", new StepScheduler(SchedulerAlgorithmRegister.createPreemptiveEDF()));
+
+ /* add listener */
+ SimpleEMTaskTracer c1tracer = new SimpleEMTaskTracer("C1");
+ schedulers.get("C1").addSchedulerEventListener(c1tracer);
+ schedulers.get("C1").addSchedulerEventListener(new ConsoleSchedulerTracer("C1"));
+ SimpleEMTaskTracer c2tracer = new SimpleEMTaskTracer("C2");
+ schedulers.get("C2").addSchedulerEventListener(c2tracer);
+ schedulers.get("C2").addSchedulerEventListener(new ConsoleSchedulerTracer("C2"));
+
+ /* Setup tasks */
+ schedulers.get("C1").addTask("C1T1", 3, 15);
+ schedulers.get("C1").addTask("C1T2", 2, 6);
+ schedulers.get("C1").addTask("C1T3", 2, 15);
+
+ schedulers.get("C2").addTask("C2T1", 2, 5);
+ schedulers.get("C2").addTask("C2T2", 4, 15);
+
+ /* Setup precedence */
+ // C1T3 have to be executed before C1T1
+ Barrier m1 = new Barrier();
+ ISchedulerTask s = schedulers.get("C1").getTask("C1T3");
+ s.addOwnedBarrier(m1, ISchedulerTask.BARRIER_UNLOCK_AT_SUSPENSION);
+ s = schedulers.get("C1").getTask("C1T1");
+ s.addDependentBarrier(m1);
+ // C1T1 have to be executed before C2T2 (other core/scheduler)
+ Barrier m2 = new Barrier();
+ s = schedulers.get("C1").getTask("C1T1");
+ s.addOwnedBarrier(m2, ISchedulerTask.BARRIER_UNLOCK_AT_SUSPENSION);
+ s = schedulers.get("C2").getTask("C2T2");
+ s.addDependentBarrier(m2);
+
+ schedulers.values().forEach(IStepScheduler::init);
+ for (int i = 0; i <= 30; i++) {
+ schedulers.values().forEach(IStepScheduler::runTaskOrIdleStep);
+ schedulers.values().forEach(IStepScheduler::updateTaskSynchronisation);
+ schedulers.values().forEach(IStepScheduler::updateTaskSet);
+ }
+
+ Map<String, EMTask> result = c1tracer.getEMTasks();
+
+ List<EMTaskHistState> c1t1 = result.get("C1T1").getStateHistory();
+ TestUtil.testTaskHistoryRunningStates(example4_edf_3_core_c1t1_30, c1t1);
+
+ List<EMTaskHistState> c1t2 = result.get("C1T2").getStateHistory();
+ TestUtil.testTaskHistoryRunningStates(example4_edf_3_core_c1t2_30, c1t2);
+
+ List<EMTaskHistState> c1t3 = result.get("C1T3").getStateHistory();
+ TestUtil.testTaskHistoryRunningStates(example4_edf_3_core_c1t3_30, c1t3);
+
+ result = c2tracer.getEMTasks();
+
+ List<EMTaskHistState> c2t1 = result.get("C2T1").getStateHistory();
+ TestUtil.testTaskHistoryRunningStates(example4_edf_3_core_c2t1_30, c2t1);
+
+ List<EMTaskHistState> c2t2 = result.get("C2T2").getStateHistory();
+ TestUtil.testTaskHistoryRunningStates(example4_edf_3_core_c2t2_30, c2t2);
+ }
+
+ @Test
+ public void testSchedulerChaining() {
+
+ IStepScheduler c1 = new StepScheduler(SchedulerAlgorithmRegister.createPreemptiveEDF());
+ IStepScheduler c2 = new StepScheduler(SchedulerAlgorithmRegister.createPreemptiveEDF());
+ /* setup cores */
+
+ /* add listener */
+ SimpleEMTaskTracer c1tracer = new SimpleEMTaskTracer("C1");
+ c1.addSchedulerEventListener(c1tracer);
+ c1.addSchedulerEventListener(new ConsoleSchedulerTracer("C1"));
+ SimpleEMTaskTracer c2tracer = new SimpleEMTaskTracer("C2");
+ c2.addSchedulerEventListener(c2tracer);
+ c2.addSchedulerEventListener(new ConsoleSchedulerTracer("C2"));
+
+ /* Setup tasks */
+ c1.addTask("C1T1", 3, 15);
+ c1.addTask("C1T2", 2, 6);
+ c1.addTask("C1T3", 2, 15);
+
+ c2.addTask("C2T1", 2, 5);
+ c2.addTask("C2T2", 4, 15);
+
+ /* Setup precedence */
+ // C1T3 have to be executed before C1T1
+ Barrier m1 = new Barrier();
+ ISchedulerTask s = c1.getTask("C1T3");
+ s.addOwnedBarrier(m1, ISchedulerTask.BARRIER_UNLOCK_AT_SUSPENSION);
+ s = c1.getTask("C1T1");
+ s.addDependentBarrier(m1);
+ // C1T1 have to be executed before C2T2 (other core/scheduler)
+ Barrier m2 = new Barrier();
+ s = c1.getTask("C1T1");
+ s.addOwnedBarrier(m2, ISchedulerTask.BARRIER_UNLOCK_AT_SUSPENSION);
+ s = c2.getTask("C2T2");
+ s.addDependentBarrier(m2);
+
+ c1.init();
+ c2.init();
+ for (int i = 0; i <= 30; i++) {
+ c2.runTaskOrIdleStep();
+ c1.runTaskOrIdleStep();
+
+ c1.updateTaskSynchronisation();
+ c2.updateTaskSynchronisation();
+
+
+ c2.updateTaskSet();
+ c1.updateTaskSet();
+
+ }
+
+ Map<String, EMTask> result = c1tracer.getEMTasks();
+
+ List<EMTaskHistState> c1t1 = result.get("C1T1").getStateHistory();
+ TestUtil.testTaskHistoryRunningStates(example4_edf_3_core_c1t1_30, c1t1);
+
+ List<EMTaskHistState> c1t2 = result.get("C1T2").getStateHistory();
+ TestUtil.testTaskHistoryRunningStates(example4_edf_3_core_c1t2_30, c1t2);
+
+ List<EMTaskHistState> c1t3 = result.get("C1T3").getStateHistory();
+ TestUtil.testTaskHistoryRunningStates(example4_edf_3_core_c1t3_30, c1t3);
+
+ result = c2tracer.getEMTasks();
+
+ List<EMTaskHistState> c2t1 = result.get("C2T1").getStateHistory();
+ TestUtil.testTaskHistoryRunningStates(example4_edf_3_core_c2t1_30, c2t1);
+
+ List<EMTaskHistState> c2t2 = result.get("C2T2").getStateHistory();
+ TestUtil.testTaskHistoryRunningStates(example4_edf_3_core_c2t2_30, c2t2);
+ }
+
+ int[][] example5_edf_3_core_c1t1_30 = { { 4, 6 }, { 8, 9 }, { 17, 18 }, { 20, 22 } };
+ int[][] example5_edf_3_core_c1t2_30 = { { 0, 2 }, { 6, 8 }, { 12, 14 }, { 18, 20 }, { 24, 26 } };
+ int[][] example5_edf_3_core_c1t3_30 = { { 2, 4 }, { 15, 17 } };
+
+ int[][] example5_edf_3_core_c2t1_30 = { { 0, 2 }, { 5, 7 }, { 10, 12 }, { 15, 17 }, { 20, 22 }, { 25, 27 } };
+ int[][] example5_edf_3_core_c2t2_30 = { { 7, 10 }, { 12, 13 }, { 18, 20 }, { 22, 24 } };
+
+ @Test
+ public void testTaskPrecedenceSchedulingExtended() {
+// Map<String, IStepScheduler> schedulers = new HashMap<>();
+//
+// /* setup cores */
+// schedulers.put("C1", new StepScheduler(SchedulerAlgorithmRegister.createPreemptiveEDF()));
+// schedulers.put("C2", new StepScheduler(SchedulerAlgorithmRegister.createPreemptiveEDF()));
+//
+// /* add listener */
+// SimpleEMTaskTracer c1tracer = new SimpleEMTaskTracer("C1");
+// schedulers.get("C1").addSchedulerEventListener(c1tracer);
+// schedulers.get("C1").addSchedulerEventListener(new ConsoleSchedulerTracer("C1"));
+// SimpleEMTaskTracer c2tracer = new SimpleEMTaskTracer("C2");
+// schedulers.get("C2").addSchedulerEventListener(c2tracer);
+// schedulers.get("C2").addSchedulerEventListener(new ConsoleSchedulerTracer("C2"));
+//
+// /* Setup tasks */
+// schedulers.get("C1").addTask("C1T1", 3, 15);
+// schedulers.get("C1").addTask("C1T2", 2, 6);
+// schedulers.get("C1").addTask("C1T3", 2, 15);
+//
+// schedulers.get("C2").addTask("C2T1", 2, 5);
+// schedulers.get("C2").addTask("C2T2", 4, 15);
+//
+// /* Setup precedence */
+// // C1T3 have to be executed before C1T1
+// Barrier m1 = new Barrier();
+// ISchedulerTask s = schedulers.get("C1").getTask("C1T3");
+// s.addOwnedBarrier(m1, ISchedulerTask.BARRIER_UNLOCK_AT_SUSPENSION);
+// s = schedulers.get("C1").getTask("C1T1");
+// s.addDependentBarrier(m1);
+// // C1T1 have to be executed before C2T2 (other core/scheduler)
+// Barrier m2 = new Barrier();
+// s = schedulers.get("C1").getTask("C1T1");
+// s.addOwnedBarrier(m2, 1); //difference
+// s = schedulers.get("C2").getTask("C2T2");
+// s.addDependentBarrier(m2);
+//
+// schedulers.values().forEach(IStepScheduler::init);
+// for (int i = 0; i <= 30; i++) {
+// schedulers.values().forEach(IStepScheduler::runTaskOrIdleStep);
+// schedulers.values().forEach(IStepScheduler::updateTaskSynchronisation);
+// schedulers.values().forEach(IStepScheduler::updateTaskSet);
+// }
+//
+// Map<String, EMTask> result = c1tracer.getEMTasks();
+//
+// List<EMTaskHistState> c1t1 = result.get("C1T1").getStateHistory();
+// TestUtil.testTaskHistoryRunningStates(example5_edf_3_core_c1t1_30, c1t1);
+//
+// List<EMTaskHistState> c1t2 = result.get("C1T2").getStateHistory();
+// TestUtil.testTaskHistoryRunningStates(example5_edf_3_core_c1t2_30, c1t2);
+//
+// List<EMTaskHistState> c1t3 = result.get("C1T3").getStateHistory();
+// TestUtil.testTaskHistoryRunningStates(example5_edf_3_core_c1t3_30, c1t3);
+//
+// result = c2tracer.getEMTasks();
+//
+// List<EMTaskHistState> c2t1 = result.get("C2T1").getStateHistory();
+// TestUtil.testTaskHistoryRunningStates(example5_edf_3_core_c2t1_30, c2t1);
+//
+// List<EMTaskHistState> c2t2 = result.get("C2T2").getStateHistory();
+// TestUtil.testTaskHistoryRunningStates(example5_edf_3_core_c2t2_30, c2t2);
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/TestUtil.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/TestUtil.java
index 0b1295d5..27c7dba5 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/TestUtil.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/scheduler/test/TestUtil.java
@@ -1,44 +1,44 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.test;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskHistState;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskState;
-
-public class TestUtil {
- public static void testTaskHistoryRunningStates(int[][] runstates,List<EMTaskHistState> hist){
-
- //filter all running states with duration greater zero
- //and known past and known future
- hist = hist.stream().filter(x->{
- return x.getState()==EMTaskState.RUNNING &&
- x.isCompleted() &&
- (x.getEnd()-x.getStart())>0;
- }).collect(Collectors.toList());
-
- assertEquals(runstates.length, hist.size());
-
- for(int i = 0; i < hist.size();i++){
- assertEquals(runstates[i][0], hist.get(i).getStart());
- assertEquals(runstates[i][1], hist.get(i).getEnd());
- }
- }
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.test;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskHistState;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.types.EMTaskState;
+
+public class TestUtil {
+ public static void testTaskHistoryRunningStates(int[][] runstates,List<EMTaskHistState> hist){
+
+ //filter all running states with duration greater zero
+ //and known past and known future
+ hist = hist.stream().filter(x->{
+ return x.getState()==EMTaskState.RUNNING &&
+ x.isCompleted() &&
+ (x.getEnd()-x.getStart())>0;
+ }).collect(Collectors.toList());
+
+ assertEquals(runstates.length, hist.size());
+
+ for(int i = 0; i < hist.size();i++){
+ assertEquals(runstates[i][0], hist.get(i).getStart());
+ assertEquals(runstates[i][1], hist.get(i).getEnd());
+ }
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/test/MulticorePrecedenceSimulation.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/test/MulticorePrecedenceSimulation.java
index 788786e4..e5b963a1 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/test/MulticorePrecedenceSimulation.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/test/MulticorePrecedenceSimulation.java
@@ -1,93 +1,93 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.test;
-
-import static org.junit.Assert.assertEquals;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.ExecutionModel;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.ISystemProxy;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.SimException;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.SystemProxyFactory;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.SchedulerAlgorithmRegister;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.tracing.ConsoleSchedulerTracer;
-import org.junit.Test;
-
-public class MulticorePrecedenceSimulation {
-
- int[][] example4_edf_3_core_c1t1_30 = { { 4, 6 }, { 8, 9 }, { 17, 18 }, { 20, 22 } };
- int[][] example4_edf_3_core_c1t2_30 = { { 0, 2 }, { 6, 8 }, { 12, 14 }, { 18, 20 }, { 24, 26 } };
- int[][] example4_edf_3_core_c1t3_30 = { { 2, 4 }, { 15, 17 } };
-
- int[][] example4_edf_3_core_c2t1_30 = { { 0, 2 }, { 5, 7 }, { 10, 12 }, { 15, 17 }, { 20, 22 }, { 25, 27 } };
- int[][] example4_edf_3_core_c2t2_30 = { { 9, 10 }, { 12, 15 }, { 22, 25 }, { 27, 28 } };
-
- @Test
- public void test() throws SimException {
- ExecutionModel m = new ExecutionModel();
- ISystemProxy sim = SystemProxyFactory.createEMSystemProxy(1, SchedulerAlgorithmRegister::createPreemptiveEDF, m);
- /*Setup tasks*/
- sim.addCoreScheduler("C1");
- sim.addTask("C1", "C1T1", 3, 15);
- sim.addTask("C1", "C1T2", 2, 6);
- sim.addTask("C1", "C1T3", 2, 15);
-
- sim.addCoreScheduler("C2");
- sim.addTask("C2","C2T1", 2, 5);
- sim.addTask("C2","C2T2", 4,15);
-
- /*Setup precedence*/
- sim.addTaskPrecedence("C1","C1T3", "C1", "C1T1"); //C1T3 have to be executed before C1T1
- sim.addTaskPrecedence("C1","C1T1", "C2", "C2T2"); //C1T1 have to be executed before C2T2 (other core/scheduler)
-
- sim.addListener("C1", new ConsoleSchedulerTracer("C1"));
- sim.addListener("C2", new ConsoleSchedulerTracer("C2"));
- sim.compute(30);
-
- assertEquals(m.getCores().size(),2);
- }
-
- class XX{
- public XX(String x){
-
- }
- }
-
-
-// public void wasget(){
-// Supplier<ISchedulerAlgorithm> c;
-// c= ()-> new PreemptiveEDFAlgo();
-// c= new Supplier<ISchedulerAlgorithm>() {
-// @Override
-// public ISchedulerAlgorithm get() {
-// return null;
-// }
-// };
-//
-// Function<String,XX> func;
-// func=XX::new;
-//
-// func.apply("~Aloha~");
-//
-// Consumer<String> test= MulticorePrecedenceSimulation::getData;
-//
-// test.accept("HI");
-// }
-//
-// public static String getData(String d){
-// //do something
-// return "go";
-// }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.test;
+
+import static org.junit.Assert.assertEquals;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.ExecutionModel;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.ISystemProxy;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.SimException;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.SystemProxyFactory;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.SchedulerAlgorithmRegister;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.tracing.ConsoleSchedulerTracer;
+import org.junit.Test;
+
+public class MulticorePrecedenceSimulation {
+
+ int[][] example4_edf_3_core_c1t1_30 = { { 4, 6 }, { 8, 9 }, { 17, 18 }, { 20, 22 } };
+ int[][] example4_edf_3_core_c1t2_30 = { { 0, 2 }, { 6, 8 }, { 12, 14 }, { 18, 20 }, { 24, 26 } };
+ int[][] example4_edf_3_core_c1t3_30 = { { 2, 4 }, { 15, 17 } };
+
+ int[][] example4_edf_3_core_c2t1_30 = { { 0, 2 }, { 5, 7 }, { 10, 12 }, { 15, 17 }, { 20, 22 }, { 25, 27 } };
+ int[][] example4_edf_3_core_c2t2_30 = { { 9, 10 }, { 12, 15 }, { 22, 25 }, { 27, 28 } };
+
+ @Test
+ public void test() throws SimException {
+ ExecutionModel m = new ExecutionModel();
+ ISystemProxy sim = SystemProxyFactory.createEMSystemProxy(1, SchedulerAlgorithmRegister::createPreemptiveEDF, m);
+ /*Setup tasks*/
+ sim.addCoreScheduler("C1");
+ sim.addTask("C1", "C1T1", 3, 15);
+ sim.addTask("C1", "C1T2", 2, 6);
+ sim.addTask("C1", "C1T3", 2, 15);
+
+ sim.addCoreScheduler("C2");
+ sim.addTask("C2","C2T1", 2, 5);
+ sim.addTask("C2","C2T2", 4,15);
+
+ /*Setup precedence*/
+ sim.addTaskPrecedence("C1","C1T3", "C1", "C1T1"); //C1T3 have to be executed before C1T1
+ sim.addTaskPrecedence("C1","C1T1", "C2", "C2T2"); //C1T1 have to be executed before C2T2 (other core/scheduler)
+
+ sim.addListener("C1", new ConsoleSchedulerTracer("C1"));
+ sim.addListener("C2", new ConsoleSchedulerTracer("C2"));
+ sim.compute(30);
+
+ assertEquals(m.getCores().size(),2);
+ }
+
+ class XX{
+ public XX(String x){
+
+ }
+ }
+
+
+// public void wasget(){
+// Supplier<ISchedulerAlgorithm> c;
+// c= ()-> new PreemptiveEDFAlgo();
+// c= new Supplier<ISchedulerAlgorithm>() {
+// @Override
+// public ISchedulerAlgorithm get() {
+// return null;
+// }
+// };
+//
+// Function<String,XX> func;
+// func=XX::new;
+//
+// func.apply("~Aloha~");
+//
+// Consumer<String> test= MulticorePrecedenceSimulation::getData;
+//
+// test.accept("HI");
+// }
+//
+// public static String getData(String d){
+// //do something
+// return "go";
+// }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/test/PerformanceTest.java b/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/test/PerformanceTest.java
index 599c799a..afe26020 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/test/PerformanceTest.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.logic/test/org/eclipse/app4mc/multicore/execution/logic/systemproxy/test/PerformanceTest.java
@@ -1,355 +1,355 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.logic.systemproxy.test;
-
-import java.lang.reflect.Field;
-
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.ISystemProxy;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.SimException;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.SystemProxyFactory;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.multicoresystem.MultiCoreSystem;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.SchedulerAlgorithmRegister;
-import org.junit.Test;
-
-public class PerformanceTest {
-
- private static final long PS_PER_MS = 1000L*1000L*1000L;
-
- private static final String[] CORES = {"cog 0", "cog 1","cog 3", "cog 7"};
-
- private static final int RUNS_FOR_AVARAGE = 5;
-
-// @Test
- public void testCooperativeTaskVisualization() throws SimException {
-// System.err.println("START testCooperativeTaskVisualization");
-// ISystemProxy s = SystemProxyFactory.createSystemProxy(1000,SchedulerAlgorithmFactory::createCooperativeEDF);
-// addCores(s);
-// addTasks(s);
-// long start = System.currentTimeMillis();
-// s.compute(100*PS_PER_MS);//100 ms
-// System.err.println("Time: "+ (System.currentTimeMillis()-start) +" ms");
- }
-
-// @Test
- public void testPreemptiveTaskVisualizationPS() throws SimException {
- System.err.println("START testPreemptiveTaskVisualizationPS");
- ISystemProxy s = SystemProxyFactory.createSystemProxy(ISystemProxy.TIME_SCALE_PS,
- SchedulerAlgorithmRegister::createPreemptiveEDF);
- addCores(s);
- addTasks(s);
- long start = System.currentTimeMillis();
- s.compute(500*PS_PER_MS); //0.5 s
- long duration = System.currentTimeMillis()-start; //(02.12.16: took 100s)
- System.err.println("Time: "+ duration +" ms");
- }
-
- /*1 ms*/
-
-// @Test
- public void testPreemptiveTaskVisualization_1ms_ps() throws SimException {
- System.err.println("Performance-Test: 1ms, scale ps");
- long duration = simulateAsynch(1*PS_PER_MS,ISystemProxy.TIME_SCALE_PS);
- System.err.println("Time: "+ duration +" ms");
- }
-// @Test
- public void testPreemptiveTaskVisualization_1ms_ps_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
- System.err.println("Performance-Test: 1ms, scale ps, intetercore");
- long duration = simulateInterCore(1*PS_PER_MS,ISystemProxy.TIME_SCALE_PS);
- System.err.println("Time: "+ duration +" ms");
- }
-
-// @Test
- public void testPreemptiveTaskVisualization_1ms_ns() throws SimException {
- System.err.println("Performance-Test: 1ms, scale ns");
- long duration = simulateAsynch(1*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
- System.err.println("Time: "+ duration +" ms");
- }
-// @Test
- public void testPreemptiveTaskVisualization_1ms_ns_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
- System.err.println("Performance-Test: 1ms, scale ns, intetercore");
- long duration = simulateInterCore(1*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
- System.err.println("Time: "+ duration +" ms");
- }
-
-// @Test
- public void testPreemptiveTaskVisualization_1ms_us() throws SimException {
- System.err.println("Performance-Test: 1ms, scale us");
- long duration = simulateAsynch(1*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
- System.err.println("Time: "+ duration +" ms");
- }
-// @Test
- public void testPreemptiveTaskVisualization_1ms_us_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
- System.err.println("Performance-Test: 1ms, scale us, intetercore");
- long duration = simulateInterCore(1*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
- System.err.println("Time: "+ duration +" ms");
- }
-
-
- /*10 ms*/
-// @Test
- public void testPreemptiveTaskVisualization_10ms_ps() throws SimException {
- System.err.println("Performance-Test: 10ms, scale ps");
- long duration = simulateAsynch(10*PS_PER_MS,ISystemProxy.TIME_SCALE_PS);
- System.err.println("Time: "+ duration +" ms");
- }
-// @Test
- public void testPreemptiveTaskVisualization_10ms_ps_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
- System.err.println("Performance-Test: 10ms, scale ps, intetercore");
- long duration = simulateInterCore(10*PS_PER_MS,ISystemProxy.TIME_SCALE_PS);
- System.err.println("Time: "+ duration +" ms");
- }
-
-// @Test
- public void testPreemptiveTaskVisualization_10ms_ns() throws SimException {
- System.err.println("Performance-Test: 10ms, scale ns");
- long duration = simulateAsynch(10*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
- System.err.println("Time: "+ duration +" ms");
- }
-// @Test
- public void testPreemptiveTaskVisualization_10ms_ns_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
- System.err.println("Performance-Test: 10ms, scale ns, intetercore");
- long duration = simulateInterCore(10*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
- System.err.println("Time: "+ duration +" ms");
- }
-
-// @Test
- public void testPreemptiveTaskVisualization_10ms_us() throws SimException {
- System.err.println("Performance-Test: 10ms, scale us");
- long duration = simulateAsynch(10*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
- System.err.println("Time: "+ duration +" ms");
- }
-// @Test
- public void testPreemptiveTaskVisualization_10ms_us_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
- System.err.println("Performance-Test: 10ms, scale us, intetercore");
- long duration = simulateInterCore(10*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
- System.err.println("Time: "+ duration +" ms");
- }
-
- /*100 ms*/
-// not managabele: approx. core i5 4x2.5 GHz: 80.000 s => 22,2 h per run
-// @Test
-// public void testPreemptiveTaskVisualization_100ms_ps() throws SimulatorException {
-// System.err.println("Performance-Test: 100ms, scale ps");
-// long duration = simulateAsynch(100*PS_PER_MS,ISystemProxy.TIME_SCALE_PS);
-// System.err.println("Time: "+ duration +" ms");
-// }
-// @Test
-// public void testPreemptiveTaskVisualization_100ms_ps_intercore() throws SimulatorException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
-// System.err.println("Performance-Test: 10ms, scale ps, intetercore");
-// long duration = simulateInterCore(100*PS_PER_MS,ISystemProxy.TIME_SCALE_PS);
-// System.err.println("Time: "+ duration +" ms");
-// }
-
-// @Test
- public void testPreemptiveTaskVisualization_100ms_ns() throws SimException {
- System.err.println("Performance-Test: 100ms, scale ns");
- long duration = simulateAsynch(100*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
- System.err.println("Time: "+ duration +" ms");
- }
-// @Test
- public void testPreemptiveTaskVisualization_100ms_ns_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
- System.err.println("Performance-Test: 100ms, scale ns, intetercore");
- long duration = simulateInterCore(100*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
- System.err.println("Time: "+ duration +" ms");
- }
-
-// @Test
- public void testPreemptiveTaskVisualization_100ms_us() throws SimException {
- System.err.println("Performance-Test: 100ms, scale us");
- long duration = simulateAsynch(100*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
- System.err.println("Time: "+ duration +" ms");
- }
- @Test
- public void testPreemptiveTaskVisualization_100ms_us_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
- System.err.println("Performance-Test: 100ms, scale us, intetercore");
- long duration = simulateInterCore(100*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
- System.err.println("Time: "+ duration +" ms");
- }
-
- /*500 ms*/
-
-// @Test
- public void testPreemptiveTaskVisualization_05s_ns() throws SimException {
- System.err.println("Performance-Test: 0.5s, scale ns");
- long duration = simulateAsynch(500*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
- System.err.println("Time: "+ duration +" ms");
- }
-// @Test
- public void testPreemptiveTaskVisualization_05s_ns_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
- System.err.println("Performance-Test: 0.5s, scale ns, intetercore");
- long duration = simulateInterCore(500*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
- System.err.println("Time: "+ duration +" ms");
- }
-
-// @Test
- public void testPreemptiveTaskVisualization_05s_us() throws SimException {
- System.err.println("Performance-Test: 0,5s, scale us");
- long duration = simulateAsynch(500*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
- System.err.println("Time: "+ duration +" ms");
- }
-// @Test
- public void testPreemptiveTaskVisualization_05s_us_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
- System.err.println("Performance-Test: 0,5s, scale us, intetercore");
- long duration = simulateInterCore(500*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
- System.err.println("Time: "+ duration +" ms");
- }
-
- /*1000ms*/
-
-// @Test
- public void testPreemptiveTaskVisualization_1s_ns() throws SimException {
- System.err.println("Performance-Test: 1s, scale ns");
- long duration = simulateAsynch(1000*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
- System.err.println("Time: "+ duration +" ms");
- }
-// @Test
- public void testPreemptiveTaskVisualization_1s_ns_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
- System.err.println("Performance-Test: 1s, scale ns, intetercore");
- long duration = simulateInterCore(1000*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
- System.err.println("Time: "+ duration +" ms");
- }
-
-// @Test
- public void testPreemptiveTaskVisualization_1s_us() throws SimException {
- System.err.println("Performance-Test: 1s, scale us");
- long duration = simulateAsynch(1000*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
- System.err.println("Time: "+ duration +" ms");
- }
-// @Test
- public void testPreemptiveTaskVisualization_1s_us_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
- System.err.println("Performance-Test: 1s, scale us, intetercore");
- long duration = simulateInterCore(1000*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
- System.err.println("Time: "+ duration +" ms");
- }
-
- /*2000ms*/
-// @Test
- public void testPreemptiveTaskVisualization_2s_ns() throws SimException {
- System.err.println("Performance-Test: 2s, scale ns");
- long duration = simulateAsynch(2000*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
- System.err.println("Time: "+ duration +" ms");
- }
-// @Test
- public void testPreemptiveTaskVisualization_2s_ns_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
- System.err.println("Performance-Test: 2s, scale ns, intetercore");
- long duration = simulateInterCore(2000*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
- System.err.println("Time: "+ duration +" ms");
- }
-
-// @Test
- public void testPreemptiveTaskVisualization_2s_us() throws SimException {
- System.err.println("Performance-Test: 2s, scale us");
- long duration = simulateAsynch(2000*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
- System.err.println("Time: "+ duration +" ms");
- }
-// @Test
- public void testPreemptiveTaskVisualization_2s_us_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
- System.err.println("Performance-Test: 2s, scale us, intetercore");
- long duration = simulateInterCore(2000*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
- System.err.println("Time: "+ duration +" ms");
- }
-
-
-
- private long simulateAsynch(long time, long scale) throws SimException{
- long simtime=0;
-
- for(int i=0;i<RUNS_FOR_AVARAGE;i++){
- ISystemProxy s = SystemProxyFactory.createSystemProxy(scale,
- SchedulerAlgorithmRegister::createPreemptiveEDF);
- simtime+=sim(s,time,scale);
- }
- return simtime/RUNS_FOR_AVARAGE;
- }
-
- private long simulateInterCore(long time, long scale) throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException{
-
- long simtime=0;
-
- for(int i=0;i<RUNS_FOR_AVARAGE;i++){
- MultiCoreSystem s =(MultiCoreSystem)SystemProxyFactory.createSystemProxy(scale,
- SchedulerAlgorithmRegister::createPreemptiveEDF);
- Field f = MultiCoreSystem.class.getDeclaredField("interCoreSynch");
- f.setAccessible(true);
- f.set(s,true);
- simtime+=sim(s,time,scale);
- }
-
- return simtime/RUNS_FOR_AVARAGE;
- }
-
- private long sim(ISystemProxy s, long time, long scale) throws SimException{
- addCores(s);
- addTasks(s);
- long start = System.currentTimeMillis();
- s.compute(time); //0,5s
- return System.currentTimeMillis()-start;
- }
-
-
- private static void addCores(ISystemProxy s) {
- for(String core: CORES){
- s.addCoreScheduler(core);
-// s.addListener(core, new ConsoleSchedulerTracer("ConTrace "+core));
-// FileSchedulerTracer t = new FileSchedulerTracer(SIMNAME, "scheduling_trace_core_"+core+".txt");
-
- }
- }
- private static void addTasks(ISystemProxy s) {
- s.addTask(CORES[0], "Task_ESSP0", 400003500000L, 402000000000L);
- s.addTask(CORES[1], "Task_ESSP4", 10129333333L, 12000000000L);
- s.addTask(CORES[2], "Task_ESSP3", 132279083333L, 220000000000L);
- s.addTask(CORES[2], "Task_ESSP2", 20000833333L, 201000000000L);
- s.addTask(CORES[3], "Task_ESSP5", 133334333333L, 201000000000L);
- s.addTask(CORES[3], "Task_ESSP1", 40071583333L, 125000000000L);
- }
-
-
-
-// public void test(){
-// Supplier<ISchedulerAlgorithm> c;
-//
-// //Point to constructor of concrete class
-// c= PreemptiveEDFAlgo::new;
-// ISchedulerAlgorithm a1= c.get();
-// //Point to static method
-// c=SimulatorTest::createStatic;
-// ISchedulerAlgorithm a2 = c.get();
-// //Point to object member method
-// c=this::createMember;
-// ISchedulerAlgorithm a3 = c.get();
-//
-// c = ()->new PreemptiveEDFAlgo();
-// //<=>
-// c = new Supplier<ISchedulerAlgorithm>(){
-// @Override
-// public ISchedulerAlgorithm get() {
-// return new PreemptiveEDFAlgo();
-// }
-// };
-// }
-//
-//
-// private ISchedulerAlgorithm createMember(){
-// return new PreemptiveEDFAlgo();
-// }
-//
-// private static ISchedulerAlgorithm createStatic(){
-// return new PreemptiveEDFAlgo();
-// }
-
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.logic.systemproxy.test;
+
+import java.lang.reflect.Field;
+
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.ISystemProxy;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.SimException;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.SystemProxyFactory;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.multicoresystem.MultiCoreSystem;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.SchedulerAlgorithmRegister;
+import org.junit.Test;
+
+public class PerformanceTest {
+
+ private static final long PS_PER_MS = 1000L*1000L*1000L;
+
+ private static final String[] CORES = {"cog 0", "cog 1","cog 3", "cog 7"};
+
+ private static final int RUNS_FOR_AVARAGE = 5;
+
+// @Test
+ public void testCooperativeTaskVisualization() throws SimException {
+// System.err.println("START testCooperativeTaskVisualization");
+// ISystemProxy s = SystemProxyFactory.createSystemProxy(1000,SchedulerAlgorithmFactory::createCooperativeEDF);
+// addCores(s);
+// addTasks(s);
+// long start = System.currentTimeMillis();
+// s.compute(100*PS_PER_MS);//100 ms
+// System.err.println("Time: "+ (System.currentTimeMillis()-start) +" ms");
+ }
+
+// @Test
+ public void testPreemptiveTaskVisualizationPS() throws SimException {
+ System.err.println("START testPreemptiveTaskVisualizationPS");
+ ISystemProxy s = SystemProxyFactory.createSystemProxy(ISystemProxy.TIME_SCALE_PS,
+ SchedulerAlgorithmRegister::createPreemptiveEDF);
+ addCores(s);
+ addTasks(s);
+ long start = System.currentTimeMillis();
+ s.compute(500*PS_PER_MS); //0.5 s
+ long duration = System.currentTimeMillis()-start; //(02.12.16: took 100s)
+ System.err.println("Time: "+ duration +" ms");
+ }
+
+ /*1 ms*/
+
+// @Test
+ public void testPreemptiveTaskVisualization_1ms_ps() throws SimException {
+ System.err.println("Performance-Test: 1ms, scale ps");
+ long duration = simulateAsynch(1*PS_PER_MS,ISystemProxy.TIME_SCALE_PS);
+ System.err.println("Time: "+ duration +" ms");
+ }
+// @Test
+ public void testPreemptiveTaskVisualization_1ms_ps_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
+ System.err.println("Performance-Test: 1ms, scale ps, intetercore");
+ long duration = simulateInterCore(1*PS_PER_MS,ISystemProxy.TIME_SCALE_PS);
+ System.err.println("Time: "+ duration +" ms");
+ }
+
+// @Test
+ public void testPreemptiveTaskVisualization_1ms_ns() throws SimException {
+ System.err.println("Performance-Test: 1ms, scale ns");
+ long duration = simulateAsynch(1*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
+ System.err.println("Time: "+ duration +" ms");
+ }
+// @Test
+ public void testPreemptiveTaskVisualization_1ms_ns_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
+ System.err.println("Performance-Test: 1ms, scale ns, intetercore");
+ long duration = simulateInterCore(1*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
+ System.err.println("Time: "+ duration +" ms");
+ }
+
+// @Test
+ public void testPreemptiveTaskVisualization_1ms_us() throws SimException {
+ System.err.println("Performance-Test: 1ms, scale us");
+ long duration = simulateAsynch(1*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
+ System.err.println("Time: "+ duration +" ms");
+ }
+// @Test
+ public void testPreemptiveTaskVisualization_1ms_us_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
+ System.err.println("Performance-Test: 1ms, scale us, intetercore");
+ long duration = simulateInterCore(1*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
+ System.err.println("Time: "+ duration +" ms");
+ }
+
+
+ /*10 ms*/
+// @Test
+ public void testPreemptiveTaskVisualization_10ms_ps() throws SimException {
+ System.err.println("Performance-Test: 10ms, scale ps");
+ long duration = simulateAsynch(10*PS_PER_MS,ISystemProxy.TIME_SCALE_PS);
+ System.err.println("Time: "+ duration +" ms");
+ }
+// @Test
+ public void testPreemptiveTaskVisualization_10ms_ps_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
+ System.err.println("Performance-Test: 10ms, scale ps, intetercore");
+ long duration = simulateInterCore(10*PS_PER_MS,ISystemProxy.TIME_SCALE_PS);
+ System.err.println("Time: "+ duration +" ms");
+ }
+
+// @Test
+ public void testPreemptiveTaskVisualization_10ms_ns() throws SimException {
+ System.err.println("Performance-Test: 10ms, scale ns");
+ long duration = simulateAsynch(10*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
+ System.err.println("Time: "+ duration +" ms");
+ }
+// @Test
+ public void testPreemptiveTaskVisualization_10ms_ns_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
+ System.err.println("Performance-Test: 10ms, scale ns, intetercore");
+ long duration = simulateInterCore(10*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
+ System.err.println("Time: "+ duration +" ms");
+ }
+
+// @Test
+ public void testPreemptiveTaskVisualization_10ms_us() throws SimException {
+ System.err.println("Performance-Test: 10ms, scale us");
+ long duration = simulateAsynch(10*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
+ System.err.println("Time: "+ duration +" ms");
+ }
+// @Test
+ public void testPreemptiveTaskVisualization_10ms_us_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
+ System.err.println("Performance-Test: 10ms, scale us, intetercore");
+ long duration = simulateInterCore(10*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
+ System.err.println("Time: "+ duration +" ms");
+ }
+
+ /*100 ms*/
+// not managabele: approx. core i5 4x2.5 GHz: 80.000 s => 22,2 h per run
+// @Test
+// public void testPreemptiveTaskVisualization_100ms_ps() throws SimulatorException {
+// System.err.println("Performance-Test: 100ms, scale ps");
+// long duration = simulateAsynch(100*PS_PER_MS,ISystemProxy.TIME_SCALE_PS);
+// System.err.println("Time: "+ duration +" ms");
+// }
+// @Test
+// public void testPreemptiveTaskVisualization_100ms_ps_intercore() throws SimulatorException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
+// System.err.println("Performance-Test: 10ms, scale ps, intetercore");
+// long duration = simulateInterCore(100*PS_PER_MS,ISystemProxy.TIME_SCALE_PS);
+// System.err.println("Time: "+ duration +" ms");
+// }
+
+// @Test
+ public void testPreemptiveTaskVisualization_100ms_ns() throws SimException {
+ System.err.println("Performance-Test: 100ms, scale ns");
+ long duration = simulateAsynch(100*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
+ System.err.println("Time: "+ duration +" ms");
+ }
+// @Test
+ public void testPreemptiveTaskVisualization_100ms_ns_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
+ System.err.println("Performance-Test: 100ms, scale ns, intetercore");
+ long duration = simulateInterCore(100*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
+ System.err.println("Time: "+ duration +" ms");
+ }
+
+// @Test
+ public void testPreemptiveTaskVisualization_100ms_us() throws SimException {
+ System.err.println("Performance-Test: 100ms, scale us");
+ long duration = simulateAsynch(100*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
+ System.err.println("Time: "+ duration +" ms");
+ }
+ @Test
+ public void testPreemptiveTaskVisualization_100ms_us_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
+ System.err.println("Performance-Test: 100ms, scale us, intetercore");
+ long duration = simulateInterCore(100*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
+ System.err.println("Time: "+ duration +" ms");
+ }
+
+ /*500 ms*/
+
+// @Test
+ public void testPreemptiveTaskVisualization_05s_ns() throws SimException {
+ System.err.println("Performance-Test: 0.5s, scale ns");
+ long duration = simulateAsynch(500*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
+ System.err.println("Time: "+ duration +" ms");
+ }
+// @Test
+ public void testPreemptiveTaskVisualization_05s_ns_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
+ System.err.println("Performance-Test: 0.5s, scale ns, intetercore");
+ long duration = simulateInterCore(500*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
+ System.err.println("Time: "+ duration +" ms");
+ }
+
+// @Test
+ public void testPreemptiveTaskVisualization_05s_us() throws SimException {
+ System.err.println("Performance-Test: 0,5s, scale us");
+ long duration = simulateAsynch(500*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
+ System.err.println("Time: "+ duration +" ms");
+ }
+// @Test
+ public void testPreemptiveTaskVisualization_05s_us_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
+ System.err.println("Performance-Test: 0,5s, scale us, intetercore");
+ long duration = simulateInterCore(500*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
+ System.err.println("Time: "+ duration +" ms");
+ }
+
+ /*1000ms*/
+
+// @Test
+ public void testPreemptiveTaskVisualization_1s_ns() throws SimException {
+ System.err.println("Performance-Test: 1s, scale ns");
+ long duration = simulateAsynch(1000*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
+ System.err.println("Time: "+ duration +" ms");
+ }
+// @Test
+ public void testPreemptiveTaskVisualization_1s_ns_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
+ System.err.println("Performance-Test: 1s, scale ns, intetercore");
+ long duration = simulateInterCore(1000*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
+ System.err.println("Time: "+ duration +" ms");
+ }
+
+// @Test
+ public void testPreemptiveTaskVisualization_1s_us() throws SimException {
+ System.err.println("Performance-Test: 1s, scale us");
+ long duration = simulateAsynch(1000*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
+ System.err.println("Time: "+ duration +" ms");
+ }
+// @Test
+ public void testPreemptiveTaskVisualization_1s_us_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
+ System.err.println("Performance-Test: 1s, scale us, intetercore");
+ long duration = simulateInterCore(1000*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
+ System.err.println("Time: "+ duration +" ms");
+ }
+
+ /*2000ms*/
+// @Test
+ public void testPreemptiveTaskVisualization_2s_ns() throws SimException {
+ System.err.println("Performance-Test: 2s, scale ns");
+ long duration = simulateAsynch(2000*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
+ System.err.println("Time: "+ duration +" ms");
+ }
+// @Test
+ public void testPreemptiveTaskVisualization_2s_ns_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
+ System.err.println("Performance-Test: 2s, scale ns, intetercore");
+ long duration = simulateInterCore(2000*PS_PER_MS,ISystemProxy.TIME_SCALE_NS);
+ System.err.println("Time: "+ duration +" ms");
+ }
+
+// @Test
+ public void testPreemptiveTaskVisualization_2s_us() throws SimException {
+ System.err.println("Performance-Test: 2s, scale us");
+ long duration = simulateAsynch(2000*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
+ System.err.println("Time: "+ duration +" ms");
+ }
+// @Test
+ public void testPreemptiveTaskVisualization_2s_us_intercore() throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
+ System.err.println("Performance-Test: 2s, scale us, intetercore");
+ long duration = simulateInterCore(2000*PS_PER_MS,ISystemProxy.TIME_SCALE_US);
+ System.err.println("Time: "+ duration +" ms");
+ }
+
+
+
+ private long simulateAsynch(long time, long scale) throws SimException{
+ long simtime=0;
+
+ for(int i=0;i<RUNS_FOR_AVARAGE;i++){
+ ISystemProxy s = SystemProxyFactory.createSystemProxy(scale,
+ SchedulerAlgorithmRegister::createPreemptiveEDF);
+ simtime+=sim(s,time,scale);
+ }
+ return simtime/RUNS_FOR_AVARAGE;
+ }
+
+ private long simulateInterCore(long time, long scale) throws SimException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException{
+
+ long simtime=0;
+
+ for(int i=0;i<RUNS_FOR_AVARAGE;i++){
+ MultiCoreSystem s =(MultiCoreSystem)SystemProxyFactory.createSystemProxy(scale,
+ SchedulerAlgorithmRegister::createPreemptiveEDF);
+ Field f = MultiCoreSystem.class.getDeclaredField("interCoreSynch");
+ f.setAccessible(true);
+ f.set(s,true);
+ simtime+=sim(s,time,scale);
+ }
+
+ return simtime/RUNS_FOR_AVARAGE;
+ }
+
+ private long sim(ISystemProxy s, long time, long scale) throws SimException{
+ addCores(s);
+ addTasks(s);
+ long start = System.currentTimeMillis();
+ s.compute(time); //0,5s
+ return System.currentTimeMillis()-start;
+ }
+
+
+ private static void addCores(ISystemProxy s) {
+ for(String core: CORES){
+ s.addCoreScheduler(core);
+// s.addListener(core, new ConsoleSchedulerTracer("ConTrace "+core));
+// FileSchedulerTracer t = new FileSchedulerTracer(SIMNAME, "scheduling_trace_core_"+core+".txt");
+
+ }
+ }
+ private static void addTasks(ISystemProxy s) {
+ s.addTask(CORES[0], "Task_ESSP0", 400003500000L, 402000000000L);
+ s.addTask(CORES[1], "Task_ESSP4", 10129333333L, 12000000000L);
+ s.addTask(CORES[2], "Task_ESSP3", 132279083333L, 220000000000L);
+ s.addTask(CORES[2], "Task_ESSP2", 20000833333L, 201000000000L);
+ s.addTask(CORES[3], "Task_ESSP5", 133334333333L, 201000000000L);
+ s.addTask(CORES[3], "Task_ESSP1", 40071583333L, 125000000000L);
+ }
+
+
+
+// public void test(){
+// Supplier<ISchedulerAlgorithm> c;
+//
+// //Point to constructor of concrete class
+// c= PreemptiveEDFAlgo::new;
+// ISchedulerAlgorithm a1= c.get();
+// //Point to static method
+// c=SimulatorTest::createStatic;
+// ISchedulerAlgorithm a2 = c.get();
+// //Point to object member method
+// c=this::createMember;
+// ISchedulerAlgorithm a3 = c.get();
+//
+// c = ()->new PreemptiveEDFAlgo();
+// //<=>
+// c = new Supplier<ISchedulerAlgorithm>(){
+// @Override
+// public ISchedulerAlgorithm get() {
+// return new PreemptiveEDFAlgo();
+// }
+// };
+// }
+//
+//
+// private ISchedulerAlgorithm createMember(){
+// return new PreemptiveEDFAlgo();
+// }
+//
+// private static ISchedulerAlgorithm createStatic(){
+// return new PreemptiveEDFAlgo();
+// }
+
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.model/.classpath b/plugins/org.eclipse.app4mc.multicore.execution.model/.classpath
new file mode 100644
index 00000000..eca7bdba
--- /dev/null
+++ b/plugins/org.eclipse.app4mc.multicore.execution.model/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.model/.gitignore b/plugins/org.eclipse.app4mc.multicore.execution.model/.gitignore
new file mode 100644
index 00000000..934e0e06
--- /dev/null
+++ b/plugins/org.eclipse.app4mc.multicore.execution.model/.gitignore
@@ -0,0 +1,2 @@
+/bin
+/target
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.model/.project b/plugins/org.eclipse.app4mc.multicore.execution.model/.project
new file mode 100644
index 00000000..ec8b47b6
--- /dev/null
+++ b/plugins/org.eclipse.app4mc.multicore.execution.model/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.app4mc.multicore.execution.model</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.model/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.app4mc.multicore.execution.model/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..3a215370
--- /dev/null
+++ b/plugins/org.eclipse.app4mc.multicore.execution.model/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.model/META-INF/MANIFEST.MF b/plugins/org.eclipse.app4mc.multicore.execution.model/META-INF/MANIFEST.MF
new file mode 100644
index 00000000..2dd62999
--- /dev/null
+++ b/plugins/org.eclipse.app4mc.multicore.execution.model/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: APP4MC Amalthea Java Model Converter
+Bundle-SymbolicName: org.eclipse.app4mc.multicore.execution.model
+Bundle-Version: 0.9.4.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-Vendor: Eclipse APP4MC
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.app4mc.amalthea.model,
+ org.eclipse.app4mc.multicore.execution.ui.widget;bundle-version="0.9.4"
+Automatic-Module-Name: org.eclipse.app4mc.multicore.execution.model
+Export-Package: org.eclipse.app4mc.multicore.execution.model,
+ org.eclipse.app4mc.multicore.execution.model.elements
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.model/build.properties b/plugins/org.eclipse.app4mc.multicore.execution.model/build.properties
new file mode 100644
index 00000000..abb7da6b
--- /dev/null
+++ b/plugins/org.eclipse.app4mc.multicore.execution.model/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+bin.includes = META-INF/,\
+ .,\
+ model-input/
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/XContainer.java b/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/XContainer.java
new file mode 100644
index 00000000..b28708ec
--- /dev/null
+++ b/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/XContainer.java
@@ -0,0 +1,753 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.multicore.execution.model;
+
+
+import org.eclipse.app4mc.amalthea.model.Runnable;
+import org.eclipse.app4mc.amalthea.model.*;
+import org.eclipse.app4mc.amalthea.model.util.SoftwareUtil;
+import org.eclipse.app4mc.multicore.execution.model.elements.*;
+import org.eclipse.app4mc.multicore.execution.ui.widget.gantt.elements.AbstractGanttViewElement;
+import org.eclipse.app4mc.multicore.execution.ui.widget.gantt.elements.MultysamplingViewElement;
+import org.eclipse.emf.common.util.EList;
+
+import java.lang.System;
+import java.util.*;
+import java.util.function.Consumer;
+
+
+public class XContainer
+{
+StringBuilder sb;
+private LinkedList <LinkedList <ChainElement>> globalChain;
+
+private HashMap<String,XCore> cores;
+private HashMap <String,XTasks> tasks;
+private HashMap <String,XRunnable> runnables;
+private HashMap <String,XLabel> labels;
+private HashMap <String, XScheduler> scheduler;
+private HashMap <String,XEventChain> chain;
+private boolean s1,s2,s3,s4,s5;
+private static XContainer self;
+private boolean labelView,dataFlow,mergingArrow,alternativeArrow,haveglobal;
+public boolean isRun;
+
+public static XContainer getInstance(Amalthea model){
+ if (model!=null&&self==null){
+
+ self=new XContainer(model);
+ self.isRun =true;
+ }
+ else if (model==null&&self==null){
+ self=new XContainer();
+ self.isRun=false;
+ }
+ return self;
+ }
+
+public static XContainer newInstance(){
+
+ self=new XContainer();
+ return self;
+ }
+
+public XContainer (){
+// System.out.println("Start XContainer withoud Model");
+ XUtil.writeToLog("Start XContainer withoud Model");
+}
+public XContainer (Amalthea model)
+ {
+ prepare(model);
+ }
+public void prepare(Amalthea model)
+ {
+ XUtil.writeToLog("######################"+new Date().toLocaleString()+"########################");
+ globalChain=new LinkedList<>();
+
+ runnables=new HashMap<>();
+ labels=new HashMap<>();
+ cores=new HashMap<>();
+ tasks=new HashMap<>();
+ scheduler=new HashMap<>();
+ chain=new HashMap<>();
+ s1=false;
+ s2=false;
+ s3=false;
+ s4=false;
+ s5=false;
+ haveglobal=false;
+
+
+ try {
+ addLabel(model);
+ addRunnables(model);
+ addCores(model);
+ addTasks(model);
+
+ if (s1 && s2 && s3 && s4)
+ {
+ XMappingUtil.getScaduler(model.getMappingModel(),scheduler,cores);
+ XMappingUtil.addTasks(model.getMappingModel(),scheduler,tasks);
+ if (scheduler.size()>0)
+ {
+ s5=true;
+ linkUser();
+ }
+ }
+ //XMappingUtil.printAlloc(model.getMappingModel());
+ printStatistics();
+
+ }
+ catch (Exception e)
+ {
+ System.err.println("No Software Model defined");
+ e.printStackTrace();
+ printStatistics();
+
+ }
+ }
+
+ private void linkUser()
+ {
+ Iterator <String> it=scheduler.keySet().iterator();
+ XScheduler xx;
+ while (it.hasNext())
+ {
+ xx=scheduler.get(it.next());
+ XMappingUtil.LinkTasks(xx);
+
+ chain.put(xx.getCore().getName(),new XEventChain(xx));
+
+ }
+
+ }
+private void addCores(Amalthea model)
+ {
+ HwModule hw;
+ String tmp;
+
+ Iterator <HwModule> it=
+ model.getHwModel()
+ .getStructures().get(0)
+ .getStructures().get(0)
+ .getStructures().get(0)
+ .getModules().iterator();
+ while (it.hasNext())
+ {
+ hw=it.next();
+ tmp=hw.getClass().toString();
+ tmp=tmp.substring(tmp.lastIndexOf(".")+1);
+
+
+ if (tmp.compareTo("ProcessingUnitImpl")==0)
+ {
+ // System.out.println("#######");
+ // System.out.println(hw.getName());
+ // System.out.println(tmp);
+ cores.put(hw.getName(),new XCore(hw.getName()));
+ }
+ if (cores.size()>0)
+ {
+ s3=true;
+ }
+ }
+}
+public static class ChainElement{
+
+ XLabel label;
+ LinkedList <XRunnable> read;
+ LinkedList <XRunnable> write;
+
+ @Override
+ public String toString() {
+ StringBuilder sb =new StringBuilder();
+ sb.append("\n##########"+label.getName()+"#########\n");
+ sb.append("#\n");
+
+ for (XRunnable run:write){
+ if (run.getTask()!=null){
+ sb.append("#w "+run.getTask().getName()+" - "+run.getName()+" \n");
+ }else{
+ sb.append("#w error");
+ }
+
+ }
+ for (XRunnable run:read){
+ if (run.getTask()!=null){
+ sb.append("#r "+run.getTask().getName()+" - "+run.getName()+" \n");
+ }
+ else
+ {
+ sb.append("#r error");
+ }
+
+ }
+ return sb.toString();
+ }
+ public void saveAdd(XRunnable cc,XAccess inpu){
+
+ if (inpu.getLabel().equals(label)){
+
+ if (inpu.getState()==0){
+ read.add(cc);
+ }else if (inpu.getState()==1) {
+ write.add(cc);
+ }
+
+ }
+
+ }
+ public void printElement(){
+
+ System.out.print(this.toString());
+
+ }
+ public ChainElement(XLabel label) {
+ this.label=label;
+ read=new LinkedList<>();
+ write=new LinkedList<>();
+ }
+
+ public XLabel getLabel() {
+ return label;
+ }
+
+ public LinkedList<XRunnable> getRead() {
+ return read;
+ }
+
+ public void setRead(LinkedList<XRunnable> read) {
+ this.read = read;
+ }
+
+ public LinkedList<XRunnable> getWrite() {
+ return write;
+ }
+
+ public void setWrite(LinkedList<XRunnable> write) {
+ this.write = write;
+ }
+}
+private void addTasks(Amalthea model) throws NullPointerException
+ {
+
+ if (model!=null)
+ {
+ EList <Task> pp=model.getSwModel().getTasks();
+ Iterator<Task> it=pp.iterator();
+ Task tmp;
+ XTasks xT;
+
+ while (it.hasNext())
+ {
+ tmp=it.next();
+ List <Runnable> list =SoftwareUtil.getRunnableList(tmp,null);
+ Iterator <Runnable> iterator=list.iterator();
+ Runnable run;
+ //System.out.println(tmp.getName()+" + "+list.size());
+ xT=new XTasks(tmp);
+
+ while (iterator.hasNext())
+ {
+ run=iterator.next();
+ //System.out.println(tmp.getName()+" - "+run.getName());
+ xT.addRunnable(run.getName(), runnables.get(run.getName()));
+
+ }
+ // System.out.println(xT.size());
+
+ tasks.put(tmp.getName(),xT);
+ for (String runer: xT.getMap().keySet()
+ ) {
+ xT.getMap().get(runer).setTask(xT);
+ }
+
+ }
+ if (tasks.size()>1){s4=true;}
+
+ }
+
+
+
+ }
+private void addLabel(Amalthea model) throws NullPointerException
+ {
+ if (model!=null)
+ {
+ EList <Label> pp=model.getSwModel().getLabels();
+ Iterator<Label> it=pp.iterator();
+ Label tmp;
+// SoftwareUtil.
+ while (it.hasNext())
+ {
+ tmp=it.next();
+ labels.put(tmp.getName(),new XLabel(tmp));
+ }
+ if (labels.size()>0)
+ {
+ s1=true;
+ }
+
+ }
+
+
+
+ }
+
+private void addGlobalChains(Amalthea model) throws NullPointerException {
+ if (model.getConstraintsModel().getEventChains().size()>0){
+ haveglobal=true;
+
+ for (EventChain ec:model.getConstraintsModel().getEventChains()){
+
+ globalChain.add(new LinkedList<>());
+ ec.getSegments().forEach(new Consumer<EventChainItem>() {
+ @Override
+ public void accept(EventChainItem eventChainItem) {
+
+
+ globalChain.getLast().add(new ChainElement(labels.get(eventChainItem.getEventChain().getName().substring(3))));
+
+ }
+ });
+
+ }
+
+ globalChain.forEach(xLabels -> {
+
+ //System.out.println("Chain");
+ xLabels.forEach(label->{
+ // System.out.println(label.getLabel().getName());
+ });
+
+
+ });
+
+
+
+ }
+
+}
+
+ private void addRunnables(Amalthea model) throws NullPointerException
+ {
+ if (model!=null)
+ {
+ addGlobalChains(model);
+ EList <Runnable> pp=model.getSwModel().getRunnables();
+ Iterator<Runnable> it=pp.iterator();
+ Iterator<LabelAccess> itt;
+ Runnable run;
+ LabelAccess xL;
+ XRunnable XRun;
+ String tmp;
+
+ while (it.hasNext())
+ {
+ run=it.next();
+ XRun=new XRunnable(run);
+ //System.out.println("### "+run.getName());
+ itt=SoftwareUtil.getLabelAccessList(run,null).iterator();
+ while (itt.hasNext())
+ {
+ xL=itt.next();
+ //System.out.println("#######");
+ if (labels.size()>0)
+ {
+ XAccess cici =null;
+ if (xL.getAccess().getName().compareTo("write")==0)
+ {
+ cici=XRun.addAccess(1,labels.get(xL.getData().getName()));
+ }
+ else
+ {
+ cici=XRun.addAccess(0,labels.get(xL.getData().getName()));
+ }
+
+ for (LinkedList <ChainElement> list:globalChain
+ ) {
+ for (ChainElement ce:list
+ ) {
+ ce.saveAdd(XRun,cici);
+
+ }
+ }
+ }
+ }
+ runnables.put(run.getName(),XRun);
+ }
+ if (runnables.size()>0){s2=true;}
+ }
+
+ }
+
+public String printStatistics()
+ {
+ StringBuilder sb=new StringBuilder();
+ p1(sb);
+ p2(sb);
+ short c=1;
+ for (LinkedList<ChainElement>chainElements:globalChain){
+
+ sb.append("# Chain "+c+"\n");
+ for (ChainElement element:chainElements){
+ sb.append(element.toString()+"\n");
+ }
+ c++;
+ }
+ // System.out.println(sb);
+ XUtil.writeToLog(sb.toString());
+ System.out.println(sb);
+ return (sb.toString());
+
+
+
+ }
+private void p1(StringBuilder sb)
+ {
+ sb.append("#### XContainer - Level I - Statistic ####\n");
+ sb.append("# TOTAL\n");
+ sb.append("#\n");
+ sb.append("# Cores: ");
+ sb.append(this.cores.size());
+ sb.append("\n");
+ sb.append("# Tasks: ");
+ sb.append(this.tasks.size());
+ sb.append("\n");
+ sb.append("# Runables: ");
+ sb.append(this.runnables.size());
+ sb.append("\n");
+ sb.append("# Label: ");
+ sb.append(this.labels.size());
+ sb.append("\n");
+ }
+private void p2(StringBuilder sb)
+ {
+ sb.append("#### XContainer - Level II - Statistic ####\n");
+ sb.append("# TOTAL\n");
+ sb.append("#\n");
+ sb.append("# Scheduler: ");
+ sb.append(this.scheduler.size());
+ sb.append("\n");
+ if (scheduler.size()>0){
+ Iterator <String> it=scheduler.keySet().iterator();
+ XScheduler xS;
+ while (it.hasNext())
+ {
+ xS=scheduler.get(it.next());
+ sb.append("# "+xS.getName()+": "+xS.size() +"\n");
+ }
+ }
+ sb.append("#\n");
+ sb.append("# Tasks: ");
+ sb.append(this.tasks.size());
+ sb.append("\n");
+ if (tasks.size()>0){
+ Iterator <String> it=tasks.keySet().iterator();
+ XTasks xT;
+ while (it.hasNext())
+ {
+ xT=tasks.get(it.next());
+ sb.append("# "+xT.getName()+": "+xT.size() +" l:"+xT.getConsumer().size()+"\n");
+ }
+ }
+ sb.append("#\n");
+
+ sb.append("# Runnable: ");
+ sb.append(this.runnables.size());
+ sb.append("\n");
+ int countRead=0,coundWrite=0;
+ if (runnables.size()>0){
+ Iterator <String> it=runnables.keySet().iterator();
+ Iterator <XAccess> itt;
+ XRunnable xR;
+ while (it.hasNext())
+ {
+ xR=runnables.get(it.next());
+ itt=xR.getList().iterator();
+ while (itt.hasNext())
+ {
+ if (itt.next().getState()==0)
+ {
+ countRead++;
+ }
+ else
+ {
+ coundWrite++;
+ }
+ }
+
+ }
+ }
+ sb.append("# AccessCount read:"+countRead+" write:"+coundWrite);
+ sb.append("\n");
+ sb.append("#"+validateExecutableString()+"\n");
+
+ }
+private String validateExecutableString()
+ {
+ if (s1 && s2 && s3 && s4 && s5)
+ {
+ return " Amalthea is rdy for Visualization";
+ }
+ else
+ {
+ return " !!! Warning !!! Amalthea is NOT rdy for Visualization";
+ }
+ }
+public XEventChain getChainByCore(String core)
+ {
+ return this.chain.get(core);
+ }
+public XEventElement addtoChainByCore(String taskName, String core, int status,long start, double duration)
+ {
+ XEventChain cc;
+ XEventElement element;
+ LinkedList <XEventElement> list;
+ if (chain.get(core)==null || tasks.get(taskName)==null)
+ {
+ System.err.println("LINKING ERROR");
+ }
+ else
+ {
+
+ cc=chain.get(core);
+
+
+ if (status==0)
+ {
+ // System.err.println(taskName+" "+start);
+ // XUtil.writeToLog(taskName+" "+start);
+
+ element=new XEventElement(taskName,tasks.get(taskName),true,status,start,duration);
+
+ cc.betterAdd(element);
+ //cc.addReplaceFinish(element);
+ return element;
+
+
+ }
+ else {
+ element=new XEventElement(taskName,tasks.get(taskName),false,status,start,duration);
+ cc.betterAdd(element);
+ return element;
+
+ }
+
+ // System.out.println("Add "+taskName +" to "+core);
+ //cc.printList();
+ }
+ return null;
+ }
+public boolean validateExecutable()
+ {
+ return s1 && s2 && s3 && s4 && s5;
+ }
+
+public HashMap<String, XScheduler> getScheduler() {
+ return scheduler;
+ }
+
+public HashMap<String, XCore> getCores() {
+ return cores;
+ }
+public HashMap<String, XTasks> getTasks() { return tasks; }
+
+ public boolean isLabelView() {
+ return labelView;
+ }
+
+ public void setLabelView(boolean labelView) {
+ this.labelView = labelView;
+ }
+
+ public boolean isDataFlow() {
+ return dataFlow;
+ }
+
+ public void setDataFlow(boolean dataFlow) {
+ this.dataFlow = dataFlow;
+ }
+
+ public boolean isMergingArrow() {
+ return this.mergingArrow;
+ }
+
+ public void setMergingArrow(boolean value) {
+ this.mergingArrow = value;
+ }
+ public boolean isAlternativeArrow() {
+ return this.alternativeArrow;
+ }
+ public void setAlternativeArrow(boolean value) {
+ this.alternativeArrow = value;
+ }
+ public String getReport(){
+
+ sb=new StringBuilder();
+
+
+ for (String sel:chain.keySet())
+ {
+ if (sel!=null){
+
+ int r=0;
+ Iterator<XEventElement> it =chain.get(sel).iterator();
+ while (it.hasNext())
+ {
+ if (it.next().getStatus()==0){
+ r++;
+ }
+ }
+ sb.append("\n" + sel +"\n"
+ +"Total Tasks Complete: " + r +"\n"
+ );
+
+ }
+ else{
+ return sb.toString();
+ }
+
+ }
+
+ return sb.toString();
+ }
+
+ public LinkedList<LinkedList<ChainElement>> getGlobalChain() {
+ return globalChain;
+ }
+
+ public HashMap<String, XRunnable> getRunnables() {
+ return runnables;
+ }
+
+ public HashMap<String, XLabel> getLabels() {
+ return labels;
+ }
+
+ public HashMap<String, XEventChain> getChain() {
+ return chain;
+ }
+
+ public boolean isRun() {
+ return isRun;
+ }
+
+ public Object [] [] generateReport() throws NullPointerException
+ {
+ int refactor=1,width=4;
+
+ cores.size();
+ Object [] [] out=new Object[cores.size()*refactor][width];
+
+ Iterator<String> it = scheduler.keySet().iterator();
+
+ for (int i=0;i+refactor-1<out.length;i=i+refactor)
+ {
+ XScheduler sc=scheduler.get(it.next());
+ XEventChain cc=getChainByCore(sc.getCore().getName());
+
+ int countRun=0,countOver=0,countUnde=0;
+
+ for (XTasks tas:sc.getTasks()){
+ for (XEventElement zzmp:cc.getFullList(tas.getName())){
+ AbstractGanttViewElement agv= zzmp.getAbstractGanttViewElement();
+ if (zzmp.getStatus()==0){
+ countRun++;
+ }
+ if (agv instanceof MultysamplingViewElement){
+
+ MultysamplingViewElement mmb=(MultysamplingViewElement) agv;
+
+
+ if (mmb.isCountable()) {
+ if (mmb.isOverSampling()){
+ countOver++;
+ }
+ if (mmb.isUnderSampling()){
+ countUnde++;
+ }
+ }
+ }
+ }
+ }
+
+
+ out[i]=new Object[] {sc.getCore().getName(),countRun,countOver,countUnde};
+
+ }
+
+
+ return out;
+ }
+
+ public XResult getLabelAcces(String sel, String core){
+
+ XTasks tmpTask=getTasks().get(sel);
+ long read=0,write=0,count=0;
+
+ for (String curRun:tmpTask.getMap().keySet()
+ ) {
+ for (XAccess access:tmpTask.getMap().get(curRun).getList()
+ ) {
+ switch (access.getState()){
+ case 0:
+ read++;
+ break;
+ case 1:
+ write++;
+ break;
+
+ }
+ }
+ }
+
+ Iterator<XEventElement> it=getChainByCore(core).getFullList(sel).iterator();
+
+ while (it.hasNext()){
+ XEventElement xEl=it.next();
+ if(xEl.getAbstractGanttViewElement() instanceof MultysamplingViewElement)
+ {
+ MultysamplingViewElement el= (MultysamplingViewElement) xEl.getAbstractGanttViewElement();
+ if (el.isCountable()&&xEl.getStatus()==1){
+ count++;
+ }
+ }
+ }
+
+
+ return new XResult(read*count,write*count);
+ }
+
+ public boolean isHaveglobal() {
+ return haveglobal;
+ }
+
+ public class XResult{
+
+ long read ,write;
+
+ public XResult(long read, long write) {
+ this.read = read;
+ this.write = write;
+ }
+
+ public long getRead() {
+ return read;
+ }
+
+ public long getWrite() {
+ return write;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/XUtil.java b/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/XUtil.java
new file mode 100644
index 00000000..66dc3e97
--- /dev/null
+++ b/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/XUtil.java
@@ -0,0 +1,677 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.multicore.execution.model;
+
+import org.eclipse.app4mc.amalthea.model.Amalthea;
+import org.eclipse.app4mc.amalthea.model.io.AmaltheaLoader;
+import org.eclipse.app4mc.multicore.execution.model.elements.*;
+import org.eclipse.app4mc.multicore.execution.ui.widget.comunication.ComUtil;
+
+import javax.swing.*;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.*;
+
+public class XUtil {
+
+ private boolean debuger=false;
+ private StringBuilder sb=new StringBuilder();
+ public static XContainer startWithInput(int sel,String path)
+ {
+ XUtil x;
+ switch (sel)
+ {
+ case 0:
+
+ x=new XUtil();
+ return x.openWithUI();
+ case 1:
+ x=new XUtil();
+ return x.t1(path);
+ default:
+ return null;
+ }
+
+ }
+
+ public static XScheduler getSchedulerByCore(XContainer xContainer, String core)
+ {
+ Iterator<String> iterator=xContainer.getScheduler().keySet().iterator();
+ HashMap <String,XScheduler> map=xContainer.getScheduler();
+ for (String sc:map.keySet())
+ {
+ if (map.get(sc).getCore().getName().compareTo(core)==0)
+ {
+ return map.get(sc);
+ }
+ }
+
+ return null;
+ }
+
+ public static boolean hasDepended(String task, XScheduler tmp)
+ {
+ if (!XContainer.getInstance(null).isDataFlow()){
+ return false;
+ }
+ for (XTasks t: tmp.getTasks())
+ {
+ if (t.getName().compareTo(task)==0)
+ {
+ return t.getProducer().size()>0;
+ }
+ }
+ return false;
+ }
+
+ public static LinkedList<ComUtil.ULabel> getAllLabels(XContainer xContainer)
+ {
+ LinkedList <ComUtil.ULabel> out=new LinkedList<>();
+ HashMap<String, XTasks> tasks = xContainer.getTasks();
+ HashMap<String, XRunnable> runnable = xContainer.getRunnables();
+ String tmpTask="";
+ String tmpRun="";
+
+ for (String nt:tasks.keySet()){
+ tmpTask=nt;
+ for (String nr:tasks.get(nt).getMap().keySet()){
+ tmpRun=nr;
+ for (XAccess acc:runnable.get(nr).getList()){
+
+ out.add(new ComUtil.ULabel(acc.getLabel().getName(),tmpRun,tmpTask));
+ }
+ }
+
+ }
+
+ return out;
+
+
+
+ }
+
+ public static class ResultObj extends Stack <XEntry>{
+ int state;
+ boolean havePrommise;
+ public ResultObj() {
+ state=-2;
+ this.havePrommise=false;
+ }
+
+ public int getState() {
+ return state;
+ }
+
+ public void setState(int state) {
+ this.state = state;
+ }
+
+ public boolean isHavePrommise() {
+ return havePrommise;
+ }
+
+ public void setHavePrommise(boolean havePrommise) {
+ this.havePrommise = havePrommise;
+ }
+ }
+
+ public static class XEntry
+ {
+ XEventElement el;
+ XEntry promiseAlternative;
+ int state;
+
+ public XEntry(XEventElement el, int state) {
+ this.el = el;
+ this.state = state;
+ this.promiseAlternative=null;
+ }
+
+ public XEventElement getEl() {
+ return el;
+ }
+
+ public int getState() {
+ return state;
+ }
+
+ public boolean havePromiseAlternative(){
+ return this.promiseAlternative!=null;
+ }
+
+ public XEntry getPromiseAlternative() {
+ return promiseAlternative;
+ }
+
+ public void setPromiseAlternative(XEntry promiseAlternative) {
+ this.promiseAlternative = promiseAlternative;
+ }
+ }
+ public static ResultObj isAffected(XEventChain chainByCore, String task)
+ {
+ StringBuilder sb=new StringBuilder();
+
+ ResultObj out =new ResultObj();
+ out.setState(0);
+
+ if (!XContainer.getInstance(null).isDataFlow()){
+ out.setState(-300);
+ return out;
+ }
+ LinkedList<XEventElement> tmplist = XUtil.getFilteredList(chainByCore, task);
+ if (tmplist.size()>1)
+ {
+
+ Iterator<XEventElement> it = tmplist.descendingIterator();
+
+ // System.out.println();
+
+ if (it.next().getStatus()==2 && it.next().getStatus()==1){
+ out.setState(0);
+ return out;}
+ }
+
+
+ for (XTasks t:chainByCore.getScheduler().getTasks())
+ {
+ if (t.getName().compareTo(task)==0)
+ {
+ if (t.getProducer().size()==0)
+ {
+ out.setState(0);
+ return out;
+ }
+ else
+ {
+ sb.append("#########################"+t.getName()+"################################");
+ sb.append("\n");
+ out= isInFinishList(chainByCore,t,sb);
+ sb.append("######################### "+"End"+" ################################");
+ sb.append("\n");
+ // System.out.println(sb);
+ // XUtil.writeToLog(sb.toString());
+
+ return out;
+
+ }
+ }
+ }
+ // System.out.println("use NULL");
+ return out;
+
+ }
+ private static ResultObj isInFinishList(XEventChain cbc, XTasks linked, StringBuilder sb)
+ {
+ Iterator <String> it= linked.getProducer().keySet().iterator();
+ Iterator <XEventElement> itt;
+ ResultObj out=new ResultObj();
+ out.setState(0);
+ int count=0;
+
+ XTasks tmpTask;
+ XEventElement eventElement;
+ while (it.hasNext())
+ {
+ count=0;
+ XEntry currentOutput=null;
+ tmpTask=linked.getProducer().get(it.next());
+
+ sb.append("#");
+ sb.append("\n");
+
+ sb.append("# Search for "+tmpTask.getName());
+ sb.append("\n");
+
+ itt=XUtil.getFilteredList(cbc,tmpTask.getName()).descendingIterator();
+
+ while (itt.hasNext())
+ {
+ eventElement=itt.next();
+
+
+ sb.append("# Compare with ->"+eventElement.getName()+"\n");
+ sb.append("\n # @ "+eventElement.getStart() + "\n # for " + eventElement.getDuration());
+ sb.append("# Status->"+eventElement.getStatus()+"\n");
+
+
+ if (count==0&&eventElement.getStatus()==1){
+ sb.append("## Found Prommise at "+count+"\n");
+ sb.append("##> "+eventElement.getStart()+"\n");
+
+ sb.append("#");
+ sb.append("\n");
+ currentOutput=new XEntry(eventElement,-1);
+ out.push(currentOutput);
+ out.setHavePrommise(true);
+ }
+
+
+ if (eventElement.getStatus()==0){
+
+ sb.append("## Found Match at "+count+"\n");
+ sb.append("##> "+eventElement.getStart()+"\n");
+
+ sb.append("#");
+ sb.append("\n");
+
+ if (currentOutput==null){
+ out.setState(1);
+ out.push(new XEntry(eventElement,1));
+ }
+ else{
+
+ currentOutput.setPromiseAlternative(new XEntry(eventElement,1));
+ out.push(currentOutput);
+ break;
+ }
+ count++;
+ break;
+ }
+ count++;
+
+
+
+ /*
+
+ */
+
+ }
+
+
+ }
+ if (out.getState()==0){sb.append("## Found no Match \n");}
+ else {
+ sb.append("## Found "+out.size()+" Match(s) \n");
+ }
+ return out;
+ }
+
+ public static LinkedList <String> getAffected(XEventChain ec, String task1)
+ {
+ LinkedList <String> out=new LinkedList<>();
+
+ for (XTasks t:ec.getScheduler().getTasks())
+ {
+ if (t.getName().compareTo(task1)==0)
+ {
+ if (t.getProducer().size()==0)
+ {
+ return out;
+ }
+ else
+ {
+ ArrayList<String> ttmp=getInFinishList(ec,t.getProducer());
+ for (String s:ttmp) {
+ out.add(s);
+ }
+ {
+
+ }
+
+
+ }
+ }
+ }
+ return out;
+ }
+ private static ArrayList <String> getInFinishList(XEventChain cbc, HashMap<String, XTasks> linked)
+ {
+ ArrayList <String> outPut=new ArrayList<>();
+ Iterator <String> it= linked.keySet().iterator();
+ XTasks tmpTask;
+ boolean debug=true;
+ while (it.hasNext())
+ {
+ tmpTask=linked.get(it.next());
+ //if (debug){System.out.println("#Search for "+tmpTask.getName());}
+ for (XEventElement s:cbc)
+ {
+ //if (debug){System.out.println("Compare with ->"+s.getName());}
+
+ if (s.getName().compareTo(tmpTask.getName())==0)
+ {
+ // if (debug){System.out.println("##Found Match");}
+ outPut.add(s.getName());
+ }
+
+
+ }
+
+ }
+ //if (debug){System.out.println("##Found no Match");}
+
+ return outPut;
+ }
+ private XContainer openWithUI() {
+ final JFileChooser chooser = new JFileChooser("Please set Amalthea Model");
+ chooser.setDialogType(JFileChooser.OPEN_DIALOG);
+ chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
+ final File file = new File("/");
+
+ chooser.setCurrentDirectory(file);
+
+ chooser.addPropertyChangeListener(new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent e) {
+ if (e.getPropertyName().equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)
+ || e.getPropertyName().equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY)) {
+ final File f = (File) e.getNewValue();
+ }
+ }
+ });
+
+ chooser.setVisible(true);
+ final int result = chooser.showOpenDialog(null);
+
+ if (result == JFileChooser.APPROVE_OPTION) {
+ File inputVerzFile = chooser.getSelectedFile();
+ String inputVerzStr = inputVerzFile.getPath();
+ return t1(inputVerzStr);
+ }
+ //System.out.println("Abbruch");
+ chooser.setVisible(false);
+ return null;
+ }
+
+ private XContainer t1 (String path)
+ {
+
+ Amalthea model;
+ File inputFile;
+ XContainer c=null;
+
+ try
+ {
+ inputFile = new File(path);
+ model = AmaltheaLoader.loadFromFile(inputFile);
+
+ if (model == null) {
+ // System.out.println("Error: No model loaded!");
+ XUtil.writeToLog("Error: No model loaded!");
+ }
+ c = XContainer.getInstance(null);
+ c.prepare(model);
+ //runFull(c);
+ }
+ catch (Exception e)
+ {
+ System.out.println("Error while loading Amalthea Model");
+
+ System.out.println("#########################################");
+ System.out.println(e.toString());
+ System.out.println("#########################################");
+
+
+ }
+ // System.out.println("done");
+
+ return c;
+
+
+ }
+
+
+
+ private void runFull(XContainer c)
+ {
+ XScheduler s;
+ Iterator <String> it;
+ sb.append("###########Detail Scaduling info ################\n");
+
+ if (c.validateExecutable())
+ {
+ Set<String> keySet=c.getScheduler().keySet();
+ it=keySet.iterator();
+
+ while (it.hasNext())
+ {
+ s=c.getScheduler().get(it.next());
+ sb.append("\n# Name: ");
+ sb.append(s.getName()+"\n");
+ level00(s);
+ }
+ }
+ if (debuger)
+ {
+ // System.out.println(sb);
+ //XUtil.writeToLog(sb.toString());
+ // System.out.println("###########Detail Scheduling info - Ende##########");
+
+ }
+ }
+ private void level00(XScheduler s) //#level00 ist a testing level
+ {
+ //LinkedList<XTasks> list=s.getTasks();
+ //se(list.getFirst(),list);
+
+ //System.out.println();
+ level01(s);
+
+ }
+
+ private void level01(XScheduler s)
+ {
+ sb.append("# CPU: "+s.getCore().getName()+"\n");
+ LinkedList<XTasks> list=s.getTasks();
+
+
+
+ level02(list);
+
+ }
+ private void level02(LinkedList<XTasks> list)
+ {
+ Iterator<XTasks> it=list.iterator();
+ XTasks tmp;
+
+ while (it.hasNext())
+ {
+ tmp=it.next();
+
+ sb.append("\n## Task: "+tmp.getName()+"\n");
+
+ level03(tmp);
+ }
+
+
+ }
+ private void level03(XTasks t)
+ {
+ HashMap<String,XRunnable> map;
+ map=t.getMap();
+ Iterator<String> keys=map.keySet().iterator();
+ XRunnable tmp;
+ LinkedList <XAccess> read;
+ LinkedList <XAccess> write;
+ Iterator<XAccess> acc;
+ XAccess aTmp;
+ read=new LinkedList<>();
+ write=new LinkedList<>();
+
+ while (keys.hasNext())
+ {
+ tmp=map.get(keys.next());
+ //sb.append("### Runnable: "+tmp.getName()+"\n");
+
+ acc=tmp.getList().iterator();
+
+ while (acc.hasNext())
+ {
+ aTmp=acc.next();
+
+ switch (aTmp.getState())
+ {
+ case 0: read.add(aTmp);break;
+ case 1: write.add(aTmp);break;
+ default:break;
+ }
+ }
+
+ }
+ sb.append("#### Read: "+read.size()+" Write: "+write.size()+"\n");
+ }
+
+//## compare with Other Tasks
+
+public static boolean se(XTasks t,Iterable <XTasks>iterable)
+ // Compare Tasks: if one of the Iterable Tasks writes to one label that t reads
+ {
+ boolean output=false;
+ LinkedList <XAccess> toCompaer;
+ toCompaer=t.getBySel(0);
+ Iterator<XTasks> it=iterable.iterator();
+ XTasks x;
+
+ while (it.hasNext())
+ {
+ x=it.next();
+ output=compareAccess(toCompaer,x.getBySel(1));
+ if (output)
+ {
+ t.addProducer(x);
+ // System.out.println(t.getName() +" -> "+x.getName());
+
+ output = true;
+ }
+ if (!output)
+ {
+
+ }
+
+ }
+
+
+ return output;
+
+ }
+public static boolean compareAccess(Iterable<XAccess> first, Iterable<XAccess> next)
+ {
+ Iterator <XAccess> it1,it2;
+ it1=first.iterator();
+ XAccess tmp1,tmp2;
+ while (it1.hasNext())
+ {
+ it2=next.iterator();
+ tmp1=it1.next();
+ while (it2.hasNext())
+ {
+ tmp2=it2.next();
+
+ if (tmp1.getLabel().getName().compareTo(tmp2.getLabel().getName())==0)
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+public static String compareTasks (XTasks read,XTasks write)
+ {
+
+ Iterator <XAccess> rr,ww;
+ String out="";
+
+ XAccess tmpA;
+ XAccess tmpB;
+
+ rr=read.getBySel(0).iterator();
+
+ while (rr.hasNext())
+ {
+ tmpA=rr.next();
+
+ ww=write.getBySel(1).iterator();
+ while (ww.hasNext())
+ {
+ tmpB=ww.next();
+
+ if (tmpA.getLabel().getName().compareTo(tmpB.getLabel().getName())==0)
+ {
+ out+=tmpA.getLabel().getName()+",";
+ }
+ }
+
+ }
+
+
+
+ return out;
+ }
+
+
+
+public static LinkedList<XEventElement> getFilteredList(XEventChain chain,String name)
+{
+ LinkedList <XEventElement> output=new LinkedList<>();
+ Iterator <XEventElement> it=chain.iterator();
+ XEventElement tmp;
+
+ while (it.hasNext())
+ {
+ tmp=it.next();
+ if(tmp.getName().compareTo(name)==0)
+ {
+ output.add(tmp);
+ }
+ }
+
+return output;
+
+}
+
+public static void writeToLog(String inString)
+
+{
+ File f = new File("log.txt");
+ boolean existsFlag = f.exists();
+// System.out.println(f.getAbsolutePath());
+ if(!existsFlag)
+ {
+ try {
+ f.createNewFile();
+ } catch (IOException e) {
+ System.out.println("could not create new log file");
+ //e.printStackTrace();
+
+
+ System.out.println(inString);
+ return;
+
+ }
+
+ }
+
+ FileWriter fstream;
+ try {
+ fstream = new FileWriter(f, true);
+ BufferedWriter out = new BufferedWriter(fstream);
+ out.write(inString+"\n");
+ out.newLine();
+ out.close();
+ } catch (IOException e) {
+ System.out.println("could not write to the file");
+ e.printStackTrace();
+ }
+
+
+ return;
+ }
+
+}
+
+
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XAccess.java b/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XAccess.java
new file mode 100644
index 00000000..c30a20d0
--- /dev/null
+++ b/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XAccess.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.multicore.execution.model.elements;
+
+import org.eclipse.app4mc.multicore.execution.model.XUtil;
+
+public class XAccess
+{
+ private int state;
+ private XLabel label;
+ XAccess (int state,XLabel label)
+ {
+ this.state=state;
+ this.label=label;
+ }
+
+ private void print()
+ {
+ if (state==0)
+ // System.out.println("read from"+label.getName());
+ XUtil.writeToLog("read from"+label.getName());
+ }
+
+ public int getState() {
+ return state;
+ }
+
+ public XLabel getLabel() {
+ return label;
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XCore.java b/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XCore.java
new file mode 100644
index 00000000..ae89f74f
--- /dev/null
+++ b/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XCore.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.multicore.execution.model.elements;
+
+public class XCore
+{
+ String name;
+
+ public XCore(String name){
+ this.name=name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XEventChain.java b/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XEventChain.java
new file mode 100644
index 00000000..87b3eb3b
--- /dev/null
+++ b/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XEventChain.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.multicore.execution.model.elements;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+
+public class XEventChain extends LinkedList<XEventElement>
+{
+ private XScheduler scheduler;
+ private LinkedList <String> orderlist;
+ private HashMap <String,XEventElement> lastFinish=new HashMap<>();
+ private HashMap <String,XEventElement> lastPromFinish=new HashMap<>();
+ private HashMap <String,LinkedList<XEventElement>> fullrun=new HashMap<>();
+
+ public XEventChain(XScheduler scheduler) {
+ super();
+ orderlist=new LinkedList<>();
+ fullrun=new HashMap<>();
+ this.scheduler = scheduler;
+ }
+
+ public XScheduler getScheduler() {
+ return scheduler;
+ }
+ public void betterAdd(XEventElement element){
+
+ switch (element.getStatus()){
+ default:
+ break;
+ case 0:
+ case 1:
+ case 2:
+ this.add(element);
+ break;
+ }
+
+ if (fullrun.get(element.getTasks().getName())==null) {
+ fullrun.put(element.getTasks().getName(),new LinkedList<>());
+ }
+ fullrun.get(element.getTasks().getName()).add(element);
+ }
+ public LinkedList<XEventElement> getFullList(String task){
+ return this.fullrun.get(task);
+ }
+ public int getIndexOf(String s)
+ {
+ if (orderlist.size()>0)
+ {
+ for (int i=0;i<orderlist.size();i++)
+ {
+ if (orderlist.get(i).compareTo(s)==0)
+ {
+ return i;
+ }
+ }
+ }
+ return -1;
+ }
+ public int getIndexxOf(XEventElement ob)
+ {
+ ;
+ LinkedList <XEventElement> list=fullrun.get(ob.getTasks().getName());
+
+
+ return list.indexOf(ob);
+ }
+
+ public void addSort(String s)
+ {
+ this.orderlist.add(s);
+ // System.out.println("Add" +s+" "+scheduler.getName());
+ }
+
+
+ public void addReplaceFinish(XEventElement el)
+ {
+
+ // XUtil.writeToLog("Update "+el.getName());
+
+ if (lastFinish.get(el.getName())==null){
+ lastFinish.put(el.getName(),el);
+ // System.out.println("Update "+el.getName());
+ }
+ else {
+ if (lastPromFinish.get(el.getName())==null){
+ lastPromFinish.put(el.getName(), lastFinish.get(el.getName()));
+ }
+ else{
+ lastPromFinish.replace(el.getName(), lastFinish.get(el.getName()));
+ }
+ lastFinish.replace(el.getName(),el);
+
+ // System.out.println("Replace "+el.getName());
+ }
+
+ }
+ public XEventElement getLastFinish(String key)
+ {
+ return lastFinish.get(key);
+ }
+ public XEventElement getLastPrmFinish(String key)
+ {
+ return lastPromFinish.get(key);
+ }
+ public void printList()
+ {
+ // System.out.println("#######################");
+ for (XEventElement et:
+ this
+ ) {
+ //// System.out.println("#");
+ //// System.out.println("# "+et.getName()+" "+et.getStatus());
+ // System.out.println("#");
+
+
+ }
+ // System.out.println("# size: "+this.size());
+ // System.out.println("#######################");
+
+ }
+
+}
+
+
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XEventElement.java b/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XEventElement.java
new file mode 100644
index 00000000..ec5c54e7
--- /dev/null
+++ b/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XEventElement.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.multicore.execution.model.elements;
+
+import org.eclipse.app4mc.multicore.execution.ui.widget.gantt.elements.AbstractGanttViewElement;
+
+public class XEventElement
+{
+ private String name;
+ private XTasks tasks;
+ private boolean finish;
+ private int status;
+ private long start;
+ private double duration;
+ private AbstractGanttViewElement abstractGanttViewElement;
+
+ public XEventElement(String name, XTasks tasks, boolean finish, int status, long start, double duration)
+ {
+ this.name = name;
+ this.tasks = tasks;
+ this.finish = finish;
+ this.status = status;
+ this.start=start;
+ this.duration=duration;
+ this.abstractGanttViewElement=null;
+ // System.out.println("Name: "+name+" Status: "+status+" Fin: "+finish+" "+ "" + start+" "+duration);
+ }
+
+ @Override
+ public String toString() {
+ return "##########EntryView#################\n"+
+ "name "+ name+ "\n"+
+ " tasks "+tasks.getName() +"\n"+
+ " finish "+finish +"\n"+
+ " status "+status +"\n"+
+ " start "+ start +"\n"+
+ " duration "+" "+duration +"\n";
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public XTasks getTasks() {
+ return tasks;
+ }
+
+ public void setTasks(XTasks tasks) {
+ this.tasks = tasks;
+ }
+
+ public boolean isFinish() {
+ return finish;
+ }
+
+ public void setFinish(boolean finish) {
+ this.finish = finish;
+ }
+
+ public int getStatus() {
+ return status;
+ }
+
+ public void setStatus(int status) {
+ this.status = status;
+ }
+
+ public long getStart() {
+ return start;
+ }
+
+ public double getDuration() {
+ return duration;
+ }
+
+ public void setGantElement(AbstractGanttViewElement abstractGanttViewElement) {
+ this.abstractGanttViewElement=abstractGanttViewElement;
+ }
+
+ public AbstractGanttViewElement getAbstractGanttViewElement() {
+ return abstractGanttViewElement;
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XLabel.java b/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XLabel.java
new file mode 100644
index 00000000..55fd18ff
--- /dev/null
+++ b/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XLabel.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.multicore.execution.model.elements;
+
+import org.eclipse.app4mc.amalthea.model.Label;
+
+public class XLabel
+{
+ private String name;
+ private long size;
+ public XLabel (Label label)
+ {
+ this.name=label.getName();
+ try {
+ this.size= label.getSize().getNumberBytes();
+ }
+ catch (Exception e){
+ this.size=-1;
+ }
+
+
+
+ }
+ public String getName()
+ {
+ return name;
+ }
+ public long getSizeInBytes(){
+ return size;
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XMappingUtil.java b/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XMappingUtil.java
new file mode 100644
index 00000000..2e8014dd
--- /dev/null
+++ b/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XMappingUtil.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.multicore.execution.model.elements;
+
+import org.eclipse.app4mc.amalthea.model.MappingModel;
+import org.eclipse.app4mc.amalthea.model.SWModel;
+import org.eclipse.app4mc.amalthea.model.SchedulerAllocation;
+import org.eclipse.app4mc.amalthea.model.TaskAllocation;
+import org.eclipse.app4mc.multicore.execution.model.XUtil;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+public class XMappingUtil
+{
+ public static void printAlloc(MappingModel mappingModel)
+ {
+
+ System.out.println("####################################");
+ //System.out.println(mappingModel.getSchedulerAllocation().get(0).getResponsibility().get(0).getName());
+ //System.out.println(mappingModel.getSchedulerAllocation().get(0).getScheduler().getName());
+ System.out.println(mappingModel.getTaskAllocation().get(0).getScheduler().getName());
+ System.out.println(mappingModel.getTaskAllocation().get(0).getTask().getName());
+
+ }
+
+ public static void getScaduler(MappingModel mappingModel,HashMap<String, XScheduler> mapSch, HashMap <String, XCore> mapCor)
+ {
+
+ Iterator<SchedulerAllocation> it=mappingModel.getSchedulerAllocation().iterator();
+ SchedulerAllocation tmpSchAl;
+ String tName;
+ XScheduler tempSch;
+ XCore tempCore;
+
+ while (it.hasNext()){
+ tmpSchAl=it.next();
+
+ tName=tmpSchAl.getScheduler().getName();
+
+ tempCore=mapCor.get(tmpSchAl.getResponsibility().get(0).getName());
+
+ tempSch=new XScheduler(tName,tempCore);
+
+ mapSch.put(tName,tempSch);
+ }
+
+ }
+ public static void addTasks(MappingModel mappingModel,HashMap<String, XScheduler> mapSch, HashMap <String, XTasks> mapTas)
+ {
+
+ Iterator<TaskAllocation> it=mappingModel.getTaskAllocation().iterator();
+ TaskAllocation tmpSchAl;
+ XScheduler tempSch;
+ XTasks tempTask;
+
+ String t,s;
+
+
+ while (it.hasNext()){
+ tmpSchAl=it.next();
+ t=tmpSchAl.getTask().getName();
+ s=tmpSchAl.getScheduler().getName();
+
+ tempSch=mapSch.get(s);
+ tempTask=mapTas.get(t);
+
+ if (tempSch!=null&&tempTask!=null)
+ {
+ tempSch.add(tempTask);
+ // System.out.println("Link "+s+" - "+t);
+ }
+ else
+ {
+ System.err.println("ERROR NULL");
+ }
+
+
+ }
+
+ }
+ public static void addRun(SWModel swModel, HashMap<String, XRunnable> mapRun, HashMap <String, XTasks> mapTas)
+ {
+ //Iterator<TaskAllocation> it=
+ //TaskAllocation tmpSchAl;
+ XRunnable tempSch;
+ XTasks tempTask;
+
+ String t,r;
+
+ }
+
+ public static void LinkTasks(XScheduler s )
+ {
+ LinkedList <XTasks> list = s.getTasks();
+ XTasks tmp;
+
+ for (int i=0;i<list.size();i++)
+ {
+ tmp =list.get(0);
+ // System.out.println("Sync" +tmp.getName() +" with "+list.size());
+ list.remove(tmp);
+ XUtil.se(tmp,list);
+ list.addLast(tmp);
+ }
+ for (XTasks element:list
+ ) {
+ for (String key: element.getProducer().keySet()
+ ) {
+ XTasks linked=element.getProducer().get(key);
+ linked.addConsumer(element);
+ }
+ }
+
+
+
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XRunnable.java b/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XRunnable.java
new file mode 100644
index 00000000..f130ac5e
--- /dev/null
+++ b/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XRunnable.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.multicore.execution.model.elements;
+
+import org.eclipse.app4mc.amalthea.model.Runnable;
+
+import java.util.LinkedList;
+
+public class XRunnable {
+
+private final int READ=0,WRITE=1;
+private LinkedList <XAccess> list;
+ private XTasks task;
+ private String name;
+ public XRunnable(Runnable next)
+ {
+ list = new LinkedList<>();
+ this.name=next.getName();
+ }
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public XAccess addAccess( int state,XLabel label)
+ {
+ XAccess out = new XAccess(state, label);
+ // System.out.println(state +" "+label.getName());
+ list.add(out);
+ return out;
+ }
+ public int size()
+ {
+ return list.size();
+ }
+
+ public LinkedList<XAccess> getList() {
+ return list;
+ }
+
+ public XTasks getTask() {
+ return task;
+ }
+
+ public void setTask(XTasks task) {
+ this.task = task;
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XScheduler.java b/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XScheduler.java
new file mode 100644
index 00000000..c66c3c43
--- /dev/null
+++ b/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XScheduler.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.multicore.execution.model.elements;
+
+import java.util.LinkedList;
+
+public class XScheduler
+{
+ private LinkedList <XTasks> tasks;
+ private XCore core;
+ private String name;
+
+ public XScheduler(String name, XCore core){
+ tasks=new LinkedList<>();
+ //System.out.println("Add Scaduler "+name+" "+core.getName());
+ this.core=core;
+ this.name=name;
+ }
+
+ public XScheduler() {
+
+ }
+
+ public void add(XTasks task)
+ {
+ tasks.add(task);
+ }
+ public int size()
+ {
+ return tasks.size();
+ }
+ public String getName()
+ {
+ return this.name;
+ }
+
+
+ public LinkedList<XTasks> getTasks() {
+ return tasks;
+ }
+
+ public XCore getCore() {
+ return core;
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XTasks.java b/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XTasks.java
new file mode 100644
index 00000000..6d2a7755
--- /dev/null
+++ b/plugins/org.eclipse.app4mc.multicore.execution.model/src/org/eclipse/app4mc/multicore/execution/model/elements/XTasks.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.multicore.execution.model.elements;
+
+import org.eclipse.app4mc.amalthea.model.Task;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+public class XTasks {
+
+ private XCore xc;
+
+ private String name;
+ private HashMap <String,XTasks> producer=new HashMap<>();
+ private HashMap <String,XTasks> consumer=new HashMap<>();
+
+ private HashMap <String,XRunnable> map=new HashMap<>();
+
+ public HashMap<String, XTasks> getProducer() {
+ return producer;
+ }
+ public HashMap<String, XTasks> getConsumer() { return consumer; }
+
+ public void addProducer(XTasks linked) {
+ this.producer.put(linked.getName(),linked) ;
+ }
+ public void addConsumer(XTasks linked) { this.consumer.put(linked.getName(),linked) ; }
+
+
+ public XTasks (Task t)
+ {
+
+ // System.out.println("Task Creaded: "+t.getName());
+ name=t.getName();
+ //prepare(t);
+ }
+ public XTasks (Task t,XCore c)
+ {
+ this.xc=c;
+
+ // System.out.println("Task Creaded: "+t.getName());
+ name=t.getName();
+ //prepare(t);
+ }
+
+
+
+ public void addRunnable(String name,XRunnable run)
+ {
+ map.put(name,run);
+ }
+
+ public int size()
+ {
+ return map.size();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public HashMap<String, XRunnable> getMap() {
+ return map;
+ }
+
+ public LinkedList<XAccess> getBySel(int sel)
+ {
+ Iterator<String> keys=map.keySet().iterator();
+ XRunnable tmp;
+ LinkedList <XAccess> read;
+ LinkedList <XAccess> write;
+ Iterator<XAccess> acc;
+ XAccess aTmp;
+ read=new LinkedList<>();
+ write=new LinkedList<>();
+
+ while (keys.hasNext())
+ {
+ tmp=map.get(keys.next());
+ acc=tmp.getList().iterator();
+ while (acc.hasNext())
+ {
+ aTmp=acc.next();
+ switch (aTmp.getState())
+ {
+ case 0: read.add(aTmp);break;
+ case 1: write.add(aTmp);break;
+ default:break;
+ }
+ }
+
+ }
+ if (sel==0)
+ {
+ return read;
+ }
+ else
+ {
+ return write;
+ }
+ }
+
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/.classpath b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/.classpath
index b862a296..eca7bdba 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/.classpath
+++ b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/.classpath
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/.project b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/.project
index ad639440..05af804b 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/.project
+++ b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/.project
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.app4mc.multicore.execution.ui.simmenu</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.app4mc.multicore.execution.ui.simmenu</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/META-INF/MANIFEST.MF b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/META-INF/MANIFEST.MF
index 4e4939ee..859c49da 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/META-INF/MANIFEST.MF
@@ -14,7 +14,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.app4mc.multicore.sharelibs,
org.eclipse.app4mc.multicore.execution.logic,
org.eclipse.app4mc.multicore.execution.ui.widget,
- com.mxgraph
+ com.mxgraph,
+ org.eclipse.app4mc.multicore.execution.model
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-Vendor: Eclipse APP4MC
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/build.properties b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/build.properties
index 1181caa1..81f9a2be 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/build.properties
+++ b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/build.properties
@@ -1,16 +1,16 @@
-###############################################################################
-# Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License 2.0
-# which accompanies this distribution, and is available at
-# https://www.eclipse.org/legal/epl-2.0/
-#
-# Contributors:
-# Dortmund University of Applied Sciences and Arts - initial API and implementation
-###############################################################################
-source.. = src/
-output.. = bin/
-bin.includes = plugin.xml,\
- META-INF/,\
- .,\
- icons/
+###############################################################################
+# Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# Contributors:
+# Dortmund University of Applied Sciences and Arts - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/Activator.java b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/Activator.java
index 32d8b175..020713a3 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/Activator.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/Activator.java
@@ -1,73 +1,73 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.ui.simmenu;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.app4mc.amalthea.SimGenerator"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path
- *
- * @param path the path
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String path) {
- return imageDescriptorFromPlugin(PLUGIN_ID, path);
- }
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.ui.simmenu;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.app4mc.amalthea.SimGenerator"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/handlers/SimMenuHandler.java b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/handlers/SimMenuHandler.java
index 5f5fbde2..450966d3 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/handlers/SimMenuHandler.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/handlers/SimMenuHandler.java
@@ -1,116 +1,122 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.ui.simmenu.handlers;
-
-import org.eclipse.app4mc.amalthea.model.ConstraintsModel;
-import org.eclipse.app4mc.amalthea.model.MappingModel;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMMapping;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMUtil;
-import org.eclipse.app4mc.multicore.execution.ui.simmenu.wizards.TaskVisuWizard;
-import org.eclipse.app4mc.multicore.execution.ui.traceview.TraceViewUtil;
-import org.eclipse.app4mc.multicore.execution.ui.widget.emtracewidget.IEMTraceWidget;
-import org.eclipse.app4mc.multicore.sharelibs.UniversalHandler;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Our sample handler extends AbstractHandler, an IHandler base class.
- *
- * @see org.eclipse.core.commands.IHandler
- * @see org.eclipse.core.commands.AbstractHandler
- */
-public class SimMenuHandler extends AbstractHandler {
-
- IEMTraceWidget tw;
- OMMapping ommodel;
- private ConstraintsModel cmmodel;
-
- /**
- * The constructor.
- */
- public SimMenuHandler() {
- }
-
- /**
- * start task visualization setup for selected model
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
- final UniversalHandler uh = UniversalHandler.getInstance();
- final IFile file = uh.getSelectedFile(event);
-
- if (!readModels(file)) {
- MessageDialog.openInformation(window.getShell(), "Task Exec Visualization", "No Mapping- or Constraints-Model available! Select file with Mapping-Model.");
- return null;
- }
- tw= TraceViewUtil.showEMTraceView();
- if (tw==null) {
- MessageDialog.openInformation(window.getShell(), "Task Exec Visualization", "Can't display TraceView!");
- return null;
- }
-
- showWizard(window.getShell());
- return null;
- }
-
- private void showWizard(Shell shell) {
- WizardDialog wizardDialog = new WizardDialog(shell, new TaskVisuWizard(tw,ommodel,cmmodel));
-
- if (wizardDialog.open() == Window.OK) {
- System.out.println("Ok pressed");
- } else {
- System.out.println("Cancel pressed");
- }
- }
-
-
- private boolean readModels(IFile file) {
- if(file == null){
- return false;
- }
-
- UniversalHandler uh = UniversalHandler.getInstance();
- URI uri =URI.createPlatformResourceURI(file.getFullPath().toString(), true);
-
- uh.dropCache();
-
- if(uri==null){
- return false;
- }
- uh.readModels(uri, true);
-
- cmmodel = uh.getConstraintsModel();
-
- final MappingModel m = uh.getMappingModel();
- if (m == null) {
- return false;
- }
- ommodel = OMUtil.createOMMapping(m) ;
-
-
- return true;
- }
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.ui.simmenu.handlers;
+
+import org.eclipse.app4mc.amalthea.model.ConstraintsModel;
+import org.eclipse.app4mc.amalthea.model.MappingModel;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMMapping;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMUtil;
+import org.eclipse.app4mc.multicore.execution.ui.simmenu.wizards.TaskVisuWizard;
+import org.eclipse.app4mc.multicore.execution.ui.traceview.TraceViewUtil;
+import org.eclipse.app4mc.multicore.execution.ui.widget.emtracewidget.IEMTraceWidget;
+import org.eclipse.app4mc.multicore.sharelibs.UniversalHandler;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import javax.swing.*;
+
+/**
+ * Our sample handler extends AbstractHandler, an IHandler base class.
+ *
+ * @see org.eclipse.core.commands.IHandler
+ * @see org.eclipse.core.commands.AbstractHandler
+ */
+public class SimMenuHandler extends AbstractHandler {
+
+ IEMTraceWidget tw;
+ OMMapping ommodel;
+ private ConstraintsModel cmmodel;
+
+ /**
+ * The constructor.
+ */
+ public SimMenuHandler() {
+ }
+
+ /**
+ * start task visualization setup for selected model
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
+ final UniversalHandler uh = UniversalHandler.getInstance();
+ final IFile file = uh.getSelectedFile(event);
+ if (!readModels(file)) {
+ MessageDialog.openInformation(window.getShell(), "Task Exec Visualization", "No Mapping- or Constraints-Model available! Select file with Mapping-Model.");
+ return null;
+ }
+ tw= TraceViewUtil.showEMTraceView();
+ if (tw==null) {
+ MessageDialog.openInformation(window.getShell(), "Task Exec Visualization", "Can't display TraceView!");
+ return null;
+ }
+
+ showWizard(window.getShell(),file.getLocation().toOSString());
+ return null;
+ }
+
+ private void showWizard(Shell shell,String path) {
+ if(tw.getFinish()){
+ JOptionPane.showMessageDialog(null,"Please close the TraceView Tab before you start a new run","Error",JOptionPane.ERROR_MESSAGE);
+
+ return;
+ }
+ WizardDialog wizardDialog = new WizardDialog(shell, new TaskVisuWizard(tw,ommodel,cmmodel,path));
+
+ if (wizardDialog.open() == Window.OK) {
+ System.out.println("Ok pressed");
+ } else {
+ System.out.println("Cancel pressed");
+ }
+ }
+
+
+ private boolean readModels(IFile file) {
+ if(file == null){
+ return false;
+ }
+
+ UniversalHandler uh = UniversalHandler.getInstance();
+ URI uri =URI.createPlatformResourceURI(file.getFullPath().toString(), true);
+
+ uh.dropCache();
+
+ if(uri==null){
+ return false;
+ }
+ uh.readModels(uri, true);
+
+ cmmodel = uh.getConstraintsModel();
+
+ final MappingModel m = uh.getMappingModel();
+ if (m == null) {
+ return false;
+ }
+ ommodel = OMUtil.createOMMapping(m) ;
+
+
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/SWTAllocationTable.java b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/SWTAllocationTable.java
index e7e1de88..ae72cba1 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/SWTAllocationTable.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/SWTAllocationTable.java
@@ -1,132 +1,132 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.ui.simmenu.wizards;
-
-import java.util.List;
-
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.MalformedModelException;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMAllocation;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ColumnLabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
-
-
-public class SWTAllocationTable extends TableViewer{
-
-
- public SWTAllocationTable(Composite parent, List<OMAllocation> model) {
- super(parent,SWT.MULTI | SWT.H_SCROLL
- | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
-
- setContentProvider(ArrayContentProvider.getInstance());
- setInput(model);
- setupColumns();
- refresh();
- }
-
- private void setupColumns() {
- final Table table = getTable();
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
-
-
-
- TableViewerColumn colTask = new TableViewerColumn(this, SWT.NONE);
- colTask.getColumn().setWidth(100);
- colTask.getColumn().setText("Task");
- colTask.setLabelProvider(new ColumnLabelProvider() {
- @Override
- public String getText(Object element) {
- OMAllocation alloc = (OMAllocation) element;
- return alloc.getTask().getTaskRef().getName();
- }
- });
-
- TableViewerColumn colInst = new TableViewerColumn(this, SWT.NONE);
- colInst.getColumn().setWidth(150);
- colInst.getColumn().setText("Instructions");
- colInst.setLabelProvider(new ColumnLabelProvider() {
- @Override
- public String getText(Object element) {
- OMAllocation alloc = (OMAllocation) element;
- return Long.toString(alloc.getTask().getInstructionCount());
- }
- });
-
- TableViewerColumn colPeriod = new TableViewerColumn(this, SWT.NONE);
- colPeriod.getColumn().setWidth(150);
- colPeriod.getColumn().setText("Period (ps)");
- colPeriod.setLabelProvider(new ColumnLabelProvider() {
- @Override
- public String getText(Object element) {
- OMAllocation alloc = (OMAllocation) element;
- return Long.toString(alloc.getTask().getPeriod());
- }
- });
-
-
- TableViewerColumn colCore = new TableViewerColumn(this,SWT.NONE);
- colCore.getColumn().setWidth(100);
- colCore.getColumn().setText("Core");
-
- colCore.setLabelProvider(new ColumnLabelProvider() {
- @Override
- public String getText(Object element) {
- OMAllocation alloc = (OMAllocation) element;
- return alloc.getCore().getCoreRef().getName();
- }
- });
- TableViewerColumn colWCET = new TableViewerColumn(this, SWT.NONE);
- colWCET.getColumn().setWidth(150);
- colWCET.getColumn().setText("WCET (ps)");
- colWCET.setLabelProvider(new ColumnLabelProvider() {
- @Override
- public String getText(Object element) {
- OMAllocation alloc = (OMAllocation) element;
- try {
- return Long.toString(alloc.calculateProcessingTime());
- } catch (MalformedModelException e) {
- e.printStackTrace();
- return "Malformed Model";
- }
- }
- });
-
- TableViewerColumn colEP = new TableViewerColumn(this, SWT.NONE);
- colEP.getColumn().setWidth(100);
- colEP.getColumn().setText("WCET/P");
- colEP.setLabelProvider(new ColumnLabelProvider() {
- @Override
- public String getText(Object element) {
- OMAllocation alloc = (OMAllocation) element;
- double x;
- try {
- x = alloc.calculateProcessingTime();
- } catch (MalformedModelException e) {
- e.printStackTrace();
- return "Malformed Model";
- }
- x /= alloc.getTask().getPeriod();
- return String.format("%1$,.4f", x);
- }
- });
- }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.ui.simmenu.wizards;
+
+import java.util.List;
+
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.MalformedModelException;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMAllocation;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+
+
+public class SWTAllocationTable extends TableViewer{
+
+
+ public SWTAllocationTable(Composite parent, List<OMAllocation> model) {
+ super(parent,SWT.MULTI | SWT.H_SCROLL
+ | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
+
+ setContentProvider(ArrayContentProvider.getInstance());
+ setInput(model);
+ setupColumns();
+ refresh();
+ }
+
+ private void setupColumns() {
+ final Table table = getTable();
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+
+
+ TableViewerColumn colTask = new TableViewerColumn(this, SWT.NONE);
+ colTask.getColumn().setWidth(100);
+ colTask.getColumn().setText("Task");
+ colTask.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ OMAllocation alloc = (OMAllocation) element;
+ return alloc.getTask().getTaskRef().getName();
+ }
+ });
+
+ TableViewerColumn colInst = new TableViewerColumn(this, SWT.NONE);
+ colInst.getColumn().setWidth(150);
+ colInst.getColumn().setText("Instructions");
+ colInst.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ OMAllocation alloc = (OMAllocation) element;
+ return Long.toString(alloc.getTask().getInstructionCount());
+ }
+ });
+
+ TableViewerColumn colPeriod = new TableViewerColumn(this, SWT.NONE);
+ colPeriod.getColumn().setWidth(150);
+ colPeriod.getColumn().setText("Period (ps)");
+ colPeriod.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ OMAllocation alloc = (OMAllocation) element;
+ return Long.toString(alloc.getTask().getPeriod());
+ }
+ });
+
+
+ TableViewerColumn colCore = new TableViewerColumn(this,SWT.NONE);
+ colCore.getColumn().setWidth(100);
+ colCore.getColumn().setText("Core");
+
+ colCore.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ OMAllocation alloc = (OMAllocation) element;
+ return alloc.getCore().getCoreRef().getName();
+ }
+ });
+ TableViewerColumn colWCET = new TableViewerColumn(this, SWT.NONE);
+ colWCET.getColumn().setWidth(150);
+ colWCET.getColumn().setText("WCET (ps)");
+ colWCET.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ OMAllocation alloc = (OMAllocation) element;
+ try {
+ return Long.toString(alloc.calculateProcessingTime());
+ } catch (MalformedModelException e) {
+ e.printStackTrace();
+ return "Malformed Model";
+ }
+ }
+ });
+
+ TableViewerColumn colEP = new TableViewerColumn(this, SWT.NONE);
+ colEP.getColumn().setWidth(100);
+ colEP.getColumn().setText("WCET/P");
+ colEP.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ OMAllocation alloc = (OMAllocation) element;
+ double x;
+ try {
+ x = alloc.calculateProcessingTime();
+ } catch (MalformedModelException e) {
+ e.printStackTrace();
+ return "Malformed Model";
+ }
+ x /= alloc.getTask().getPeriod();
+ return String.format("%1$,.4f", x);
+ }
+ });
+ }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/TaskVisuDependencyPage.java b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/TaskVisuDependencyPage.java
index f9e2ae66..424fffbf 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/TaskVisuDependencyPage.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/TaskVisuDependencyPage.java
@@ -1,232 +1,232 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.ui.simmenu.wizards;
-
-import java.awt.Frame;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import org.eclipse.app4mc.amalthea.model.ConstraintsModel;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.MalformedModelException;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMAllocation;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMCore;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMEdge;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMMapping;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMTask;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMUtil;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.awt.SWT_AWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-
-import com.mxgraph.layout.hierarchical.mxHierarchicalLayout;
-import com.mxgraph.swing.mxGraphComponent;
-import com.mxgraph.util.mxConstants;
-import com.mxgraph.view.mxGraph;
-
-public class TaskVisuDependencyPage extends WizardPage {
-
- private Composite container;
-
-
- private mxGraph graph;
- private mxGraphComponent graph_view;
-
- private Button cbConsiderPrecedence;
-
- private ConstraintsModel cm;
-
- private OMMapping model;
-
- private Set<Object> consideredGraphEdges = new HashSet<>();
-
- private List<OMAllocation> allocationList;
- private List<OMTask> tasklist;
-
- private Collection<OMEdge> consideredEdges;
-
- protected TaskVisuDependencyPage(String pageName) {
- super(pageName);
- }
-
- public TaskVisuDependencyPage(OMMapping model, ConstraintsModel cm) {
- super("Task Visualisation: Task Dependencies");
- setTitle("Task Visualisation: Task Dependencies");
- this.model = model;
- this.cm = cm;
- }
-
- @Override
- public void createControl(Composite parent) {
- container = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- container.setLayout(layout);
-
- try {
- allocationList = model.getAllocationList();
- tasklist=allocationList.stream().map(OMAllocation::getTask).collect(Collectors.toList());
- OMUtil.createOMTaskGraph(tasklist, cm); //TODO async task
-
- createGraph();
- Composite embeddedComposite = new Composite(container, SWT.EMBEDDED | SWT.NO_BACKGROUND );
- GridData embedGraphData=new GridData(SWT.FILL, SWT.FILL, true, true);
- embedGraphData.verticalSpan = 2;
- embeddedComposite.setLayoutData(embedGraphData);
- Frame frame = SWT_AWT.new_Frame(embeddedComposite);
- frame.add(graph_view);
- frame.setVisible(true);
-
- cbConsiderPrecedence = new Button(container, SWT.CHECK );
- cbConsiderPrecedence.setText("Consider task precedence!\n");
- Label filterinfo= new Label(container, SWT.WRAP | SWT.BORDER | SWT.LEFT);
- filterinfo.setText(
- "Relations filter: "
- + "\n- No edges with unequal periods of pre- and post-task."
- + "\n- No edges with same pre- and post-task (selftransition)."
- + "\n- If there are multiple edges between two tasks the edge "
- + "\n with the highest release time is chosen.");
-
- cbConsiderPrecedence.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
-
- if(!OMUtil.isDAG(consideredEdges)){
- MessageDialog.openInformation(getShell(),
- "Task Visualization", "Directed cylic Graphs are not supported!");
- cbConsiderPrecedence.setSelection(false);
- return;
- }
-
- if(cbConsiderPrecedence.getSelection()){
- graph.setCellStyles(mxConstants.STYLE_STROKECOLOR, "red", consideredGraphEdges.toArray());
- }else{
- graph.setCellStyles(mxConstants.STYLE_STROKECOLOR, "blue", consideredGraphEdges.toArray());
- }
- }
- });
-
- } catch (MalformedModelException e) {
- e.printStackTrace();
- }
-
- setControl(container);
- setPageComplete(true);
- }
-
- private void createGraph() {
- graph = new mxGraph();
-
- graph.setCellsEditable(false);
- // graph.setCellsDeletable(false);
-// graph.setConnectableEdges(false);
-
- // addExampleDataToGraph();
- addModelDataToGraph();
-
- layoutGraph();
- graph_view = new mxGraphComponent(graph);
- graph_view.setConnectable(false);
- }
-
- private void addModelDataToGraph() {
-
- Object parent = graph.getDefaultParent();
- Map<OMTask, Object> celllist = new HashMap<>();
-
- for(OMAllocation alloc: allocationList){
- OMTask task = alloc.getTask();
- Object x = graph.insertVertex(parent, null, task.getTaskRef().getName(), 0, 0, 80, 30);
- celllist.put(task, x);
- }
-
- Map<OMEdge,Object> edgemap=new HashMap<>();
-
- for (OMAllocation alloc : allocationList) {
- OMTask pre = alloc.getTask();
- OMCore core= alloc.getCore();
-
- for (OMEdge postEdge : pre.getPosts()) {
-
- OMTask post=postEdge.getPost();
- long instruction = postEdge.getReleaseInstruction();
-
- long time;
- try {
- time = OMUtil.getProcessingTime(core, instruction);
- Object edge = graph.insertEdge(parent, null, ""+time + " ps", celllist.get(pre), celllist.get(post));
- edgemap.put(postEdge,edge);
- } catch (MalformedModelException e) {
- e.printStackTrace();
- }
-
- }
- }
- consideredEdges= Util.getConsideredEdges(tasklist);
-
- for(OMEdge edge:consideredEdges){
- consideredGraphEdges.add(edgemap.get(edge));
- }
-
- }
-
- public boolean considerTaskPrecedence() {
- if (cbConsiderPrecedence != null) {
- return cbConsiderPrecedence.getSelection();
- }
- return false;
- }
-
- public Collection<OMEdge> getTaskPrecedences() {
- return consideredEdges;
- }
-
-// private void addExampleDataToGraph() {
-// Object parent = graph.getDefaultParent();
-// graph.getModel().beginUpdate();
-// Object v1 = graph.insertVertex(parent, null, "SpeedSensor", 0, 0, 80, 30);
-// Object v2 = graph.insertVertex(parent, null, "Checker", 0, 0, 80, 30);
-// Object v3 = graph.insertVertex(parent, null, "SpeedSensor2", 0, 0, 80, 30);
-// Object v4 = graph.insertVertex(parent, null, "MotorActuator", 0, 0, 80, 30);
-//
-// Object edge1 = graph.insertEdge(parent, null, "a", v1, v2);
-//
-// graph.setCellStyles(mxConstants.STYLE_STROKECOLOR, "red", new Object[] { edge1 });
-// // graph.setCellSt
-// graph.insertEdge(parent, null, "b", v3, v2);
-// graph.insertEdge(parent, null, "c", v2, v4);
-// graph.getModel().endUpdate();
-// }
-
- private void layoutGraph() {
-
- new mxHierarchicalLayout(graph).execute(graph.getDefaultParent());
- // new mxParallelEdgeLayout(graph).execute(graph.getDefaultParent());
- }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.ui.simmenu.wizards;
+
+import java.awt.Frame;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.eclipse.app4mc.amalthea.model.ConstraintsModel;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.MalformedModelException;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMAllocation;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMCore;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMEdge;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMMapping;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMTask;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMUtil;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.awt.SWT_AWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+import com.mxgraph.layout.hierarchical.mxHierarchicalLayout;
+import com.mxgraph.swing.mxGraphComponent;
+import com.mxgraph.util.mxConstants;
+import com.mxgraph.view.mxGraph;
+
+public class TaskVisuDependencyPage extends WizardPage {
+
+ private Composite container;
+
+
+ private mxGraph graph;
+ private mxGraphComponent graph_view;
+
+ private Button cbConsiderPrecedence;
+
+ private ConstraintsModel cm;
+
+ private OMMapping model;
+
+ private Set<Object> consideredGraphEdges = new HashSet<>();
+
+ private List<OMAllocation> allocationList;
+ private List<OMTask> tasklist;
+
+ private Collection<OMEdge> consideredEdges;
+
+ protected TaskVisuDependencyPage(String pageName) {
+ super(pageName);
+ }
+
+ public TaskVisuDependencyPage(OMMapping model, ConstraintsModel cm) {
+ super("Task Visualisation: Task Dependencies");
+ setTitle("Task Visualisation: Task Dependencies");
+ this.model = model;
+ this.cm = cm;
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ container = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ container.setLayout(layout);
+
+ try {
+ allocationList = model.getAllocationList();
+ tasklist=allocationList.stream().map(OMAllocation::getTask).collect(Collectors.toList());
+ OMUtil.createOMTaskGraph(tasklist, cm); //TODO async task
+
+ createGraph();
+ Composite embeddedComposite = new Composite(container, SWT.EMBEDDED | SWT.NO_BACKGROUND );
+ GridData embedGraphData=new GridData(SWT.FILL, SWT.FILL, true, true);
+ embedGraphData.verticalSpan = 2;
+ embeddedComposite.setLayoutData(embedGraphData);
+ Frame frame = SWT_AWT.new_Frame(embeddedComposite);
+ frame.add(graph_view);
+ frame.setVisible(true);
+
+ cbConsiderPrecedence = new Button(container, SWT.CHECK );
+ cbConsiderPrecedence.setText("Consider task precedence!\n");
+ Label filterinfo= new Label(container, SWT.WRAP | SWT.BORDER | SWT.LEFT);
+ filterinfo.setText(
+ "Relations filter: "
+ + "\n- No edges with unequal periods of pre- and post-task."
+ + "\n- No edges with same pre- and post-task (selftransition)."
+ + "\n- If there are multiple edges between two tasks the edge "
+ + "\n with the highest release time is chosen.");
+
+ cbConsiderPrecedence.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+
+ if(!OMUtil.isDAG(consideredEdges)){
+ MessageDialog.openInformation(getShell(),
+ "Task Visualization", "Directed cylic Graphs are not supported!");
+ cbConsiderPrecedence.setSelection(false);
+ return;
+ }
+
+ if(cbConsiderPrecedence.getSelection()){
+ graph.setCellStyles(mxConstants.STYLE_STROKECOLOR, "red", consideredGraphEdges.toArray());
+ }else{
+ graph.setCellStyles(mxConstants.STYLE_STROKECOLOR, "blue", consideredGraphEdges.toArray());
+ }
+ }
+ });
+
+ } catch (MalformedModelException e) {
+ e.printStackTrace();
+ }
+
+ setControl(container);
+ setPageComplete(true);
+ }
+
+ private void createGraph() {
+ graph = new mxGraph();
+
+ graph.setCellsEditable(false);
+ // graph.setCellsDeletable(false);
+// graph.setConnectableEdges(false);
+
+ // addExampleDataToGraph();
+ addModelDataToGraph();
+
+ layoutGraph();
+ graph_view = new mxGraphComponent(graph);
+ graph_view.setConnectable(false);
+ }
+
+ private void addModelDataToGraph() {
+
+ Object parent = graph.getDefaultParent();
+ Map<OMTask, Object> celllist = new HashMap<>();
+
+ for(OMAllocation alloc: allocationList){
+ OMTask task = alloc.getTask();
+ Object x = graph.insertVertex(parent, null, task.getTaskRef().getName(), 0, 0, 80, 30);
+ celllist.put(task, x);
+ }
+
+ Map<OMEdge,Object> edgemap=new HashMap<>();
+
+ for (OMAllocation alloc : allocationList) {
+ OMTask pre = alloc.getTask();
+ OMCore core= alloc.getCore();
+
+ for (OMEdge postEdge : pre.getPosts()) {
+
+ OMTask post=postEdge.getPost();
+ long instruction = postEdge.getReleaseInstruction();
+
+ long time;
+ try {
+ time = OMUtil.getProcessingTime(core, instruction);
+ Object edge = graph.insertEdge(parent, null, ""+time + " ps", celllist.get(pre), celllist.get(post));
+ edgemap.put(postEdge,edge);
+ } catch (MalformedModelException e) {
+ e.printStackTrace();
+ }
+
+ }
+ }
+ consideredEdges= Util.getConsideredEdges(tasklist);
+
+ for(OMEdge edge:consideredEdges){
+ consideredGraphEdges.add(edgemap.get(edge));
+ }
+
+ }
+
+ public boolean considerTaskPrecedence() {
+ if (cbConsiderPrecedence != null) {
+ return cbConsiderPrecedence.getSelection();
+ }
+ return false;
+ }
+
+ public Collection<OMEdge> getTaskPrecedences() {
+ return consideredEdges;
+ }
+
+// private void addExampleDataToGraph() {
+// Object parent = graph.getDefaultParent();
+// graph.getModel().beginUpdate();
+// Object v1 = graph.insertVertex(parent, null, "SpeedSensor", 0, 0, 80, 30);
+// Object v2 = graph.insertVertex(parent, null, "Checker", 0, 0, 80, 30);
+// Object v3 = graph.insertVertex(parent, null, "SpeedSensor2", 0, 0, 80, 30);
+// Object v4 = graph.insertVertex(parent, null, "MotorActuator", 0, 0, 80, 30);
+//
+// Object edge1 = graph.insertEdge(parent, null, "a", v1, v2);
+//
+// graph.setCellStyles(mxConstants.STYLE_STROKECOLOR, "red", new Object[] { edge1 });
+// // graph.setCellSt
+// graph.insertEdge(parent, null, "b", v3, v2);
+// graph.insertEdge(parent, null, "c", v2, v4);
+// graph.getModel().endUpdate();
+// }
+
+ private void layoutGraph() {
+
+ new mxHierarchicalLayout(graph).execute(graph.getDefaultParent());
+ // new mxParallelEdgeLayout(graph).execute(graph.getDefaultParent());
+ }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/TaskVisuOverviewPage.java b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/TaskVisuOverviewPage.java
index a96d3237..ff96008d 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/TaskVisuOverviewPage.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/TaskVisuOverviewPage.java
@@ -1,142 +1,142 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.ui.simmenu.wizards;
-
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.MalformedModelException;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMCore;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMMapping;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMTask;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMUtil;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ColumnLabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-
-public class TaskVisuOverviewPage extends WizardPage {
-// private Text text1;
- private Composite container;
- @SuppressWarnings("unused")
- private TableViewer tv_allocations;
- private TableViewer tv_coreoverview;
-
- private final OMMapping model;
-
- public TaskVisuOverviewPage(OMMapping model) {
- super("Task Visualisation: Overview");
- setTitle("Task Visualisation: Overview");
- setDescription("This page gives an overview of the visualisation input.");
- this.model = model;
- }
-
- @Override
- public void createControl(Composite parent) {
- container = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- container.setLayout(layout);
- layout.numColumns = 1;
-
- setupAllocsOverview();
- setupCoreOverview();
-
- // required to avoid an error in the system
- setControl(container);
- setPageComplete(true);
- }
-
- private void setupCoreOverview() {
- Label label1 = new Label(container, SWT.NONE);
- label1.setText("Cores");
-
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.horizontalSpan = 1;
-
- tv_coreoverview = new TableViewer(container, SWT.MULTI | SWT.H_SCROLL
- | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
- final Table table = tv_coreoverview.getTable();
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- table.setLayoutData(gridData);
-
- final Map<OMCore, List<OMTask>> tmpmodel = OMUtil.getCoreTaskMap(model.getAllocationList());
- tv_coreoverview.setContentProvider(new ArrayContentProvider());
- tv_coreoverview.setInput(tmpmodel.keySet());
-
- TableViewerColumn colCore = new TableViewerColumn(tv_coreoverview, SWT.NONE);
- colCore.getColumn().setWidth(100);
- colCore.getColumn().setText("Core");
- colCore.setLabelProvider(new ColumnLabelProvider() {
- @Override
- public String getText(Object element) {
- OMCore core = (OMCore) element;
- return core.getCoreRef().getName();
- }
- });
-
- TableViewerColumn colIPs = new TableViewerColumn(tv_coreoverview, SWT.NONE);
- colIPs.getColumn().setWidth(100);
- colIPs.getColumn().setText("IPS");
- colIPs.setLabelProvider(new ColumnLabelProvider() {
- @Override
- public String getText(Object element) {
- OMCore core = (OMCore) element;
- try {
- return ""+core.getInstructionsPerSecond();
- } catch (MalformedModelException e) {
- e.printStackTrace();
- return "Malformed Model";
- }
- }
- });
-
- TableViewerColumn colUtilization = new TableViewerColumn(tv_coreoverview, SWT.NONE);
- colUtilization.getColumn().setWidth(100);
- colUtilization.getColumn().setText("Utilization");
- colUtilization.setLabelProvider(new ColumnLabelProvider() {
- @Override
- public String getText(Object element) {
- OMCore core = (OMCore) element;
- double util;
- try {
- util = OMUtil.getUtilization(core, tmpmodel.get(core));
- return String.format("%1$,.4f", util);
- } catch (MalformedModelException e) {
- e.printStackTrace();
- return "Malformed model";
- }
-
- }
- });
- tv_coreoverview.refresh(); //update to notify new columns
- }
-
- private void setupAllocsOverview() {
- Label label1 = new Label(container, SWT.NONE);
- label1.setText("Allocations");
- tv_allocations = new SWTAllocationTable(container, model.getAllocationList());
- }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.ui.simmenu.wizards;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.MalformedModelException;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMCore;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMMapping;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMTask;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMUtil;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+
+public class TaskVisuOverviewPage extends WizardPage {
+ // private Text text1;
+ private Composite container;
+ @SuppressWarnings("unused")
+ private TableViewer tv_allocations;
+ private TableViewer tv_coreoverview;
+
+ private final OMMapping model;
+
+ public TaskVisuOverviewPage(OMMapping model) {
+ super("Task Visualisation: Overview");
+ setTitle("Task Visualisation: Overview");
+ setDescription("This page gives an overview of the visualisation input.");
+ this.model = model;
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ container = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ container.setLayout(layout);
+ layout.numColumns = 1;
+
+ setupAllocsOverview();
+ setupCoreOverview();
+
+ // required to avoid an error in the system
+ setControl(container);
+ setPageComplete(true);
+ }
+
+ private void setupCoreOverview() {
+ Label label1 = new Label(container, SWT.NONE);
+ label1.setText("Cores");
+
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.horizontalSpan = 1;
+
+ tv_coreoverview = new TableViewer(container,
+ SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
+ final Table table = tv_coreoverview.getTable();
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ table.setLayoutData(gridData);
+
+ final Map<OMCore, List<OMTask>> tmpmodel = OMUtil.getCoreTaskMap(model.getAllocationList());
+ tv_coreoverview.setContentProvider(new ArrayContentProvider());
+ tv_coreoverview.setInput(tmpmodel.keySet());
+
+ TableViewerColumn colCore = new TableViewerColumn(tv_coreoverview, SWT.NONE);
+ colCore.getColumn().setWidth(100);
+ colCore.getColumn().setText("Core");
+ colCore.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ OMCore core = (OMCore) element;
+ return core.getCoreRef().getName();
+ }
+ });
+
+ TableViewerColumn colIPs = new TableViewerColumn(tv_coreoverview, SWT.NONE);
+ colIPs.getColumn().setWidth(100);
+ colIPs.getColumn().setText("Freq.");
+ colIPs.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ OMCore core = (OMCore) element;
+ try {
+ return "" + core.getFrequencyHz();
+ } catch (MalformedModelException e) {
+ e.printStackTrace();
+ return "Malformed Model";
+ }
+ }
+ });
+
+ TableViewerColumn colUtilization = new TableViewerColumn(tv_coreoverview, SWT.NONE);
+ colUtilization.getColumn().setWidth(100);
+ colUtilization.getColumn().setText("Utilization");
+ colUtilization.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ OMCore core = (OMCore) element;
+ double util;
+ try {
+ util = OMUtil.getUtilization(core, tmpmodel.get(core));
+ return String.format("%1$,.4f", util);
+ } catch (MalformedModelException e) {
+ e.printStackTrace();
+ return "Malformed model";
+ }
+
+ }
+ });
+ tv_coreoverview.refresh(); // update to notify new columns
+ }
+
+ private void setupAllocsOverview() {
+ Label label1 = new Label(container, SWT.NONE);
+ label1.setText("Allocations");
+ tv_allocations = new SWTAllocationTable(container, model.getAllocationList());
+ }
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/TaskVisuSchedulingPage.java b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/TaskVisuSchedulingPage.java
index 3a578a93..8a2e3124 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/TaskVisuSchedulingPage.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/TaskVisuSchedulingPage.java
@@ -1,222 +1,283 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.ui.simmenu.wizards;
-
-import java.text.DecimalFormat;
-import java.util.stream.Collectors;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.misc.EMTimeType;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMAllocation;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMMapping;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMUtil;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.SchedulerAlgorithmRegister;
-import org.eclipse.app4mc.multicore.execution.ui.widget.emtracewidget.IEMTraceWidget;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-public class TaskVisuSchedulingPage extends WizardPage {
-
- private static final String[] SIM_TIME_INCREMENT = {"ms","us","ns","ps"};
- private static final EMTimeType[] SIM_TIME_SCALE = {EMTimeType.MS,EMTimeType.US,EMTimeType.NS,EMTimeType.PS};
-
-// private static final long[] SIM_TIME_INC_PS_PER = {1000L*1000L*1000L,1000L*1000L,1000L,1};
-
- private Composite container;
- private Text txt_simuntil;
- private Combo cb_schedulerSelection;
-
-// final private IEMTraceWidget tw;
- final private OMMapping model;
-// final private Map<OMCore, List<OMTask>> coreTaskMap;
-
- private long majorCycle=0;
- private long simuntil=0;
-
- private String scheduling ="";
- private EMTimeType timescale;
- private Combo cb_precessionSelection;
-
- protected TaskVisuSchedulingPage(IEMTraceWidget tw, OMMapping model) {
- super("Task Visualisation: Scheduling");
-// this.tw = tw;
- this.model = model;
-// coreTaskMap = OMUtil.getCoreTaskMap(omModel.getAllocationList());
- setTitle("Task Visualisation: Scheduling");
- setDescription("Setup the scheduling used for the visualisation.");
- }
-
- @Override
- public void createControl(Composite parent) {
- container = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- container.setLayout(layout);
- layout.numColumns = 2;
-
- majorCycle = OMUtil.getMajorCycle(model.getAllocationList().stream().map(OMAllocation::getTask).collect(Collectors.toList()));
- Label lbl_majorCycle = new Label(container, SWT.NONE);
- lbl_majorCycle.setText("Major-Cycle / Hyperperiod (ps)");
-
- DecimalFormat decimalFormat = new DecimalFormat("#,##0");
- String numberAsString = decimalFormat.format(majorCycle);
- Label lbl_majorCycleVal = new Label(container, SWT.NONE);
- lbl_majorCycleVal.setText(numberAsString);
- lbl_majorCycleVal.addMouseListener(new MouseListener() {
- @Override
- public void mouseUp(MouseEvent e) {
- }
- @Override
- public void mouseDown(MouseEvent e) {
- }
-
- @Override
- public void mouseDoubleClick(MouseEvent e) {
- if(txt_simuntil!=null){
- txt_simuntil.setText(majorCycle+"");
- }
- }
- });
-
- Label lbl_seconds = new Label(container, SWT.NONE);
- lbl_seconds.setText(" ");
-
- Label lbl_majorCycleVal2 = new Label(container, SWT.NONE);
- lbl_majorCycleVal2.setText(psToString(majorCycle));
-
- Label label1 = new Label(container, SWT.NONE);
- label1.setText("Algorithm");
-
- cb_schedulerSelection = new Combo(container, SWT.READ_ONLY);
- cb_schedulerSelection.setItems(SchedulerAlgorithmRegister.schedulerList());
- cb_schedulerSelection.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- int i = cb_schedulerSelection.getSelectionIndex();
- if(i!=-1){
- scheduling = SchedulerAlgorithmRegister.schedulerList()[i];
- setPageComplete(isReadyToSim());
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
-
- Label labeltimeinc = new Label(container, SWT.NONE);
- labeltimeinc.setText("Scale to");
-
- cb_precessionSelection = new Combo(container, SWT.READ_ONLY);
- cb_precessionSelection.setItems(SIM_TIME_INCREMENT);
- cb_precessionSelection.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- int i = cb_precessionSelection.getSelectionIndex();
- if(i!=-1){
- timescale = SIM_TIME_SCALE[i];
- setPageComplete(isReadyToSim());
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
-
-
- Label labelCheck = new Label(container, SWT.NONE);
- labelCheck.setText("Simulation-Time (ps)");
- txt_simuntil = new Text(container, SWT.NONE);
- simuntil = majorCycle;
- txt_simuntil.setText("" + majorCycle);
-
- txt_simuntil.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent ev) {
- String text = ((Text)ev.getSource()).getText();
- try{
- simuntil = Long.parseLong(text);
- }catch (NumberFormatException ex){
- simuntil = 0;
- }
- setPageComplete(isReadyToSim());
- }
- });
-
- //
- // Button check = new Button(container, SWT.CHECK);
- // check.setSelection(true);
-
- setControl(container);
- setPageComplete(isReadyToSim());
- }
-
-
- private boolean isReadyToSim(){
- return simuntil != 0 && //valid simulation time
- cb_schedulerSelection!= null && // combobox is instantiated
- cb_schedulerSelection.getSelectionIndex() != -1 && // combobox item selected
- cb_precessionSelection!= null &&
- cb_precessionSelection.getSelectionIndex() != -1;
- }
-
-
-
- private String psToString(long ps){
- if((ps%1000)!=0){
- return ps + " ps";
- }else if((ps % 1000000)!=0){
- return ps/1000 +" ns";
- }else if((ps % 1000000000)!=0){
- return ps/1000000+" us";
- }else{
- return ps/1000000000+ " ms";
- }
- }
-
- /**
- * Get the time until the simulation should run.
- * @return
- */
- public long getSimuntil() {
- return simuntil;
- }
-
- /**
- * Get the key-name of the scheduling.
- * @return
- */
- public String getScheduling() {
- return scheduling;
- }
-
- public EMTimeType getTimeScale(){
- return timescale;
- }
-
-
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.ui.simmenu.wizards;
+
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.misc.EMTimeType;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMAllocation;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMMapping;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMUtil;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.SchedulerAlgorithmRegister;
+import org.eclipse.app4mc.multicore.execution.model.XContainer;
+import org.eclipse.app4mc.multicore.execution.ui.widget.emtracewidget.IEMTraceWidget;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+
+import java.text.DecimalFormat;
+import java.util.stream.Collectors;
+
+
+public class TaskVisuSchedulingPage extends WizardPage {
+
+ private static final String[] SIM_TIME_INCREMENT = {"ms","us","ns","ps"};
+ private static final EMTimeType[] SIM_TIME_SCALE = {EMTimeType.MS,EMTimeType.US,EMTimeType.NS,EMTimeType.PS};
+ private Button button3,button4;
+ // private static final long[] SIM_TIME_INC_PS_PER = {1000L*1000L*1000L,1000L*1000L,1000L,1};
+ private boolean flow;
+ private Composite container;
+ private Text txt_simuntil;
+ private Combo cb_schedulerSelection;
+
+// final private IEMTraceWidget tw;
+ final private OMMapping model;
+// final private Map<OMCore, List<OMTask>> coreTaskMap;
+
+ private long majorCycle=0;
+ private long simuntil=0;
+
+ private String scheduling ="";
+ private EMTimeType timescale;
+ private Combo cb_precessionSelection;
+ private XContainer con;
+ protected TaskVisuSchedulingPage(IEMTraceWidget tw, OMMapping model,XContainer con ) {
+ super("Task Visualisation: Scheduling");
+// this.tw = tw;
+ this.con=con;
+ this.model = model;
+// coreTaskMap = OMUtil.getCoreTaskMap(omModel.getAllocationList());
+ setTitle("Task Visualisation: Scheduling");
+ setDescription("Setup the scheduling used for the visualisation.");
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ container = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ container.setLayout(layout);
+ layout.numColumns = 2;
+
+ majorCycle = OMUtil.getMajorCycle(model.getAllocationList().stream().map(OMAllocation::getTask).collect(Collectors.toList()));
+ Label lbl_majorCycle = new Label(container, SWT.NONE);
+ lbl_majorCycle.setText("Major-Cycle / Hyperperiod (ps)");
+
+ DecimalFormat decimalFormat = new DecimalFormat("#,##0");
+ String numberAsString = decimalFormat.format(majorCycle);
+ Label lbl_majorCycleVal = new Label(container, SWT.NONE);
+ lbl_majorCycleVal.setText(numberAsString);
+ lbl_majorCycleVal.addMouseListener(new MouseListener() {
+ @Override
+ public void mouseUp(MouseEvent e) {
+ }
+ @Override
+ public void mouseDown(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ if(txt_simuntil!=null){
+ txt_simuntil.setText(majorCycle+"");
+ }
+ }
+ });
+
+ Label lbl_seconds = new Label(container, SWT.NONE);
+ lbl_seconds.setText(" ");
+
+ Label lbl_majorCycleVal2 = new Label(container, SWT.NONE);
+ lbl_majorCycleVal2.setText(psToString(majorCycle));
+
+ Label label1 = new Label(container, SWT.NONE);
+ label1.setText("Algorithm");
+
+ cb_schedulerSelection = new Combo(container, SWT.READ_ONLY);
+ cb_schedulerSelection.setItems(SchedulerAlgorithmRegister.schedulerList());
+ cb_schedulerSelection.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ int i = cb_schedulerSelection.getSelectionIndex();
+ if(i!=-1){
+ scheduling = SchedulerAlgorithmRegister.schedulerList()[i];
+ setPageComplete(isReadyToSim());
+ }
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ Label labeltimeinc = new Label(container, SWT.NONE);
+ labeltimeinc.setText("Scale to");
+
+ cb_precessionSelection = new Combo(container, SWT.READ_ONLY);
+ cb_precessionSelection.setItems(SIM_TIME_INCREMENT);
+ cb_precessionSelection.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ int i = cb_precessionSelection.getSelectionIndex();
+ if(i!=-1){
+ timescale = SIM_TIME_SCALE[i];
+ setPageComplete(isReadyToSim());
+ }
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+
+ Label labelCheck = new Label(container, SWT.NONE);
+ labelCheck.setText("Simulation-Time (ps)");
+ txt_simuntil = new Text(container, SWT.NONE);
+ simuntil = majorCycle;
+ txt_simuntil.setText("" + majorCycle);
+
+ txt_simuntil.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent ev) {
+ String text = ((Text)ev.getSource()).getText();
+ try{
+ simuntil = Long.parseLong(text);
+ }catch (NumberFormatException ex){
+ simuntil = 0;
+ }
+ setPageComplete(isReadyToSim());
+ }
+ });
+
+
+ SelectionListener listenerDataFlow = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ Button button = ((Button) event.widget);
+ System.out.print("DataFlow");
+ System.out.println(" selected = " + button.getSelection());
+ button3.setEnabled(button.getSelection());
+ // button4.setEnabled(button.getSelection());
+
+ if (!button.getSelection()){
+ con.setMergingArrow(false);
+ con.setAlternativeArrow(false);
+ button3.setSelection(false);
+ // button4.setSelection(false);
+ }
+
+ con.setDataFlow(button.getSelection());
+
+ };
+ };
+ SelectionListener listenerMergeArrow = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ Button button = ((Button) event.widget);
+ con.setMergingArrow(button.getSelection());
+
+ };
+ };
+ SelectionListener listenerAltArrow = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ Button button = ((Button) event.widget);
+ con.setAlternativeArrow(button.getSelection());
+
+ };
+ };
+
+
+ //# DataFlow Controls
+
+ Label labelDataflow = new Label(container, SWT.NONE);
+ labelDataflow.setText("Show Dataflow in Simulation:");
+
+
+ Button button2 = new Button(container, SWT.CHECK);
+ button2.setText("");
+ button2.addSelectionListener(listenerDataFlow);
+
+ //# ArrowMerging Controls
+
+ Label labelMergeArrow = new Label(container, SWT.NONE);
+ labelMergeArrow.setText("Extended Dataflow Simulation");
+
+ button3 = new Button(container, SWT.CHECK);
+ button3.setEnabled(false);
+ button3.setText("");
+ button3.addSelectionListener(listenerMergeArrow);
+
+ /* /# Alternative Arrow Controls
+
+ Label labelAlternativeArrow = new Label(container, SWT.NONE);
+ labelAlternativeArrow.setText("Alternative Dataflow Arrow");
+
+ button4 = new Button(container, SWT.CHECK);
+ button4.setEnabled(false);
+ button4.setText("");
+ button4.addSelectionListener(listenerAltArrow);
+*/
+ // Button check = new Button(container, SWT.CHECK);
+ // check.setSelection(true);
+
+ setControl(container);
+ setPageComplete(isReadyToSim());
+ }
+
+
+ private boolean isReadyToSim(){
+ return simuntil != 0 && //valid simulation time
+ cb_schedulerSelection!= null && // combobox is instantiated
+ cb_schedulerSelection.getSelectionIndex() != -1 && // combobox item selected
+ cb_precessionSelection!= null &&
+ cb_precessionSelection.getSelectionIndex() != -1;
+ }
+
+
+
+ private String psToString(long ps){
+ if((ps%1000)!=0){
+ return ps + " ps";
+ }else if((ps % 1000000)!=0){
+ return ps/1000 +" ns";
+ }else if((ps % 1000000000)!=0){
+ return ps/1000000+" us";
+ }else{
+ return ps/1000000000+ " ms";
+ }
+ }
+
+ /**
+ * Get the time until the simulation should run.
+ * @return
+ */
+ public long getSimuntil() {
+ return simuntil;
+ }
+
+ /**
+ * Get the key-name of the scheduling.
+ * @return
+ */
+ public String getScheduling() {
+ return scheduling;
+ }
+
+ public EMTimeType getTimeScale(){
+ return timescale;
+ }
+
+
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/TaskVisuWizard.java b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/TaskVisuWizard.java
index 437e5e00..b699fb1b 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/TaskVisuWizard.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/TaskVisuWizard.java
@@ -1,188 +1,353 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.ui.simmenu.wizards;
-
-import java.util.Collection;
-
-import org.eclipse.app4mc.amalthea.model.ConstraintsModel;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.ExecutionModel;
-import org.eclipse.app4mc.multicore.execution.logic.executionmodel.misc.EMTimeType;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.MalformedModelException;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMCore;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMEdge;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMMapping;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMUtil;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.ISystemProxy;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.SimException;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.SystemProxyFactory;
-import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.SchedulerAlgorithmRegister;
-import org.eclipse.app4mc.multicore.execution.ui.traceview.TraceViewUtil;
-//import org.eclipse.app4mc.multicore.execution.ui.traceview.TraceViewUtil;
-import org.eclipse.app4mc.multicore.execution.ui.widget.emtracewidget.IEMTraceWidget;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-//import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.swt.widgets.Display;
-
-public class TaskVisuWizard extends Wizard {
-
- protected TaskVisuOverviewPage page1;
- protected TaskVisuDependencyPage page2;
- protected TaskVisuSchedulingPage page3;
-
- protected IEMTraceWidget tw;
- protected OMMapping omModel;
- protected ConstraintsModel cm;
-
- private ISystemProxy systemProxy;
-
-
- /**
- * Create task visualization wizard
- *
- * @param tw
- * TraceView have to be opened before
- * @param omModel
- */
- public TaskVisuWizard(IEMTraceWidget tw, OMMapping model, ConstraintsModel cm) {
- this.tw = tw;
- this.omModel = model;
- this.cm = cm;
- }
-
- @Override
- public String getWindowTitle() {
- return "Task Visualization Wizard";
- }
-
- @Override
- public void addPages() {
- page1 = new TaskVisuOverviewPage(omModel);
- page2 = new TaskVisuDependencyPage(omModel,cm);
- page3 = new TaskVisuSchedulingPage(tw, omModel);
-
- addPage(page1);
- addPage(page2);
- addPage(page3);
- }
-
-
-
- @Override
- public boolean performFinish() {
- final String sched = page3.getScheduling();
- final long schedtime = page3.getSimuntil();
- final EMTimeType timeScale = page3.getTimeScale();
-
- final Collection<OMEdge> taskPrecedence= page2.getTaskPrecedences();
- boolean considerPrecedence= page2.considerTaskPrecedence();
-
- final Job job = new Job("Task Visualisation Job") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
-
- try {
- ExecutionModel execResult = new ExecutionModel();
- execResult.setTimeScale(timeScale);
- systemProxy = SystemProxyFactory.createEMSystemProxyFromOMMapping(timeScale.picos(), SchedulerAlgorithmRegister.schedulerFactoryByName(sched), omModel,execResult);
- if(considerPrecedence){
- for(OMEdge edge: taskPrecedence){
- OMCore preCore = OMUtil.getCoreForTask(omModel, edge.getPre());
- OMCore postCore = OMUtil.getCoreForTask(omModel, edge.getPost());
- long releaseTime=OMUtil.getProcessingTime(preCore, edge.getReleaseInstruction());
-
- systemProxy.addTaskPrecedence(preCore.getCoreRef().getName(), edge.getPre().getTaskRef().getName(), releaseTime
- , postCore.getCoreRef().getName(),edge.getPost().getTaskRef().getName());
- }
- }
-
-
- tw.addExecutionModel(execResult);
- System.err.println("STARTING SIM");
-
-// SubMonitor subMonitor = SubMonitor.convert(monitor, 100*systemProxy.getSchedulers().size());
-
-// for(IScheduler sched: systemProxy.getSchedulers().values() ){
-// sched.addProgressListener(new Consumer<Integer>() {
-// int prev=0;
-// @Override
-// public void accept(Integer t) {
-// if(subMonitor.isCanceled()){
-// getThread().interrupt();
-// }
-// subMonitor.newChild(t-prev);
-// prev=t;
-// }
-// });
-// }
-
-
- long cur = System.currentTimeMillis();
-// monitor.beginTask("", totalWork);
- systemProxy.compute(schedtime);
- monitor.done();
- System.err.println("READY duration:" + (System.currentTimeMillis()-cur));
- } catch (SimException | MalformedModelException e) {
- e.printStackTrace();
- getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openInformation(TraceViewUtil.getTraceViewPart().getSite().getShell(),
- "Task Visualization", e.getMessage());
- }
- });
- }
-
- // If you want to update the UI
- // Display.asyncExec(new Runnable() {
- // @Override
- // public void run() {
- // // do something in the user interface
- // // e.g. set a text field
- // }
- // });
- return Status.OK_STATUS;
- }
-
- @Override
- protected void canceling() {
- super.canceling();
- System.err.println("Canceling task visualization");
- if(systemProxy!=null){
- systemProxy.interruptComputation();
- }
- }
- };
-
- // Start the Job
- job.schedule();
-
- return true;
- }
-
- public static Display getDisplay() {
- Display display = Display.getCurrent();
- //may be null if outside the UI thread
- if (display == null)
- display = Display.getDefault();
- return display;
- }
-
-}
+/**
+ ********************************************************************************
+ * Copyright (c) 2019 Dortmund University of Applied Sciences and Arts and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Dortmund University of Applied Sciences and Arts - initial API and implementation
+ ********************************************************************************
+ */
+
+package org.eclipse.app4mc.multicore.execution.ui.simmenu.wizards;
+
+import org.eclipse.app4mc.amalthea.model.ConstraintsModel;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.ExecutionModel;
+import org.eclipse.app4mc.multicore.execution.logic.executionmodel.misc.EMTimeType;
+import org.eclipse.app4mc.multicore.execution.logic.openmapping.*;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.ISystemProxy;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.SimException;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.SystemProxyFactory;
+import org.eclipse.app4mc.multicore.execution.logic.systemproxy.scheduler.SchedulerAlgorithmRegister;
+import org.eclipse.app4mc.multicore.execution.model.XContainer;
+import org.eclipse.app4mc.multicore.execution.ui.traceview.TraceViewUtil;
+import org.eclipse.app4mc.multicore.execution.ui.widget.emtracewidget.IEMTraceWidget;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Display;
+
+import javax.swing.*;
+import javax.swing.border.EmptyBorder;
+import java.awt.*;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.Collection;
+import java.util.Iterator;
+
+//import org.eclipse.app4mc.multicore.execution.ui.traceview.TraceViewUtil;
+//import org.eclipse.core.runtime.SubMonitor;
+
+public class TaskVisuWizard extends Wizard {
+
+ protected TaskVisuOverviewPage page1;
+ protected TaskVisuDependencyPage page2;
+ protected TaskVisuSchedulingPage page3;
+
+ protected IEMTraceWidget tw;
+ protected OMMapping omModel;
+ protected ConstraintsModel cm;
+
+ private ISystemProxy systemProxy;
+ XContainer con;
+
+
+ /**
+ * Create task visualization wizard
+ *
+ * @param omModel
+ * @param tw
+ * TraceView have to be opened before
+ * @param path
+ */
+ private String pa;
+ public TaskVisuWizard(IEMTraceWidget tw, OMMapping model, ConstraintsModel cm, String path) {
+ this.tw = tw;
+ this.omModel = model;
+ this.cm = cm;
+ this.pa=path;
+ con=XContainer.newInstance();
+
+
+ //vievModel(this.omModel);
+ }
+
+
+ public void vievModel (OMMapping omM)
+ {
+ System.out.println("###############Start Inspection########################");
+ Iterator <OMAllocation> it=omM.getAllocationList().iterator();
+ OMAllocation tmp;
+ while (it.hasNext())
+ {
+ tmp=it.next();
+ OMTask ttp =tmp.getTask();
+ Iterator <OMRunnable> list=ttp.getRunnableCallSequence().iterator();
+ System.out.println(tmp.getCore() +" "+ ttp );
+ while(list.hasNext()){
+ System.out.println("### -> "+list.next().getRunnableRef().toString().split(" ")[2]);
+ }
+ }
+
+ System.out.println("###############Start Inspection########################");
+
+
+ }
+
+ @Override
+ public String getWindowTitle() {
+ return "Task Visualization Wizard";
+ }
+
+ @Override
+ public void addPages() {
+ page1 = new TaskVisuOverviewPage(omModel);
+ page2 = new TaskVisuDependencyPage(omModel,cm);
+ page3 = new TaskVisuSchedulingPage(tw, omModel,con);
+
+ addPage(page1);
+ addPage(page2);
+ addPage(page3);
+ }
+
+
+
+ @Override
+ public boolean performFinish() {
+ final String sched = page3.getScheduling();
+ final long schedtime = page3.getSimuntil();
+ final EMTimeType timeScale = page3.getTimeScale();
+
+ final Collection<OMEdge> taskPrecedence= page2.getTaskPrecedences();
+ boolean considerPrecedence= page2.considerTaskPrecedence();
+
+ final Job job = new Job("Task Visualisation Job") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+
+ try {
+ ExecutionModel execResult = new ExecutionModel();
+ System.out.println(TaskVisuWizard.this.pa);
+ execResult.setPath(TaskVisuWizard.this.pa);
+ execResult.setTimeScale(timeScale);
+ systemProxy = SystemProxyFactory.createEMSystemProxyFromOMMapping(timeScale.picos(), SchedulerAlgorithmRegister.schedulerFactoryByName(sched), omModel,execResult);
+ if(considerPrecedence){
+ for(OMEdge edge: taskPrecedence){
+ OMCore preCore = OMUtil.getCoreForTask(omModel, edge.getPre());
+ OMCore postCore = OMUtil.getCoreForTask(omModel, edge.getPost());
+ long releaseTime=OMUtil.getProcessingTime(preCore, edge.getReleaseInstruction());
+
+ systemProxy.addTaskPrecedence(preCore.getCoreRef().getName(), edge.getPre().getTaskRef().getName(), releaseTime
+ , postCore.getCoreRef().getName(),edge.getPost().getTaskRef().getName());
+ }
+ }
+
+
+ tw.addExecutionModel(execResult);
+ System.err.println("STARTING SIM");
+
+// SubMonitor subMonitor = SubMonitor.convert(monitor, 100*systemProxy.getSchedulers().size());
+
+// for(IScheduler sched: systemProxy.getSchedulers().values() ){
+// sched.addProgressListener(new Consumer<Integer>() {
+// int prev=0;
+// @Override
+// public void accept(Integer t) {
+// if(subMonitor.isCanceled()){
+// getThread().interrupt();
+// }
+// subMonitor.newChild(t-prev);
+// prev=t;
+// }
+// });
+// }
+
+
+ long cur = System.currentTimeMillis();
+// monitor.beginTask("", totalWork);
+ systemProxy.compute(schedtime);
+ monitor.done();
+ System.out.println("Finish");
+
+ tw.setFinish();
+ if(con.isDataFlow()&&!con.isMergingArrow())
+ {
+ JOptionPane.showMessageDialog(null,"Report:\n"+con.getReport());
+ }
+ if (con.isMergingArrow()&&con.isDataFlow()){
+ renderBetterReport(con);
+ }
+
+
+ System.err.println("READY duration:" + (System.currentTimeMillis()-cur));
+ } catch (SimException | MalformedModelException e) {
+ e.printStackTrace();
+ getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ MessageDialog.openInformation(TraceViewUtil.getTraceViewPart().getSite().getShell(),
+ "Task Visualization", e.getMessage());
+ }
+ });
+ }
+
+ // If you want to update the UI
+ // Display.asyncExec(new Runnable() {
+ // @Override
+ // public void run() {
+ // // do something in the user interface
+ // // e.g. set a text field
+ // }
+ // });
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ protected void canceling() {
+ tw.setFinish();
+ super.canceling();
+ System.err.println("Canceling task visualization");
+ if(systemProxy!=null){
+ systemProxy.interruptComputation();
+ }
+ }
+ };
+
+ // Start the Job
+ job.schedule();
+ return true;
+ }
+
+ private void renderBetterReport(XContainer con) {
+ int ROWS = 4;
+
+ Object[][] data;
+ try {
+ data = con.generateReport();
+ }
+ catch (NullPointerException e){
+
+ JOptionPane.showMessageDialog(null,"The data flow report could not be generated due to the missed goals","Error",JOptionPane.ERROR_MESSAGE);
+ return;
+ }
+
+
+
+
+ ;
+
+ Object[] columnNames = { "Name", "Total Execution", "Oversampling Exe.","Undersampling Exe." };
+
+ JDialog dialog=new JDialog();
+ JPanel contentPanel = new JPanel();
+ dialog.setAlwaysOnTop(true);
+ dialog.setResizable(false);
+ dialog.setBounds(100, 100, 700, 400);
+ dialog.getContentPane().setLayout(new BorderLayout());
+//############################################################################################################################
+ Panel panel_2 = new Panel();
+ dialog.getContentPane().add(panel_2, BorderLayout.NORTH);
+
+ Box verticalBox_1 = Box.createVerticalBox();
+ panel_2.add(verticalBox_1);
+
+ Panel header = new Panel();
+ verticalBox_1.add(header);
+ header.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
+
+ JLabel lblNewLabel = new JLabel("Report");
+ header.add(lblNewLabel);
+
+ Panel infoSpace = new Panel();
+ verticalBox_1.add(infoSpace);
+
+ JLabel core = new JLabel("Cores:");
+ infoSpace.add(core);
+
+ JLabel coreCounter = new JLabel(""+con.getCores().size());
+ coreCounter.setForeground(Color.RED);
+ infoSpace.add(coreCounter);
+
+ JLabel runnable = new JLabel("Runnables:");
+ infoSpace.add(runnable);
+
+ JLabel runnableCounter = new JLabel(""+con.getRunnables().size());
+ runnableCounter.setForeground(Color.RED);
+ infoSpace.add(runnableCounter);
+
+ JLabel labels = new JLabel("Labels:");
+ infoSpace.add(labels);
+
+ JLabel label = new JLabel(""+con.getLabels().size());
+ label.setForeground(Color.RED);
+ infoSpace.add(label);
+
+ Panel panel = new Panel();
+ verticalBox_1.add(panel);
+
+ JLabel globalChain = new JLabel("Global Eventchain:");
+ panel.add(globalChain);
+
+ JLabel lblNewLabel_1 = new JLabel(""+con.isHaveglobal());
+ lblNewLabel_1.setForeground(Color.RED);
+ panel.add(lblNewLabel_1);
+
+
+
+ final JTable table = new JTable(data, columnNames) {
+ @Override
+ public Dimension getPreferredScrollableViewportSize() {
+ Dimension d = getPreferredSize();
+ int n = getRowHeight();
+ return new Dimension(d.width*2, (n * con.getCores().size()));
+ }
+ };
+ JScrollPane sp = new JScrollPane(table);
+ verticalBox_1.add(contentPanel);
+
+ contentPanel.setLayout(new FlowLayout());
+ contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
+ contentPanel.add(sp);
+
+ {
+ JPanel buttonPane = new JPanel();
+ buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
+ dialog.getContentPane().add(buttonPane, BorderLayout.SOUTH);
+ {
+ JButton okButton = new JButton("OK");
+ okButton.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ dialog.setVisible(false);
+ }
+ });
+ okButton.setActionCommand("OK");
+ buttonPane.add(okButton);
+ dialog.getRootPane().setDefaultButton(okButton);
+ }
+ }
+
+//############################################################################################################################
+
+//
+ dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+ dialog.setVisible(true);
+ }
+
+ public static Display getDisplay() {
+ Display display = Display.getCurrent();
+ //may be null if outside the UI thread
+ if (display == null)
+ display = Display.getDefault();
+ return display;
+ }
+
+
+}
diff --git a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/Util.java b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/Util.java
index 4a797e60..4dae37a2 100755..100644
--- a/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/Util.java
+++ b/plugins/org.eclipse.app4mc.multicore.execution.ui.simmenu/src/org/eclipse/app4mc/multicore/execution/ui/simmenu/wizards/Util.java
@@ -1,60 +1,60 @@
-/**
- ********************************************************************************
- * Copyright (c) 2017 Dortmund University of Applied Sciences and Arts and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dortmund University of Applied Sciences and Arts - initial API and implementation
- ********************************************************************************
- */
-
-package org.eclipse.app4mc.multicore.execution.ui.simmenu.wizards;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMEdge;
-import org.eclipse.app4mc.multicore.execution.logic.openmapping.OMTask;
-
-public class Util {
- /**
- * Filter the task edges that match the following
- * <ul>
- * <li>No self-transition edge</li>
- * <li>Pre and post have the same period</li>
- * <li>If there are multiple edges between two tasks the edge with the highest instruction (release time) is chosen</li>
- * </ul>
- * @param tasklist
- * @return
- */
- public static Collection<OMEdge> getConsideredEdges(List<OMTask> tasklist){
-
- List<OMEdge> allEdges = tasklist.parallelStream()
- .map(OMTask::getPosts).flatMap(List::stream)
- .filter(x->x.getPre()!=x.getPost() && x.getPre().getPeriod()==x.getPost().getPeriod())
- .collect(Collectors.toList());
-
- Map<String,OMEdge> considered = new HashMap<>();
-
- for(OMEdge edge:allEdges){
- String name = edge.getPre().getTaskRef().getUniqueName()+"" + edge.getPost().getTaskRef().getUniqueName();
- if(considered.containsKey(name)){
- OMEdge oldedge=considered.get(name);
- if(oldedge.getReleaseInstruction()<edge.getReleaseInstruction()){
- considered.put(name, edge);
- }
- }else{
- considered.put(name,edge);
- }
- }
- return considered.values();