Example #1
0
 /**
  * Updates System Response Time measures.
  *
  * @param job current job
  */
 private void updateResponseTime(Job job) {
   if (responseTimePerClass != null) {
     // Retrives measure (if not null)
     Measure m = responseTimePerClass[job.getJobClass().getId()];
     if (m != null) {
       m.update(NetSystem.getTime() - job.getSystemEnteringTime(), 1.0);
     }
   }
   if (responseTime != null) {
     responseTime.update(NetSystem.getTime() - job.getSystemEnteringTime(), 1.0);
   }
 }
Example #2
0
 /**
  * Updates System Drop Rate measures.
  *
  * @param job current job
  */
 private void updateDropRate(Job job) {
   if (dropRatePerClass != null) {
     // Retrives measure (if not null)
     int index = job.getJobClass().getId();
     Measure m = dropRatePerClass[index];
     if (m != null) {
       m.update(NetSystem.getTime() - lastJobDropTimePerClass[index], 1.0);
     }
   }
   if (dropRate != null) {
     dropRate.update(NetSystem.getTime() - lastJobDropTime, 1.0);
   }
 }
Example #3
0
 /**
  * Updates System Job Number measures.
  *
  * @param job current job
  */
 private void updateJobNumber(Job job) {
   if (jobNumPerClass != null) {
     // Retrives measure (if not null)
     int index = job.getJobClass().getId();
     Measure m = jobNumPerClass[index];
     if (m != null) {
       m.update(jobsPerClass[index], NetSystem.getTime() - lastModifyNumberPerClass[index]);
     }
   }
   if (jobNum != null) {
     jobNum.update(jobs, NetSystem.getTime() - lastModifyNumber);
   }
 }
Example #4
0
 /**
  * Updates System Throughput measures.
  *
  * @param job current job
  */
 private void updateThroughput(Job job) {
   if (throughputPerClass != null) {
     // Retrives measure (if not null)
     // new sample is the inter-departures time (1/throughput)
     int index = job.getJobClass().getId();
     InverseMeasure m = throughputPerClass[index];
     if (m != null) {
       m.update(NetSystem.getTime() - lastJobOutTimePerClass[index], 1.0);
     }
   }
   if (throughput != null) {
     throughput.update(NetSystem.getTime() - lastJobOutTime, 1.0);
   }
 }
Example #5
0
 /**
  * This method MUST be called each time a job is joined in a join node
  *
  * @param job identifier of merged job
  */
 public void removeForkedJob(Job job) {
   updateJobNumber(job);
   // Updates job number data structure only
   jobs--;
   jobsPerClass[job.getJobClass().getId()]--;
   lastModifyNumberPerClass[job.getJobClass().getId()] = lastModifyNumber = NetSystem.getTime();
 }
Example #6
0
 /**
  * This method MUST be called each time a job is forked into a fork node
  *
  * @param job identifier of new created job
  */
 public void addForkedJob(Job job) {
   updateJobNumber(job);
   // Updates job number data structure only
   lastModifyNumberPerClass[job.getJobClass().getId()] = lastModifyNumber = NetSystem.getTime();
   jobs++;
   jobsPerClass[job.getJobClass().getId()]++;
 }
Example #7
0
  /**
   * This method MUST be called each time a job cycles in its reference station
   *
   * @param job identifier of cycling job
   */
  public void recycleJob(Job job) {
    updateResponseTime(job);
    updateThroughput(job);

    updateJobNumber(job);

    // Added by ASHANKA START
    // Analyse the sample
    updateSystemPower(job);
    // Added by ASHANKA STOP

    // Updates jobs number and throughput data structures
    lastModifyNumberPerClass[job.getJobClass().getId()] = lastModifyNumber = NetSystem.getTime();
    lastJobOutTimePerClass[job.getJobClass().getId()] = lastJobOutTime = NetSystem.getTime();

    job.resetSystemEnteringTime();
  }
Example #8
0
  /**
   * This method MUST be called each time a job is removed from the network
   *
   * @param job identifier of removed job
   */
  public void removeJob(Job job) {
    updateResponseTime(job);
    updateThroughput(job);
    updateJobNumber(job);

    // Added by ASHANKA START
    // Moment is Jobis removed analyse and capture
    updateSystemPower(job);
    // Added by ASHANKA STOP

    // Updates jobs number and throughput data structures
    jobs--;
    jobsPerClass[job.getJobClass().getId()]--;

    lastModifyNumberPerClass[job.getJobClass().getId()] = lastModifyNumber = NetSystem.getTime();
    lastJobOutTimePerClass[job.getJobClass().getId()] = lastJobOutTime = NetSystem.getTime();
  }
