From bdac676f2a6de88cdc3b23d33041b9085779049b Mon Sep 17 00:00:00 2001 From: Letitia Li <leli@enst.fr> Date: Fri, 23 Sep 2016 14:33:02 +0000 Subject: [PATCH] UI fix for diplodocus ports --- src/dseengine/DSEConfiguration.java | 16 +++++-- .../DSEMappingSimulationResults.java | 47 ++++++++++++++++++- src/dseengine/DSESimulationResult.java | 36 ++++++++++++-- src/ui/tmlcompd/TMLCPrimitivePort.java | 5 +- 4 files changed, 88 insertions(+), 16 deletions(-) diff --git a/src/dseengine/DSEConfiguration.java b/src/dseengine/DSEConfiguration.java index f66784ece8..d9617a95ad 100755 --- a/src/dseengine/DSEConfiguration.java +++ b/src/dseengine/DSEConfiguration.java @@ -1022,6 +1022,10 @@ public class DSEConfiguration implements Runnable { StringBuffer sb = new StringBuffer("# Overall results\n"); sb.append("#Mappings:\n" + dsemapresults.getDescriptionOfAllMappings() + "\n\n"); + sb.append("\nNumber of cycles:\n"); + sb.append("Mapping with Highest Average Cycle duration: " + dsemapresults.getMappingWithHighestAverageCycleDuration() + "\n"); + sb.append("Mapping with Lowest Average Cycle duration: " + dsemapresults.getMappingWithLowestAverageCycleDuration() + "\n"); + sb.append("\nSimulation duration:\n"); sb.append("Mapping with Highest min simulation duration: " + dsemapresults.getMappingWithHighestMinSimulationDuration() + "\n"); sb.append("Mapping with Lowest min simulation duration: " + dsemapresults.getMappingWithLowestMinSimulationDuration() + "\n"); @@ -1065,10 +1069,10 @@ public class DSEConfiguration implements Runnable { sb.append("Mapping with Highest max Bus contention: " + dsemapresults.getMappingWithHighestMaxBusUsage() + "\n"); sb.append("Mapping with Lowest max Bus contention: " + dsemapresults.getMappingWithLowestMaxBusUsage() + "\n"); - sb.append("\nSecurity:\n"); + /*sb.append("\nSecurity:\n"); sb.append("Mapping with Highest added security: " + dsemapresults.getMappingWithHighestAddedSecurity() + "\n"); sb.append("Mapping with Lowest added security: " + dsemapresults.getMappingWithLowestAddedSecurity() + "\n"); - + */ rankMappings(dsemapresults); @@ -1335,7 +1339,9 @@ public class DSEConfiguration implements Runnable { tmla.tmlap = tmlap; tmla.setTMLDesignPanel(tmlcdp); TMLArchiPanel newArch = drawMapping(tmla, "securedMapping"+(cpt-1)); - + GTMLModeling gtml =new GTMLModeling(newArch, true); + tmla = gtml.translateToTMLMapping(); + // //Repeat for secured mapping TMLMapping secMapping = mainGUI.gtm.autoSecure(mainGUI, "mapping" +(cpt-1),tmla, newArch, encComp, overhead, decComp,true,false); @@ -1417,8 +1423,8 @@ public class DSEConfiguration implements Runnable { } } for (HwLink link: hwlinks){ - TMLArchiNode n1 = objMap.get(link.bus); - TMLArchiNode n2 = objMap.get(link.hwnode); + TMLArchiNode n1 = objMap.get(link.hwnode); + TMLArchiNode n2 = objMap.get(link.bus); TMLArchiConnectorNode conn = new TMLArchiConnectorNode(x, y, ap.getMinX(), ap.getMaxX(), ap.getMinY(), ap.getMaxY(), false, null, ap, n1.getTGConnectingPointAtIndex(0), n2.getTGConnectingPointAtIndex(0), new Vector()); ap.addComponent(conn,x,y,false,true); } diff --git a/src/dseengine/DSEMappingSimulationResults.java b/src/dseengine/DSEMappingSimulationResults.java index 48bc29f6e6..3698d366e6 100755 --- a/src/dseengine/DSEMappingSimulationResults.java +++ b/src/dseengine/DSEMappingSimulationResults.java @@ -577,6 +577,49 @@ public class DSEMappingSimulationResults { return index; } + public int getMappingWithHighestAverageCycleDuration(){ + if (results.size() == 0) { + return -1; + } + + int currentIndex = 0; + int index = 0; + double value = 0; + double valuetmp; + + for(DSESimulationResult dserr: results) { + valuetmp = dserr.getAverageCycleDuration(); + System.out.println(currentIndex + " "+ valuetmp); + if (valuetmp > value) { + value = valuetmp; + index = currentIndex; + } + currentIndex ++; + } + + return index; + } + public int getMappingWithLowestAverageCycleDuration(){ + if (results.size() == 0) { + return -1; + } + + int currentIndex = 0; + int index = 0; + double value = Long.MAX_VALUE; + double valuetmp; + + for(DSESimulationResult dserr: results) { + valuetmp = dserr.getAverageCycleDuration(); + if (valuetmp < value) { + value = valuetmp; + index = currentIndex; + } + currentIndex ++; + } + + return index; + } public int getMappingWithHighestMinSimulationDuration() { if (results.size() == 0) { @@ -754,13 +797,13 @@ public class DSEMappingSimulationResults { case 5: return results.get(index).getAverageCPUUsage(); case 6: - return results.get(index).getAverageCPUUsage(); + return results.get(index).getMaxCPUUsage(); case 7: return results.get(index).getMinBusUsage(); case 8: return results.get(index).getAverageBusUsage(); case 9: - return results.get(index).getAverageBusUsage(); + return results.get(index).getMaxBusUsage(); case 11: return results.get(index).getAverageBusContention(); } diff --git a/src/dseengine/DSESimulationResult.java b/src/dseengine/DSESimulationResult.java index 7204b5873f..499158900d 100755 --- a/src/dseengine/DSESimulationResult.java +++ b/src/dseengine/DSESimulationResult.java @@ -71,12 +71,13 @@ public class DSESimulationResult { private Vector<String> comments; private Vector<Long> simulationDurations; - + private Vector<Long> cycleDurations; private Vector<CPUResult> cpus; private Vector<BusResult> busses; private Vector<TaskResult> tasks; private SimulationDurationWholeResult sdwr; + private SimulationDurationWholeResult cdwr; private Vector<CPUWholeResult> wcpus; private Vector<BusWholeResult> wbusses; private Vector<TaskWholeResult> wtasks; @@ -93,6 +94,7 @@ public class DSESimulationResult { tasks = new Vector<TaskResult>(); comments = new Vector<String>(); simulationDurations = new Vector<Long>(); + cycleDurations = new Vector<Long>(); } public void addComment(String _comment) { @@ -292,6 +294,10 @@ public class DSESimulationResult { //System.out.println("Simulation duration=" + simdur); simulationDurations.add(new Long(simdur)); } + if (elt.getTagName().compareTo("EndTime")==0){ + String end = elt.getTextContent(); + cycleDurations.add(new Long(end)); + } if (elt.getTagName().compareTo(SIMULATION_CPU) == 0) { id = null; @@ -473,6 +479,13 @@ public class DSESimulationResult { } } + for(Long l: cycleDurations) { + if (cdwr == null) { + cdwr = new SimulationDurationWholeResult(l.longValue()); + } else { + cdwr.updateResults(l.longValue()); + } + } // CPUs wcpus = new Vector<CPUWholeResult>(); for(CPUResult rescpu: cpus) { @@ -527,7 +540,7 @@ public class DSESimulationResult { StringBuffer sb = new StringBuffer(""); sb.append(sdwr.toStringResult() + "\n"); - + sb.append("CYCLE "+cdwr.toStringResult() + "\n"); for(CPUWholeResult reswcpu: wcpus) { sb.append(reswcpu.toStringResult() + "\n"); } @@ -549,6 +562,9 @@ public class DSESimulationResult { for(Long l: simulationDurations) { sb.append("DURATION " + l + "\n"); } + for(Long l: cycleDurations) { + sb.append("CYCLES " + l + "\n"); + } for(CPUResult rescpu: cpus) { sb.append(rescpu.toStringResult() + "\n"); @@ -578,7 +594,8 @@ public class DSESimulationResult { public static String getExplanationHeader() { String s; - s = "# Simulation duration: DURATION nbOfResults minDuration averageDuration maxDuration\n"; + s = "# Simulation duration: DURATION nbOfResults minDuration averageDuration maxDuration\n"; + s += "# Cycle duration: DURATION nbOfResults minCycles averageCycles maxCycles\n"; s += "# CPUs: CPU ID Name nbOfResults minUtilization averageUtilization maxUtilization\n"; s += "# Contention on busses: CPU_BUS_CONTENTION CPUID CPUName BusID BusName nbOfResults minContentionCycles averageContentionCycles maxContentionCycles\n"; s += "# Busses: BUS ID Name nbOfResults minUtilization averageUtilization maxUtilization\n"; @@ -592,6 +609,7 @@ public class DSESimulationResult { public static String getAllExplanationHeader() { String s; s = "# Simulation duration: DURATION value (in us)\n"; + s += "# Cycle duration: DURATION value (in cycles)\n"; s += "# CPUs: CPU ID Name utilization\n"; s += "# Contention on busses: CPU_BUS_CONTENTION CPUID CPUName BusID BusName contentionCycle\n"; s += "# Busses: BUS ID Name utilization\n"; @@ -697,16 +715,24 @@ public class DSESimulationResult { public double getAverageSimulationDuration() { return sdwr.averageDuration; } - + public double getAverageCycleDuration(){ + return cdwr.averageDuration; + } public long getMaxSimulationDuration() { return sdwr.maxDuration; } + public long getMaxCycleDuration() { + return cdwr.maxDuration; + } + public long getMinSimulationDuration() { return sdwr.minDuration; } - + public long getMinCycleDuration() { + return cdwr.minDuration; + } diff --git a/src/ui/tmlcompd/TMLCPrimitivePort.java b/src/ui/tmlcompd/TMLCPrimitivePort.java index 2dc87b21bd..8cc7d564f4 100755 --- a/src/ui/tmlcompd/TMLCPrimitivePort.java +++ b/src/ui/tmlcompd/TMLCPrimitivePort.java @@ -366,7 +366,7 @@ public abstract class TMLCPrimitivePort extends TGCScalableWithInternalComponent g.drawLine(x-19, y+22, x-12, y+30); g.drawLine(x-19, y+30, x-12, y+22); } - if (checkSecWeakAuthStatus==3 || checkSecStrongAuthStatus==3 && checkWeakAuthStatus <2){ + if (checkSecWeakAuthStatus==3 || checkSecStrongAuthStatus==3 && checkSecWeakAuthStatus <2){ g.drawLine(x-12, y+18, x-5, y+26); g.drawLine(x-12, y+26, x-5, y+18); } @@ -695,9 +695,6 @@ public abstract class TMLCPrimitivePort extends TGCScalableWithInternalComponent dataFlowType = elt.getAttribute("dataFlowType"); associatedEvent = elt.getAttribute("associatedEvent"); checkConf = (elt.getAttribute("checkConf").compareTo("true")==0); - checkConfStatus = Integer.valueOf(elt.getAttribute("checkConfStatus")); - checkStrongAuthStatus = Integer.valueOf(elt.getAttribute("checkStrongAuthStatus")); - checkWeakAuthStatus = Integer.valueOf(elt.getAttribute("checkWeakAuthStatus")); checkAuth = (elt.getAttribute("checkAuth").compareTo("true")==0); isLossy = (elt.getAttribute("isLossy").compareTo("true") ==0); isPrex = (elt.getAttribute("isPrex").compareTo("true") ==0); -- GitLab