From 0ff96a64c807a522a05ba1ec759f1b7fcd9cb37c Mon Sep 17 00:00:00 2001 From: Ludovic Apvrille <ludovic.apvrille@telecom-paristech.fr> Date: Wed, 7 Sep 2011 14:58:35 +0000 Subject: [PATCH] DSE: committing nex classes. Sorry ,this version cannot compile, but I've got to commit it --- src/dseengine/BusContentionResult.java | 71 ++++++++++++++++++++++++++ src/dseengine/BusResult.java | 2 +- src/dseengine/CPUResult.java | 13 +++-- src/dseengine/DSESimulationResult.java | 53 +++++++++++++++++++ 4 files changed, 135 insertions(+), 4 deletions(-) create mode 100755 src/dseengine/BusContentionResult.java diff --git a/src/dseengine/BusContentionResult.java b/src/dseengine/BusContentionResult.java new file mode 100755 index 0000000000..0c49b3f1cd --- /dev/null +++ b/src/dseengine/BusContentionResult.java @@ -0,0 +1,71 @@ +/**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 BusContentionResult +* Object for storing a bus contention result after a simulation +* Creation: 07/09/2011 +* @version 1.0 07/09/2011 +* @author Ludovic APVRILLE +* @see +*/ + +package dseengine; + +import java.io.*; +import java.util.*; + + +import myutil.*; + + +//import uppaaldesc.*; + +public class BusContentionResult { + public int id; + public String name; + + public long contention; + + public BusContentionResult() { + } + + + + +} // Class BusResult + diff --git a/src/dseengine/BusResult.java b/src/dseengine/BusResult.java index 951f62d4eb..0763d5a4b5 100755 --- a/src/dseengine/BusResult.java +++ b/src/dseengine/BusResult.java @@ -57,7 +57,7 @@ import myutil.*; public class BusResult { public int id; - private String name; + public String name; public double utilization; diff --git a/src/dseengine/CPUResult.java b/src/dseengine/CPUResult.java index 2dbd0f1f25..c58eb7ff3c 100755 --- a/src/dseengine/CPUResult.java +++ b/src/dseengine/CPUResult.java @@ -57,15 +57,22 @@ import myutil.*; public class CPUResult { public int id; - private String name; + public String name; public double utilization; + public vector<BusContentionResult> contentions; + public CPUResult() { } - - + public addContentionOnBus(BusContentionResult ct) { + if (contentions == null) { + contentions = new vector<BusContentionResult>(); + } + + contentions.add(ct); + } } // Class BusResult diff --git a/src/dseengine/DSESimulationResult.java b/src/dseengine/DSESimulationResult.java index 277b53ad33..3fc9ab9b43 100755 --- a/src/dseengine/DSESimulationResult.java +++ b/src/dseengine/DSESimulationResult.java @@ -302,7 +302,60 @@ public class DSESimulationResult { // Status if (elt.getTagName().compareTo(SIMULATION_CPU) == 0) { + id = null; + name = null; + command = null; + contdel = null; + busname = null; + busid = null; + util = null; + id = elt.getAttribute("id"); + name = elt.getAttribute("name"); + + if ((id != null) && (name != null)) { + nl = elt.getElementsByTagName("util"); + if ((nl != null) && (nl.getLength() > 0)) { + node0 = nl.item(0); + //System.out.println("nl:" + nl + " value=" + node0.getNodeValue() + " content=" + node0.getTextContent()); + util = node0.getTextContent(); + } + + //System.out.println("toto12"); + nl = elt.getElementsByTagName("contdel"); + if ((nl != null) && (nl.getLength() > 0)) { + nl = elt.getElementsByTagName("contdel"); + node0 = nl.item(0); + elt0 = (Element)node0; + busid = elt0.getAttribute("busID"); + busname = elt0.getAttribute("busName"); + //System.out.println("nl:" + nl + " value=" + node0.getNodeValue() + " content=" + node0.getTextContent()); + contdel = node0.getTextContent(); + } + + if ((util != null) || ((contdel != null) && (busid != null) && (busname != null))) { + CPUResult cpur = new CPUResult(); + try { + cpur.id = Integer.decode(id).intValue(); + cpur.name = name; + + if (util != null) { + cpur.util = Double.valueOf(util).doubleValue(); + } + + if ((contdel != null) && (busid != null) && (busname != null)) { + BusContentionResult bcr = new BusContentionResult(); + bcr.id = Integer.decode(busid).intValue(); + bcr.name = busname; + bcr.contention = Long.decode(contdel).longValue(); + cpur.addContentionOnBus(bcr); + } + + cpus.add(cpur); + } catch (Exception e) { + } + } + } } -- GitLab