Package jmt.engine.QueueNet

Examples of jmt.engine.QueueNet.NodeSection


      //at least one region has been defined

      for (BlockingRegion region : regions) {
        try {
          //retrieves the blocking queue of the input station
          NodeSection ns = region.getInputStation().getSection(NodeSection.INPUT);

          if (ns instanceof BlockingQueue) {

            //For each class count dropped jobs
            for (int c = 0; c < classNumber; c++) {

              Element el = doc.createElement("measure");
              root.appendChild(el);

              String inputStation = region.getInputStation().getName();
              String className = classes[c].getName();

              el.setAttribute("station", inputStation);
              el.setAttribute("class", className);

              int arrivedJobs = ns.getIntSectionProperty(NodeSection.PROPERTY_ID_ARRIVED_JOBS);
              int droppedJobs = ((BlockingQueue) ns).getDroppedJobPerClass(c);

              double drop_percentage = (double) droppedJobs / arrivedJobs;

              //System.out.println(drop_percentage);
View Full Code Here


          //and a Router-type output section
          //other not compliant sections will cause a NetException

          //nodes which receive jobs from the outside must
          //have redirecting queue behaviour turned on
          NodeSection input = innerNode.getSection(NodeSection.INPUT);
          if (input instanceof Queue) {
            ((Queue) input).redirectionTurnON(br);
          } else {
            throw new NetException("Error in creating blocking region: " + "inner station " + innerNode.getName()
                + " has a not compliant input section.");
          }

          //nodes which sends jobs outside the region must have border router behaviour
          NodeSection output = innerNode.getSection(NodeSection.OUTPUT);
          if (output instanceof Router) {
            ((Router) output).borderRouterTurnON(br);
          } else {
            throw new NetException("Error in creating blocking region: " + "inner station " + innerNode.getName()
                + " has a not compliant output section.");
View Full Code Here

    NetNode node = NetSystem.getNode(stationName);

    if (node != null) {
      try {
        //retrieves the input section of the node
        NodeSection section = node.getSection(NodeSection.INPUT);
        if (section instanceof Queue) {
          //preload jobs for each class
          ((Queue) section).preloadJobs(jobs);
        }
      } catch (NetException e) {
View Full Code Here

      String referenceNodeName = jobClass.getReferenceNodeName();
      NetNode referenceNode = network.getNode(referenceNodeName);
      int visitsReferenceNode, visitsThisNode;
      try {
        //visits to the reference node
        NodeSection refOutputSection = referenceNode.getSection(NodeSection.OUTPUT);
        visitsReferenceNode = refOutputSection.getIntSectionProperty(NodeSection.PROPERTY_ID_ARRIVED_JOBS, jobClass);

        //visits to this node node
        NodeSection thisNodeInputSection = thisNode.getSection(NodeSection.INPUT);

        visitsThisNode = thisNodeInputSection.getIntSectionProperty(NodeSection.PROPERTY_ID_ARRIVED_JOBS, jobClass);

        // the reference source generates a certain number of jobs
        // - some of them have reached this station
        // - other have been dropped before enetering this station or
        // elsewhere in the network
        int droppedJobs = network.getDroppedJobs(jobClass);

        if (thisNodeInputSection instanceof BlockingQueue) {

          // if the input section is a BlockingQueue,
          // remove (from the total number of visits)
          // the jobs dropped by the BlockingQueue itself,
          // because they have been counted
          // in arrived jobs
          visitsThisNode -= ((BlockingQueue) thisNode.getSection(NodeSection.INPUT)).getDroppedJobPerClass(jobClass.getId());

        }

        //visit ratio
        //
        // we must consider only not dropped jobs:
        // --> visit ratio = visits to this node / (visits to ref node - dropped jobs)
        visitRatio = (double) (visitsThisNode) / (visitsReferenceNode - droppedJobs);

        //System.out.println("refNode: " + Integer.toString(visitsReferenceNode));
        //System.out.println("thisNode: " + Integer.toString(visitsThisNode));
        //System.out.println("dropped: " + droppedJobs);
        //System.out.println("visit ratio: " + Double.toString(visitRatio));

      } catch (NetException ne) {
        visitRatio = 1;
        logger.error("Error in computing visit ratio.");
        ne.printStackTrace();
      }
    }
    // Measure is class-independent --> Bertoli Marco
    else {
      try {
        Iterator<JobClass> it = network.getJobClasses().listIterator();
        double ratioSum = 0.0, weight = 0.0;
        while (it.hasNext()) {
          JobClass jobC = it.next();
          //reference node for this job class
          String referenceNodeName = jobC.getReferenceNodeName();
          NetNode referenceNode = network.getNode(referenceNodeName);
          int visitsReferenceNode, visitsThisNode;
          //visits to the reference node
          NodeSection refOutputSection = referenceNode.getSection(NodeSection.OUTPUT);
          visitsReferenceNode = refOutputSection.getIntSectionProperty(NodeSection.PROPERTY_ID_ARRIVED_JOBS, jobC);

          //visits to this node node
          NodeSection thisNodeInputSection = thisNode.getSection(NodeSection.INPUT);

          visitsThisNode = thisNodeInputSection.getIntSectionProperty(NodeSection.PROPERTY_ID_ARRIVED_JOBS, jobC);

          int droppedJobs = network.getDroppedJobs(jobC);

          if (thisNodeInputSection instanceof BlockingQueue) {
            visitsThisNode -= ((BlockingQueue) thisNode.getSection(NodeSection.INPUT)).getDroppedJobPerClass(jobC.getId());
View Full Code Here

      tm.put(thisName, thisKey);
    }
    //performs the server mapping
    for (int i = 0; i < nodeList.size(); i++) {
      NetNode temp = nodeList.get(i);
      NodeSection serviceSection = null;
      try {
        serviceSection = temp.getSection(NodeSection.SERVICE);
      } catch (NetException ne) {
      }
      if (serviceSection instanceof Server || serviceSection instanceof PSServer) {
View Full Code Here

    //for each server ...
    for (int i = 0; i < servers.size(); i++) {
      Object thisServerKey = servers.get(i);
      // get the mapped NetNode ...
      NetNode thisNode = serverMap.get(thisServerKey);
      NodeSection thisQueue = null;
      NodeSection thisServer = null;
      // get the input section and the service section ...
      try {
        thisQueue = thisNode.getSection(NodeSection.INPUT);
        thisServer = thisNode.getSection(NodeSection.SERVICE);
      } catch (NetException ne) {
      }
      singleServerContentQueues.clear();
      //for each class ...
      for (int j = 0; j < classes.size(); j++) {
        try {
          Object thisClassKey = classes.get(j);
          if (thisQueue != null) {
            // get the jobs of this class inside the queue
            int jobsNumber = thisQueue.getIntSectionProperty(NodeSection.PROPERTY_ID_RESIDENT_JOBS, classMap.get(thisClassKey));
            //if the job number is greater than the maximum update it
            if (jobsNumber > maxJobCount) {
              maxJobCount = jobsNumber;
            }
            //put the number of jobs for this class inside the treemap
            singleServerContentQueues.put(thisClassKey, new Integer(jobsNumber));
          }
          if (thisServer != null) {
            //get the utilization for this class
            double utilization = thisServer.getDoubleSectionProperty(NodeSection.PROPERTY_ID_UTILIZATION, classMap.get(thisClassKey));
            //put the utilization this class inside the treemap
            singleServerContentUtilizations.put(thisClassKey, new Double(utilization));
          }
        } catch (NetException ne) {
        }
View Full Code Here

        //creates all sections (max is 3)
        for (int j = 0; j < sectionList.getLength(); j++) {
          if (DEBUG) {
            System.out.println("    start creation of section = " + ((Element) sectionList.item(j)).getAttribute("className"));
          }
          NodeSection ns = createSection((Element) sectionList.item(j));
          if (DEBUG) {
            System.out.println("    finished creation of " + ((Element) sectionList.item(j)).getAttribute("className") + "\n");
          }
          if (ns instanceof InputSection) {
            sections[0] = ns;
View Full Code Here

TOP

Related Classes of jmt.engine.QueueNet.NodeSection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.