diff --git a/src/dseengine/DSEConfiguration.java b/src/dseengine/DSEConfiguration.java index 9078405605f867264957548a6791030407495243..b01a905372af74a7af6186c310702d7f5cd504b3 100755 --- a/src/dseengine/DSEConfiguration.java +++ b/src/dseengine/DSEConfiguration.java @@ -922,7 +922,7 @@ public class DSEConfiguration implements Runnable { res = dsemapresults.getResults(i); try { - sres = res.getAllExplanationHeader() + "\n"; + sres = res.getExplanationHeader() + "\n"; sres += "#Mapping description: " + dsemapresults.getMapping(i).getSummaryTaskMapping() + "\n"; sres += res.getAllComments() + "\n" + res.getWholeResults(); FileUtils.saveFile(pathToResults + "summary_dseresults_ofmapping" + cpt + ".txt", sres); @@ -936,6 +936,17 @@ public class DSEConfiguration implements Runnable { StringBuffer sb = new StringBuffer("# Overall results\n"); sb.append("#Mappings:\n" + dsemapresults.getDescriptionOfAllMappings() + "\n\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"); + + sb.append("Mapping with Highest Average simulation duration: " + dsemapresults.getMappingWithHighestAverageSimulationDuration() + "\n"); + sb.append("Mapping with Lowest Average simulation duration: " + dsemapresults.getMappingWithLowestAverageSimulationDuration() + "\n"); + + sb.append("Mapping with Highest max simulation duration: " + dsemapresults.getMappingWithHighestMaxSimulationDuration() + "\n"); + sb.append("Mapping with Lowest max simulation duration: " + dsemapresults.getMappingWithLowestMaxSimulationDuration() + "\n"); + + sb.append("\nCPUs:\n"); sb.append("Mapping with Highest min CPU Usage: " + dsemapresults.getMappingWithHighestMinCPUUsage() + "\n"); diff --git a/src/dseengine/DSEMappingSimulationResults.java b/src/dseengine/DSEMappingSimulationResults.java index ada60be8813ab5a8321da441bbdc5ee232925a5f..ab714f42543d255668568ba30858b75ffe4b9091 100755 --- a/src/dseengine/DSEMappingSimulationResults.java +++ b/src/dseengine/DSEMappingSimulationResults.java @@ -519,6 +519,138 @@ public class DSEMappingSimulationResults { return index; } + public int getMappingWithHighestMinSimulationDuration() { + if (results.size() == 0) { + return -1; + } + + int currentIndex = 0; + int index = 0; + long value = 0; + long valuetmp; + + for(DSESimulationResult dserr: results) { + valuetmp = dserr.getMinSimulationDuration(); + if (valuetmp > value) { + value = valuetmp; + index = currentIndex; + } + currentIndex ++; + } + + return index; + } + + public int getMappingWithLowestMinSimulationDuration() { + if (results.size() == 0) { + return -1; + } + + int currentIndex = 0; + int index = 0; + long value = Long.MAX_VALUE; + long valuetmp; + + for(DSESimulationResult dserr: results) { + valuetmp = dserr.getMinSimulationDuration(); + if (valuetmp < value) { + value = valuetmp; + index = currentIndex; + } + currentIndex ++; + } + + return index; + } + + public int getMappingWithHighestAverageSimulationDuration() { + if (results.size() == 0) { + return -1; + } + + int currentIndex = 0; + int index = 0; + double value = 0; + double valuetmp; + + for(DSESimulationResult dserr: results) { + valuetmp = dserr.getAverageSimulationDuration(); + if (valuetmp > value) { + value = valuetmp; + index = currentIndex; + } + currentIndex ++; + } + + return index; + } + + public int getMappingWithLowestAverageSimulationDuration() { + 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.getAverageSimulationDuration(); + if (valuetmp < value) { + value = valuetmp; + index = currentIndex; + } + currentIndex ++; + } + + return index; + } + + public int getMappingWithHighestMaxSimulationDuration() { + if (results.size() == 0) { + return -1; + } + + int currentIndex = 0; + int index = 0; + long value = 0; + long valuetmp; + + for(DSESimulationResult dserr: results) { + valuetmp = dserr.getMaxSimulationDuration(); + if (valuetmp > value) { + value = valuetmp; + index = currentIndex; + } + currentIndex ++; + } + + return index; + } + + public int getMappingWithLowestMaxSimulationDuration() { + if (results.size() == 0) { + return -1; + } + + int currentIndex = 0; + int index = 0; + long value = Long.MAX_VALUE; + long valuetmp; + + for(DSESimulationResult dserr: results) { + valuetmp = dserr.getMaxSimulationDuration(); + if (valuetmp < value) { + value = valuetmp; + index = currentIndex; + } + currentIndex ++; + } + + return index; + } + diff --git a/src/dseengine/DSEScriptReader.java b/src/dseengine/DSEScriptReader.java index eb636383d854a648b206ba6c3671def7ebb14be2..07351348f0a2a36d714308cf0162f5c0e030e618 100755 --- a/src/dseengine/DSEScriptReader.java +++ b/src/dseengine/DSEScriptReader.java @@ -85,7 +85,7 @@ public class DSEScriptReader implements Runnable { "TaskModelFile", "MinNbOfCPUs", //22, 23 "MaxNbOfCPUs", "NbOfSimulationsPerMapping", //24, 25 "runDSE", "MinNbOfCoresPerCPU", // 26, 27 - "MaxbOfCoresPerCPU"//28 + "MaxNbOfCoresPerCPU"//28 }; private static int step = 0; diff --git a/src/dseengine/DSESimulationResult.java b/src/dseengine/DSESimulationResult.java index 8142d32ced2198c08d29eb2ddff66dae0665a3c6..42728ad93814f6aeb069edf3232c48eedb06582f 100755 --- a/src/dseengine/DSESimulationResult.java +++ b/src/dseengine/DSESimulationResult.java @@ -63,16 +63,20 @@ public class DSESimulationResult { protected static final String SIMULATION_GLOBAL = "global"; protected static final String SIMULATION_HEADER = "siminfo"; + protected static final String SIMULATION_DURATION = "simdur"; protected static final String SIMULATION_CPU = "cpu"; protected static final String SIMULATION_BUS = "bus"; protected static final String SIMULATION_TASK = "task"; private Vector<String> comments; + private Vector<Long> simulationDurations; + private Vector<CPUResult> cpus; private Vector<BusResult> busses; private Vector<TaskResult> tasks; + private SimulationDurationWholeResult sdwr; private Vector<CPUWholeResult> wcpus; private Vector<BusWholeResult> wbusses; private Vector<TaskWholeResult> wtasks; @@ -86,6 +90,7 @@ public class DSESimulationResult { busses = new Vector<BusResult>(); tasks = new Vector<TaskResult>(); comments = new Vector<String>(); + simulationDurations = new Vector<Long>(); } public void addComment(String _comment) { @@ -254,6 +259,7 @@ public class DSESimulationResult { String busname; String busid; String state; + String simdur; int k, l; @@ -273,6 +279,12 @@ public class DSESimulationResult { //TraceManager.addDev("Found tag tag:" + elt.getTagName()); // Status + if (elt.getTagName().compareTo(SIMULATION_DURATION) == 0) { + simdur = elt.getTextContent(); + //System.out.println("Simulation duration=" + simdur); + simulationDurations.add(new Long(simdur)); + } + if (elt.getTagName().compareTo(SIMULATION_CPU) == 0) { id = null; name = null; @@ -444,6 +456,15 @@ public class DSESimulationResult { BusWholeResult buswr; TaskWholeResult taskwr; + // Durations + for(Long l: simulationDurations) { + if (sdwr == null) { + sdwr = new SimulationDurationWholeResult(l.longValue()); + } else { + sdwr.updateResults(l.longValue()); + } + } + // CPUs wcpus = new Vector<CPUWholeResult>(); for(CPUResult rescpu: cpus) { @@ -496,6 +517,9 @@ public class DSESimulationResult { public String getWholeResults() { StringBuffer sb = new StringBuffer(""); + + sb.append(sdwr.toStringResult() + "\n"); + for(CPUWholeResult reswcpu: wcpus) { sb.append(reswcpu.toStringResult() + "\n"); } @@ -513,6 +537,11 @@ public class DSESimulationResult { public String getAllResults() { StringBuffer sb = new StringBuffer(""); + + for(Long l: simulationDurations) { + sb.append("DURATION " + l + "\n"); + } + for(CPUResult rescpu: cpus) { sb.append(rescpu.toStringResult() + "\n"); } @@ -541,7 +570,8 @@ public class DSESimulationResult { public static String getExplanationHeader() { String s; - s = "# CPUs: CPU ID Name nbOfResults minUtilization averageUtilization maxUtilization\n"; + s = "# Simulation duration: DURATION nbOfResults minDuration averageDuration maxDuration\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"; s += "# Tasks: TASK ID Name nbOfResults minExecutedCycles averageExecutedCycles maxExecutedCycles nbOfRunnable nbOfRunning nbOfsuspended nbOfTerminated\n"; @@ -553,7 +583,8 @@ public class DSESimulationResult { public static String getAllExplanationHeader() { String s; - s = "# CPUs: CPU ID Name utilization\n"; + s = "# Simulation duration: DURATION value (in us)\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"; s += "# Tasks: TASK ID Name NbOfExecutedCycles state\n"; @@ -655,6 +686,18 @@ public class DSESimulationResult { return min; } + public double getAverageSimulationDuration() { + return sdwr.averageDuration; + } + + public long getMaxSimulationDuration() { + return sdwr.maxDuration; + } + + public long getMinSimulationDuration() { + return sdwr.minDuration; + } + diff --git a/src/dseengine/SimulationDurationWholeResult.java b/src/dseengine/SimulationDurationWholeResult.java new file mode 100755 index 0000000000000000000000000000000000000000..6205a28fdfe19f7ed1639dcd72afba5f5f23732a --- /dev/null +++ b/src/dseengine/SimulationDurationWholeResult.java @@ -0,0 +1,92 @@ +/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille + +ludovic.apvrille AT enst.fr + +This software is a computer program whose purpose is to allow the +edition of TURTLE analysis, design and deployment diagrams, to +allow the generation of RT-LOTOS or Java code from this diagram, +and at last to allow the analysis of formal validation traces +obtained from external tools, e.g. RTL from LAAS-CNRS and CADP +from INRIA Rhone-Alpes. + +This software is governed by the CeCILL license under French law and +abiding by the rules of distribution of free software. You can use, +modify and/ or redistribute the software under the terms of the CeCILL +license as circulated by CEA, CNRS and INRIA at the following URL +"http://www.cecill.info". + +As a counterpart to the access to the source code and rights to copy, +modify and redistribute granted by the license, users are provided only +with a limited warranty and the software's author, the holder of the +economic rights, and the successive licensors have only limited +liability. + +In this respect, the user's attention is drawn to the risks associated +with loading, using, modifying and/or developing or reproducing the +software by the user in light of its specific status of free software, +that may mean that it is complicated to manipulate, and that also +therefore means that it is reserved for developers and experienced +professionals having in-depth computer knowledge. Users are therefore +encouraged to load and test the software's suitability as regards their +requirements in conditions enabling the security of their systems and/or +data to be ensured and, more generally, to use and operate it in the +same conditions as regards security. + +The fact that you are presently reading this means that you have had +knowledge of the CeCILL license and that you accept its terms. + +/** +* Class SimulationDurationWholeResult +* Object for storing all simulation durations +* Creation: 22/09/2011 +* @version 1.0 22/09/2011 +* @author Ludovic APVRILLE +* @see +*/ + +package dseengine; + +import java.io.*; +import java.util.*; + + +import myutil.*; + + +//import uppaaldesc.*; + +public class SimulationDurationWholeResult { + + public long minDuration; + public long maxDuration; + public double averageDuration; + public int nbOfResults; + + + public SimulationDurationWholeResult(long duration) { + + minDuration = duration; + maxDuration = duration; + averageDuration = (double)duration; + nbOfResults = 1; + + } + + public void updateResults(long duration) { + minDuration = Math.min(minDuration, duration); + maxDuration = Math.max(maxDuration, duration); + averageDuration = ((averageDuration * nbOfResults)+duration)/(nbOfResults + 1); + nbOfResults ++; + } + + public String toStringResult() { + StringBuffer sb = new StringBuffer(""); + sb.append("DURATION " + nbOfResults + " " + minDuration + " " + averageDuration + " " + maxDuration); + + return sb.toString(); + } + + + +} // Class SimulationDurationWholeResult +