Example #9
0
 /**
  * This method MUST be called each time a new job is added to the network
  *
  * @param job identifier of created job
  */
 public void addJob(Job job) {
   job.resetSystemEnteringTime();
   updateJobNumber(job);
   // Updates job number data structures
   lastModifyNumberPerClass[job.getJobClass().getId()] = lastModifyNumber = NetSystem.getTime();
   jobs++;
   jobsPerClass[job.getJobClass().getId()]++;
 }
 @SuppressWarnings("unchecked")
 public Connection make(SocketChannel channel) throws IOException {
   channel.setOption(StandardSocketOptions.SO_REUSEADDR, true);
   // 子类完成具体连接创建工作
   Connection c = makeConnection(channel);
   // 设置连接的参数
   NetSystem.getInstance().setSocketParams(c, true);
   // 设置NIOHandler
   c.setHandler(getNIOHandler());
   return c;
 }
Example #11
0
  /**
   * It changes the class of @job, the new class will be @newClass. It also updates the performance
   * indexes.
   *
   * @param job the job you want to switch
   * @param newClass the new class of @job
   */
  public void performJobClassSwitch(Job job, JobClass newClass) {
    // Get the identifiers of old and new classes
    int oldClassId = job.getJobClass().getId();
    int newClassId = newClass.getId();

    // Updates old class measure (if not null)
    if (jobNumPerClass != null && jobNumPerClass[oldClassId] != null) {
      jobNumPerClass[oldClassId].update(
          jobsPerClass[oldClassId], NetSystem.getTime() - lastModifyNumberPerClass[oldClassId]);
    }
    lastModifyNumberPerClass[oldClassId] = NetSystem.getTime();

    // Updates new class measure (if not null)
    if (jobNumPerClass != null && jobNumPerClass[newClassId] != null) {
      jobNumPerClass[newClassId].update(
          jobsPerClass[newClassId], NetSystem.getTime() - lastModifyNumberPerClass[newClassId]);
    }
    lastModifyNumberPerClass[newClassId] = NetSystem.getTime();

    // Switch job class
    job.setClass(newClass);
    jobsPerClass[oldClassId]--;
    jobsPerClass[newClassId]++;
  }
Example #12
0
  /**
   * Updates System Throughput measures.
   *
   * @param job current job
   */
  private void updateSystemPower(Job job) {

    sampling_SystemThroughputSum =
        sampling_SystemThroughputSum + (NetSystem.getTime() - lastJobOutTime);
    sampling_SystemResponseSum =
        sampling_SystemResponseSum + (NetSystem.getTime() - job.getSystemEnteringTime());
    systemPowerSamples = systemPowerSamples + 1;
    if (systemPowerPerClass != null) {
      // Retrives measure (if not null)
      // new sample is the inter-departures time (1/throughput)
      int index = job.getJobClass().getId();
      InverseMeasure m = systemPowerPerClass[index];
      samplingClass_SystemThroughputSum[index] =
          samplingClass_SystemThroughputSum[index]
              + NetSystem.getTime()
              - lastJobOutTimePerClass[index];
      systemPowerSamplesClass[index] = systemPowerSamplesClass[index] + 1;
      // Measure m = systemPowerPerClass[index];
      if (m != null) {
        double temp =
            (sampling_SystemResponseSum / systemPowerSamples)
                * (samplingClass_SystemThroughputSum[index] / systemPowerSamplesClass[index]);
        // double temp = (NetSystem.getTime() - job.getSystemEnteringTime()) * (NetSystem.getTime()
        // - lastJobOutTimePerClass[index]);
        m.update(temp, 1.0);
      }
    }
    if (systemPower != null) {
      double tmp =
          (sampling_SystemResponseSum / systemPowerSamples)
              * (sampling_SystemThroughputSum / systemPowerSamples);
      // double tmp = (NetSystem.getTime() - job.getSystemEnteringTime()) * (NetSystem.getTime() -
      // lastJobOutTime);//(R/X)
      systemPower.update(tmp, 1.0);
    }
  }
Example #13
0
 /**
  * This method must be called each time a job is dropped by a queue or by a blocking region
  *
  * @param job dropped job identifier
  */
 public void dropJob(Job job) {
   removeForkedJob(job);
   // Updates dropped jobs and drop percentage measure
   updateDropRate(job);
   lastJobDropTimePerClass[job.getJobClass().getId()] = lastJobDropTime = NetSystem.getTime();
 }
Example #14
0
 /**
  * This method COULD be called to notify that a JOB exists
  *
  * @param job identifier
  */
 public void existJob(Job job) {
   updateJobNumber(job);
   lastModifyNumberPerClass[job.getJobClass().getId()] = lastModifyNumber = NetSystem.getTime();
 }
Example #15
0
 /**
  * Creates a new instance of JobInfo object.
  *
  * @param Job Reference to the job to be described.
  */
 public JobInfo(Job Job) {
   this.job = Job;
   time = NetSystem.getTime();
 }