Commit e656e4ec authored by rosemaryng's avatar rosemaryng
Browse files

[Metrics] Modified variance of busy servers to number of busy servers

parent 232b4f28
......@@ -393,7 +393,7 @@ public class Queue extends InputSection {
}
try {
Parameter param = new ExponentialPar(0.2);
Parameter param = new ExponentialPar(1);
retrial = new Retrial(this.getNetSytem(), param);
} catch (IncorrectDistributionParameterException e) {
e.printStackTrace();
......
......@@ -143,6 +143,8 @@ public class Server extends ServiceSection {
jobInService.setIsJobInService(false);
sendBackward(NetEvent.EVENT_PREEMPTED_JOB, jobInService, 0.0);
busyCounter--;
this.getOwnerNode().getJobInfoList().updateNumberOfBusyServersVar(message.getJob(), busyCounter);
}
}
if (busyCounter < numberOfServers) {
......@@ -172,6 +174,8 @@ public class Server extends ServiceSection {
}
busyCounter++;
this.getOwnerNode().getJobInfoList().updateNumberOfBusyServersVar(job, busyCounter);
this.getOwnerNode().getJobInfoList().serveJob(job);
if (busyCounter < numberOfServers) {
// Sends an ACK to the input section (remember not to propagate
// this ack again when computation is finished)
......@@ -202,6 +206,7 @@ public class Server extends ServiceSection {
// Avoid ACK as we already sent ack
busyCounter--;
}
this.getOwnerNode().getJobInfoList().updateNumberOfBusyServersVar(message.getJob(), busyCounter);
break;
case NetEvent.EVENT_STOP:
......
......@@ -346,6 +346,13 @@ public interface JobInfoList {
*/
public abstract void analyzeWaitingTime(JobClass jobClass, Measure measurement);
/**
* Analyzes the waiting time for the specified job class.
* @param jobClass Specified job class. If null, analysis will be job class independent.
* @param measurement Reference to the associated inverse measure.
*/
public abstract void analyzeBusyServersVar(JobClass jobClass, Measure measurement);
/**
* Analyzes the response time of a sink for the specified job class.
* @param jobClass Specified job class. If null, analysis will be job class independent.
......@@ -408,6 +415,8 @@ public interface JobInfoList {
*/
public abstract void consumeJob(JobInfo jobInfo);
public abstract void serveJob(Job job);
/**
* Updates the waiting time of a job -- called when a job is being served.
......@@ -415,7 +424,7 @@ public interface JobInfoList {
*/
public void updateWaitingTime(Job job, double wt);
public void updateNumberOfBusyServers(Job job);
public void updateNumberOfBusyServersVar(Job job, int num);
/**
* Sets the number of servers. This parameter is used to scale utilization.
......
......@@ -58,6 +58,10 @@ public class LinkedJobInfoList implements JobInfoList {
protected int jobsOutPerClass[];
protected double lastJobInServiceTime;
protected double lastJobInServiceTimePerClass[];
protected double lastJobOutTime;
protected double lastJobOutTimePerClass[];
......@@ -144,6 +148,7 @@ public class LinkedJobInfoList implements JobInfoList {
protected Measure retrialOrbitSizePerClass[];
protected Measure busyServerNum;
protected Measure busyServerNumPerClass[];
protected Measure responseTimePerSink;
......@@ -176,6 +181,7 @@ public class LinkedJobInfoList implements JobInfoList {
}
jobsInPerClass = new int[numberOfJobClasses];
jobsOutPerClass = new int[numberOfJobClasses];
lastJobInServiceTimePerClass = new double[numberOfJobClasses];
lastJobInTimePerClass = new double[numberOfJobClasses];
lastJobOutTimePerClass = new double[numberOfJobClasses];
lastJobDropTimePerClass = new double[numberOfJobClasses];
......@@ -801,6 +807,19 @@ public class LinkedJobInfoList implements JobInfoList {
}
}
@Override
public void analyzeBusyServersVar(JobClass jobClass, Measure measurement) {
if (jobClass != null) {
if (busyServerNumPerClass == null) {
busyServerNumPerClass = new Measure[numberOfJobClasses];
}
busyServerNumPerClass[jobClass.getId()] = measurement;
} else {
busyServerNum = measurement;
}
}
/* (non-Javadoc)
* @see jmt.engine.QueueNet.JobInfoList#analyzeResponseTimePerSink(jmt.engine.QueueNet.JobClass, jmt.engine.dataAnalysis.InverseMeasure)
*/
......@@ -1012,8 +1031,19 @@ public class LinkedJobInfoList implements JobInfoList {
}
@Override
public void updateNumberOfBusyServers(Job job) {
public void updateNumberOfBusyServersVar(Job job, int num) {
int mean = 0;
if (busyServerNumPerClass != null) {
JobClass jobClass = job.getJobClass();
int c = jobClass.getId();
Measure m = busyServerNumPerClass[c];
if (m != null) {
m.update(num, getTime() - Math.max(lastJobInServiceTime, lastJobOutTime));
}
}
if (busyServerNum != null) {
busyServerNum.update(num, getTime() - Math.max(lastJobInServiceTime, lastJobOutTime));
}
}
protected void updateResponseTimePerSink(JobInfo jobInfo) {
......@@ -1141,6 +1171,12 @@ public class LinkedJobInfoList implements JobInfoList {
listPerClass[c].remove(jobInfo);
}
@Override
public void serveJob(Job job) {
lastJobInServiceTime = getTime();
lastJobInServiceTimePerClass[job.getJobClass().getId()] = getTime();
}
/* (non-Javadoc)
* @see jmt.engine.QueueNet.JobInfoList#setNumberOfServers(int)
*/
......
......@@ -362,6 +362,9 @@ public class NetNode extends SimEntity {
case SimConstants.LIST_WAITING_TIME:
jobsList.analyzeWaitingTime(jobClass, measurement);
break;
case SimConstants.LIST_BUSY_SERVERS:
jobsList.analyzeBusyServersVar(jobClass, measurement);
break;
case SimConstants.RESPONSE_TIME_PER_SINK:
jobsList.analyzeResponseTimePerSink(jobClass, measurement);
break;
......
......@@ -119,7 +119,7 @@ public interface SimConstants {
/** Measure identifier: (total) waiting time of a job of the system (system entering time - time when job is pass to serving section) */
public static final int SYSTEM_WAITING_TIME = 37;
public static final int VARIANCE_BUSY_SERVERS = 39;
public static final int NUM_BUSY_SERVERS = 39;
//-------------------- end SIMULATION MEASURE IDENTIFIERS -------------------------//
......@@ -156,7 +156,7 @@ public interface SimConstants {
/** Measure identifier: (total) waiting time of a job of the list (system entering time - time when job is pass to serving section) */
public static final int LIST_WAITING_TIME = 38;
public static final int LIST_VARIANCE_BUSY_SERVERS = 38;
public static final int LIST_BUSY_SERVERS = 40;
//-------------------- end JOB LIST MEASURE IDENTIFIERS -------------------------//
......
......@@ -130,6 +130,8 @@ public abstract class EngineUtils {
return SimConstants.RETRIAL_ORBIT_SIZE;
} else if (type.equals(SimulationDefinition.MEASURE_WT)) {
return SimConstants.WAITING_TIME;
} else if (type.equals(SimulationDefinition.MEASURE_V_BS)) {
return SimConstants.NUM_BUSY_SERVERS;
} else if (type.equals(SimulationDefinition.MEASURE_S_CN)) {
return SimConstants.SYSTEM_NUMBER_OF_JOBS;
} else if (type.equals(SimulationDefinition.MEASURE_S_RP)) {
......
......@@ -532,6 +532,9 @@ public class Simulation {
case SimConstants.WAITING_TIME:
netNodes[nodePosition].analyze(SimConstants.LIST_WAITING_TIME, jClass, ms.getMeasure());
break;
case SimConstants.NUM_BUSY_SERVERS:
netNodes[nodePosition].analyze(SimConstants.LIST_BUSY_SERVERS, jClass, ms.getMeasure());
break;
case SimConstants.RESPONSE_TIME_PER_SINK:
netNodes[nodePosition].analyze(SimConstants.RESPONSE_TIME_PER_SINK, jClass, ms.getMeasure());
break;
......
......@@ -57,6 +57,7 @@ public class PAResultsModel implements MeasureDefinition {
private Vector<Integer> retrialRate = new Vector<Integer>();
private Vector<Integer> waitingTime = new Vector<Integer>();
private Vector<Integer> retrialOrbitSize = new Vector<Integer>();
private Vector<Integer> busyServersVar = new Vector<Integer>();
private Vector<Integer> systemCustomerNumber = new Vector<Integer>();
private Vector<Integer> systemResponseTime = new Vector<Integer>();
......@@ -147,6 +148,8 @@ public class PAResultsModel implements MeasureDefinition {
waitingTime.add(new Integer(i));
} else if (measureType.equals(SimulationDefinition.MEASURE_RS)) {
retrialOrbitSize.add(new Integer(i));
} else if (measureType.equals(SimulationDefinition.MEASURE_V_BS)) {
busyServersVar.add(new Integer(i));
} else if (measureType.equals(SimulationDefinition.MEASURE_S_CN)) {
systemCustomerNumber.add(new Integer(i));
} else if (measureType.equals(SimulationDefinition.MEASURE_S_RP)) {
......@@ -234,6 +237,8 @@ public class PAResultsModel implements MeasureDefinition {
waitingTime.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_RS)) {
retrialOrbitSize.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_V_BS)) {
busyServersVar.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_S_CN)) {
systemCustomerNumber.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_S_RP)) {
......@@ -529,6 +534,14 @@ public class PAResultsModel implements MeasureDefinition {
return tmp;
}
@Override
public int[] getNumberOfBusyServersVarianceMeasures() {
int[] tmp = new int[busyServersVar.size()];
for (int i = 0; i < tmp.length; i++) {
tmp[i] = busyServersVar.get(i).intValue();
}
return tmp; }
/**
* Returns an array with the measureIndex of every system customer number measure
* @return an array with measures' index
......
......@@ -29,7 +29,7 @@ package jmt.gui.common.definitions;
*
* Modified by Ashanka (Nov 09):
* Desc: Added the description of the Drop Rate
*
*
* Modified by Ashanka (May 2010):
* Patch: Multi-Sink Perf. Index
* Description: Added new Performance index for capturing
......@@ -101,6 +101,9 @@ public interface ResultsConstants {
public static final String DESCRIPTION_RETRIAL_ORBIT_SIZE = HTML_START + HTML_FONT_TITLE + "Retrial Orbit Size" + HTML_FONT_TIT_END + HTML_FONT_NORM
+ "Average number of customers at the retrial orbit of a selected class at each selected station." + HTML_FONT_NOR_END + HTML_END;
public static final String DESCRIPTION_BUSY_SERVER_NUMBER = HTML_START + HTML_FONT_TITLE + "Number of busy servers" + HTML_FONT_TIT_END + HTML_FONT_NORM
+ "Average number of number of busy servers at each selected station." + HTML_FONT_NOR_END + HTML_END;
public static final String DESCRIPTION_SYSTEM_CUSTOMER_NUMBER = HTML_START + HTML_FONT_TITLE + "System Number of Customers" + HTML_FONT_TIT_END + HTML_FONT_NORM
+ "Average number of customers in the entire system for each selected class." + HTML_FONT_NOR_END + HTML_END;
......@@ -137,19 +140,19 @@ public interface ResultsConstants {
public static final String DESCRIPTION_THROUGHPUT_PER_SINK = HTML_START + HTML_FONT_TITLE + "Throughput per Sink" + HTML_FONT_TIT_END + HTML_FONT_NORM
+ "Average throughput for each selected class at each selected Sink station." + HTML_FONT_NOR_END + HTML_END;
public static final String DESCRIPTION_FCR_TOTAL_WEIGHT = HTML_START + HTML_FONT_TITLE + "FCR Total Weight" + HTML_FONT_TIT_END + HTML_FONT_NORM
public static final String DESCRIPTION_FCR_TOTAL_WEIGHT = HTML_START + HTML_FONT_TITLE + "FCR Total Weight" + HTML_FONT_TIT_END + HTML_FONT_NORM
+ "Average total weight for each selected finite capacity region." + HTML_FONT_NOR_END + HTML_END;
public static final String DESCRIPTION_FCR_MEMORY_OCCUPATION = HTML_START + HTML_FONT_TITLE + "FCR Memory Occupation" + HTML_FONT_TIT_END + HTML_FONT_NORM
public static final String DESCRIPTION_FCR_MEMORY_OCCUPATION = HTML_START + HTML_FONT_TITLE + "FCR Memory Occupation" + HTML_FONT_TIT_END + HTML_FONT_NORM
+ "Average memory occupation for each selected finite capacity region." + HTML_FONT_NOR_END + HTML_END;
public static final String DESCRIPTION_FJ_CUSTOMER_NUMBER = HTML_START + HTML_FONT_TITLE + "Fork Join Number of Customers" + HTML_FONT_TIT_END + HTML_FONT_NORM
public static final String DESCRIPTION_FJ_CUSTOMER_NUMBER = HTML_START + HTML_FONT_TITLE + "Fork Join Number of Customers" + HTML_FONT_TIT_END + HTML_FONT_NORM
+ "Average number of customers for each selected class in each selected Fork/Join section." + HTML_FONT_NOR_END + HTML_END;
public static final String DESCRIPTION_FJ_RESPONSE_TIME = HTML_START + HTML_FONT_TITLE + "Fork Join Response Time" + HTML_FONT_TIT_END + HTML_FONT_NORM
public static final String DESCRIPTION_FJ_RESPONSE_TIME = HTML_START + HTML_FONT_TITLE + "Fork Join Response Time" + HTML_FONT_TIT_END + HTML_FONT_NORM
+ "Average response time of a customer for each selected class in each selected Fork/Join section." + HTML_FONT_NOR_END + HTML_END;
public static final String DESCRIPTION_FIRING_THROUGHPUT = HTML_START + HTML_FONT_TITLE + "Firing Throughput" + HTML_FONT_TIT_END + HTML_FONT_NORM
public static final String DESCRIPTION_FIRING_THROUGHPUT = HTML_START + HTML_FONT_TITLE + "Firing Throughput" + HTML_FONT_TIT_END + HTML_FONT_NORM
+ "Average firing throughput for each selected mode at each selected transition station." + HTML_FONT_NOR_END + HTML_END;
// Temp measure mean label
......
......@@ -56,6 +56,7 @@ public class ResultsModel implements MeasureDefinition {
private Vector<Integer> retrialRate = new Vector<Integer>();
private Vector<Integer> waitingTime = new Vector<Integer>();
private Vector<Integer> retrialOrbitSize = new Vector<Integer>();
private Vector<Integer> busyServerVar = new Vector<Integer>();
private Vector<Integer> systemCustomerNumber = new Vector<Integer>();
private Vector<Integer> systemResponseTime = new Vector<Integer>();
......@@ -139,6 +140,8 @@ public class ResultsModel implements MeasureDefinition {
waitingTime.add(new Integer(i));
} else if (type.equals(SimulationDefinition.MEASURE_RS)) {
retrialOrbitSize.add(new Integer(i));
} else if (type.equals(SimulationDefinition.MEASURE_V_BS)) {
busyServerVar.add(new Integer(i));
} else if (type.equals(SimulationDefinition.MEASURE_S_CN)) {
systemCustomerNumber.add(new Integer(i));
} else if (type.equals(SimulationDefinition.MEASURE_S_RP)) {
......@@ -506,6 +509,15 @@ public class ResultsModel implements MeasureDefinition {
}
return tmp; }
@Override
public int[] getNumberOfBusyServersVarianceMeasures() {
int[] tmp = new int[busyServerVar.size()];
for (int i = 0; i < tmp.length; i++) {
tmp[i] = busyServerVar.get(i).intValue();
}
return tmp;
}
/**
* Returns an array with the measureIndex of every system customer number measure
......
......@@ -74,7 +74,7 @@ public interface SimulationDefinition {
/**Code for retrial orbit size measure*/
public static final String MEASURE_RS = "Retrial Orbit Size";
public static final String MEASURE_V_BS = "Variance of number of busy servers";
public static final String MEASURE_V_BS = "Number of busy servers";
......
......@@ -57,6 +57,7 @@ public class StoredResultsModel implements MeasureDefinition {
private Vector<Integer> retrialRate = new Vector<Integer>();
private Vector<Integer> waitingTime = new Vector<Integer>();
private Vector<Integer> retrialOrbitSize = new Vector<Integer>();
private Vector<Integer> busyServersNum = new Vector<Integer>();
private Vector<Integer> systemCustomerNumber = new Vector<Integer>();
private Vector<Integer> systemResponseTime = new Vector<Integer>();
......@@ -339,6 +340,15 @@ public class StoredResultsModel implements MeasureDefinition {
return tmp;
}
@Override
public int[] getNumberOfBusyServersVarianceMeasures() {
int[] tmp = new int[busyServersNum.size()];
for (int i = 0; i < tmp.length; i++) {
tmp[i] = busyServersNum.get(i).intValue();
}
return tmp;
}
/**
* Returns an array with the measureIndex of every system customer number measure
* @return an array with measures' index
......@@ -627,6 +637,8 @@ public class StoredResultsModel implements MeasureDefinition {
retrialOrbitSize.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_WT)) {
waitingTime.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_V_BS)) {
busyServersNum.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_S_CN)) {
systemCustomerNumber.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_S_RP)) {
......
......@@ -135,6 +135,8 @@ public class MeasurePanel extends WizardPanel implements CommonConstants {
SimulationDefinition.MEASURE_R,
SimulationDefinition.MEASURE_WT,
SimulationDefinition.MEASURE_RS,
SimulationDefinition.MEASURE_V_BS,
SimulationDefinition.MEASURE_RP_PER_SINK,
SimulationDefinition.MEASURE_X_PER_SINK,
SimulationDefinition.MEASURE_FCR_TW,
......@@ -428,7 +430,9 @@ public class MeasurePanel extends WizardPanel implements CommonConstants {
|| measure.type.equals(SimulationDefinition.MEASURE_RD)
|| measure.type.equals(SimulationDefinition.MEASURE_U)
|| measure.type.equals(SimulationDefinition.MEASURE_WT)
|| measure.type.equals(SimulationDefinition.MEASURE_RS)) {
|| measure.type.equals(SimulationDefinition.MEASURE_RS)
|| measure.type.equals(SimulationDefinition.MEASURE_V_BS)
) {
return stationsCombos.getEditor(stationData.getStationRegionKeysNoSourceSink());
} else if (measure.type.equals(SimulationDefinition.MEASURE_X)) {
Vector<Object> vector = new Vector<Object>();
......@@ -630,6 +634,7 @@ public class MeasurePanel extends WizardPanel implements CommonConstants {
|| type.equals(SimulationDefinition.MEASURE_R)
|| type.equals(SimulationDefinition.MEASURE_WT)
|| type.equals(SimulationDefinition.MEASURE_RS)
|| type.equals(SimulationDefinition.MEASURE_V_BS)
) {
if (stationKey != null && stationKey.equals("")) {
return new Measure(getSystemMeasureType(type), null, classKey);
......
......@@ -156,6 +156,7 @@ public class ResultsWindow extends JMTFrame implements ResultsConstants {
addTabPane(mainPanel, SimulationDefinition.MEASURE_R, DESCRIPTION_RETRIAL_RATE, results.getRetrialRateMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_WT, DESCRIPTION_WAITING_TIME, results.getWaitingTimeMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_RS, DESCRIPTION_RETRIAL_ORBIT_SIZE, results.getRetrialOrbitSizeMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_V_BS, DESCRIPTION_BUSY_SERVER_NUMBER, results.getNumberOfBusyServersVarianceMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_CN, DESCRIPTION_SYSTEM_CUSTOMER_NUMBER, results.getSystemCustomerNumberMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_RP, DESCRIPTION_SYSTEM_RESPONSE_TIME, results.getSystemResponseTimeMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_X, DESCRIPTION_SYSTEM_THROUGHPUT, results.getSystemThroughputMeasures());
......
......@@ -161,6 +161,10 @@ public class PAResultsWindow extends JMTFrame implements ResultsConstants, Param
addTabPane(mainPanel, SimulationDefinition.MEASURE_BR, DESCRIPTION_BALKING_RATE, results.getBalkingRateMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_RR, DESCRIPTION_RENEGING_RATE, results.getRenegingRateMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_R, DESCRIPTION_RETRIAL_RATE, results.getRetrialRateMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_WT, DESCRIPTION_WAITING_TIME, results.getWaitingTimeMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_RS, DESCRIPTION_RETRIAL_ORBIT_SIZE, results.getRetrialOrbitSizeMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_V_BS, DESCRIPTION_BUSY_SERVER_NUMBER, results.getNumberOfBusyServersVarianceMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_CN, DESCRIPTION_SYSTEM_CUSTOMER_NUMBER, results.getSystemCustomerNumberMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_RP, DESCRIPTION_SYSTEM_RESPONSE_TIME, results.getSystemResponseTimeMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_X, DESCRIPTION_SYSTEM_THROUGHPUT, results.getSystemThroughputMeasures());
......@@ -169,6 +173,8 @@ public class PAResultsWindow extends JMTFrame implements ResultsConstants, Param
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_RR, DESCRIPTION_SYSTEM_RENEGING_RATE, results.getSystemRenegingRateMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_P, DESCRIPTION_SYSTEM_POWER, results.getSystemPowerMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_R, DESCRIPTION_SYSTEM_RETRIAL_RATE, results.getSystemRetrialRateMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_WT, DESCRIPTION_SYSTEM_SYSTEM_WAITING_TIME, results.getSystemWaitingTimeMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_RS, DESCRIPTION_SYSTEM_NUMBER_OF_JOBS_IN_RETRIAL_ORBIT, results.getSystemRetrialOrbitSizeMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_RP_PER_SINK, DESCRIPTION_RESPONSE_TIME_PER_SINK, results.getResponsetimePerSinkMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_X_PER_SINK, DESCRIPTION_THROUGHPUT_PER_SINK, results.getThroughputPerSinkMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_FCR_TW, DESCRIPTION_FCR_TOTAL_WEIGHT, results.getFCRTotalWeightMeasures());
......
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