Commit 0d401497 authored by rosemaryng's avatar rosemaryng
Browse files

[Retry Full] Implemented functions for analysing/updating retrial rate

parent 53426196
......@@ -97,6 +97,8 @@ public class Queue extends InputSection {
public static final String FINITE_RETRIAL = "retry full";
public int retrialCount = 0;
public Set<Integer> retried = new HashSet<>();
private String[] dropStrategies;
......@@ -461,6 +463,7 @@ public class Queue extends InputSection {
@Override
protected int process(NetMessage message) throws NetException {
Job job;
boolean isRetrialJob = false;
switch (message.getEvent()) {
......@@ -488,12 +491,14 @@ public class Queue extends InputSection {
double randomDelay = retrial.generateRandomDelay();
double retrialTime = this.getNetSytem().getTime() + randomDelay;
retrialFullGroup.put(job.getId(), retrialTime);
System.out.println("Retrial signaled for " + job.getId() + " at " + retrialTime);
// System.out.println("Retrial signaled for " + job.getId() + " at " + retrialTime);
sendMe(NetEvent.EVENT_RETRIAL_JOB, job, randomDelay);
break;
case NetEvent.EVENT_RETRIAL_JOB:
System.out.println("**** [Retrial] ****");
// System.out.println("**** [Retrial] ****");
isRetrialJob = true;
retrialCount++;
case NetEvent.EVENT_JOB:
......@@ -520,12 +525,21 @@ public class Queue extends InputSection {
//If the queue is infinite, the job is put into the queue and an ack is sent
job = message.getJob();
JobInfo jobInfo = nodeJobsList.lookFor(job);
if (isRetrialJob) {
retried.add(job.getId());
nodeJobsList.retryJob(jobInfo);
netJobsList.retryJob(job);
System.out.println("retrialJobsCount: " + retried.size() + " retrials Total Count: " + retrialCount + " retrial group size: " + retrialFullGroup.size() + " Node Jobs List size: " + nodeJobsList.size());
}
System.out.println("----- \n" + nodeJobsList.lookFor(job) + " Time now: " + getNetSytem().getTime());
// System.out.println("----- \n" + jobInfo + " Time now: " + getNetSytem().getTime());
// System.out.println("Current Queue: " + nodeJobsList.getJobsInPrimaryQueue());
// System.out.println("RetrialFullGroup: " + retrialFullGroup);
System.out.println("NodeJobsList size: " + nodeJobsList.size());
// System.out.println("NodeJobsList size: " + nodeJobsList.size());
// System.out.println("this job is: " + nodeJobsList.lookFor(job).toString() + " time: " + this.getNetSytem().getTime());
......@@ -581,7 +595,7 @@ public class Queue extends InputSection {
if (infinite || nodeJobsList.size() <= size) {
// Queue is not full. Okay.
if (retrialFullGroup.containsKey(job.getId())) {
System.out.println(job.getId() + " proceeds.");
// System.out.println(job.getId() + " proceeds.");
retrialFullGroup.remove(job.getId());
}
......@@ -637,10 +651,9 @@ public class Queue extends InputSection {
// Retry Full route
if (dropStrategies != null && dropStrategies[0].equals(FINITE_RETRIAL)) {
System.out.println(job.getId() + " full, will be retried. Time now: " + this.getNetSytem().getTime());
// System.out.println(job.getId() + " full, will be retried. Time now: " + this.getNetSytem().getTime());
sendMe(NetEvent.EVENT_RETRIAL, job, 0);
} else {
System.out.println(waitingRequests);
addJobToBuffer(job, message, BufferType.WAITING_REQUESTS);
setRenegingEvent(job);
}
......@@ -745,7 +758,7 @@ public class Queue extends InputSection {
return MSG_NOT_PROCESSED;
}
job = (Job) message.getData();
JobInfo jobInfo = getJobInfoFromBuffer(job, FJList);
jobInfo = getJobInfoFromBuffer(job, FJList);
if (jobInfo != null) {
FJList.remove(jobInfo);
}
......
......@@ -267,18 +267,13 @@ public class GlobalJobInfoList {
}
/**
* This method must be called each time a job balks from a queue
* This method must be called each time a job retries joining a queue
* @param job identifier of reneged job
*/
public void retryJob(Job job) {
updateJobNumber(job);
updateRetrialRate(job);
// Updates jobs number and balking rate data structures
jobs--;
jobsPerClass[job.getJobClass().getId()]--;
lastModifyNumberPerClass[job.getJobClass().getId()] = lastModifyNumber = getTime();
lastJobBalkTimePerClass[job.getJobClass().getId()] = lastJobBalkTime = getTime();
lastJobRetrialTimePerClass[job.getJobClass().getId()] = lastJobRetrialTime = getTime();
}
......
......@@ -170,6 +170,7 @@ public class LinkedJobInfoList implements JobInfoList {
lastJobDropTimePerClass = new double[numberOfJobClasses];
lastJobRenegingTimePerClass = new double[numberOfJobClasses];
lastJobBalkingTimePerClass = new double[numberOfJobClasses];
lastJobRetrialTimePerClass = new double[numberOfJobClasses];
totalSojournTimePerClass = new double[numberOfJobClasses];
lastJobSojournTimePerClass = new double[numberOfJobClasses];
......@@ -912,7 +913,7 @@ public class LinkedJobInfoList implements JobInfoList {
}
}
if (retrialRate != null) {
balkingRate.update(getTime() - getLastJobRetrialTime(), 1.0);
retrialRate.update(getTime() - getLastJobRetrialTime(), 1.0);
}
}
......@@ -1019,8 +1020,8 @@ public class LinkedJobInfoList implements JobInfoList {
if (findJob(jobInfo.getJob()) == null) {
list.add(jobInfo);
}
lastJobBalkingTime = getTime();
lastJobBalkingTimePerClass[c] = getTime();
lastJobRetrialTime = getTime();
lastJobRetrialTimePerClass[c] = getTime();
}
/* (non-Javadoc)
......
......@@ -642,7 +642,8 @@ public class NetNode extends SimEntity {
}
}
if (event == NetEvent.EVENT_RETRIAL) {
System.out.println("Remove job from NodeJobsList after signaling retrial?: " + removeJobFromNodeJobsList((Job) data));
removeJobFromNodeJobsList((Job) data);
// System.out.println("Remove job from NodeJobsList after signaling retrial?: " + removeJobFromNodeJobsList((Job) data));
}
......
......@@ -2593,7 +2593,7 @@ public class CommonModel implements CommonConstants, ClassDefinition, StationDef
@Override
public boolean isGlobalMeasure(String type) {
return type.equals(MEASURE_S_X) || type.equals(MEASURE_S_RP) || type.equals(MEASURE_S_CN)
|| type.equals(MEASURE_S_DR) || type.equals(MEASURE_S_P);
|| type.equals(MEASURE_S_DR) || type.equals(MEASURE_S_P) || type.equals(MEASURE_S_R);
}
/**
......
......@@ -54,6 +54,7 @@ public class PAResultsModel implements MeasureDefinition {
private Vector<Integer> dropRate = new Vector<Integer>();
private Vector<Integer> renegingRate = new Vector<Integer>();
private Vector<Integer> balkingRate = new Vector<Integer>();
private Vector<Integer> retrialRate = new Vector<Integer>();
private Vector<Integer> systemCustomerNumber = new Vector<Integer>();
private Vector<Integer> systemResponseTime = new Vector<Integer>();
private Vector<Integer> systemThroughput = new Vector<Integer>();
......@@ -61,6 +62,7 @@ public class PAResultsModel implements MeasureDefinition {
private Vector<Integer> systemRenegingRate = new Vector<Integer>();
private Vector<Integer> systemBalkingRate = new Vector<Integer>();
private Vector<Integer> systemPower = new Vector<Integer>();
private Vector<Integer> systemRetrialRate = new Vector<Integer>();
private Vector<Integer> responseTimePerSink = new Vector<Integer>();
private Vector<Integer> throughputPerSink = new Vector<Integer>();
private Vector<Integer> FCRTotalWeight = new Vector<Integer>();
......@@ -463,6 +465,15 @@ public class PAResultsModel implements MeasureDefinition {
return tmp;
}
@Override
public int[] getRetrialRateMeasures() {
int[] tmp = new int[retrialRate.size()];
for (int i = 0; i < tmp.length; i++) {
tmp[i] = retrialRate.get(i).intValue();
}
return tmp;
}
/**
* Returns an array with the measureIndex of every system customer number measure
* @return an array with measures' index
......@@ -547,6 +558,14 @@ public class PAResultsModel implements MeasureDefinition {
return tmp;
}
@Override
public int[] getSystemRetrialRateMeasures() {
int[] tmp = new int[systemRetrialRate.size()];
for (int i = 0; i < tmp.length; i++) {
tmp[i] = systemRetrialRate.get(i).intValue();
}
return tmp; }
/**
* Returns an array with the measureIndex of every response time per sink measure
* @return an array with measures' index
......
......@@ -54,6 +54,7 @@ public class StoredResultsModel implements MeasureDefinition {
private Vector<Integer> dropRate = new Vector<Integer>();
private Vector<Integer> renegingRate = new Vector<Integer>();
private Vector<Integer> balkingRate = new Vector<Integer>();
private Vector<Integer> retrialRate = new Vector<Integer>();
private Vector<Integer> systemCustomerNumber = new Vector<Integer>();
private Vector<Integer> systemResponseTime = new Vector<Integer>();
private Vector<Integer> systemThroughput = new Vector<Integer>();
......@@ -61,6 +62,7 @@ public class StoredResultsModel implements MeasureDefinition {
private Vector<Integer> systemRenegingRate = new Vector<Integer>();
private Vector<Integer> systemBalkingRate = new Vector<Integer>();
private Vector<Integer> systemPower = new Vector<Integer>();
private Vector<Integer> systemRetrialRate = new Vector<Integer>();
private Vector<Integer> responseTimePerSink = new Vector<Integer>();
private Vector<Integer> throughputPerSink = new Vector<Integer>();
private Vector<Integer> FCRTotalWeight = new Vector<Integer>();
......@@ -301,6 +303,15 @@ public class StoredResultsModel implements MeasureDefinition {
return tmp;
}
@Override
public int[] getRetrialRateMeasures() {
int[] tmp = new int[retrialRate.size()];
for (int i = 0; i < tmp.length; i++) {
tmp[i] = retrialRate.get(i).intValue();
}
return tmp;
}
/**
* Returns an array with the measureIndex of every system customer number measure
* @return an array with measures' index
......@@ -385,6 +396,15 @@ public class StoredResultsModel implements MeasureDefinition {
return tmp;
}
@Override
public int[] getSystemRetrialRateMeasures() {
int[] tmp = new int[systemRetrialRate.size()];
for (int i = 0; i < tmp.length; i++) {
tmp[i] = systemRetrialRate.get(i).intValue();
}
return tmp;
}
/**
* Returns an array with the measureIndex of every response time per sink measure
* @return an array with measures' index
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment