#include "simul.h" Server::Server() // constructor { busy = FALSE; waitTime = 0; numOfFinished = 0; meanCollected = 0; meanWait = 0; tempWait = 0; variance = 0; confInterval = 0; arrivals = 0; } void Server::setBusy() { busy = TRUE; } void Server::setFree() { busy = FALSE; } boolean Server::isBusy() { return busy; } void Server::increment() { arrivals ++; } void Server::collectStats(double currentTime, double arrivalTime) { waitTime += currentTime - arrivalTime; tempWait += currentTime - arrivalTime; numOfFinished ++; if (numOfFinished % BATCHSIZE == 0) // collect { groupMean[meanCollected] = tempWait/BATCHSIZE; tempWait = 0; meanCollected ++; } } void Server::printStats() { meanWait = getNAvg(meanCollected,groupMean); variance = getVar(meanCollected,meanWait,groupMean); // confInterval = getConf(meanCollected,variance); cout << " total arrivals " << arrivals << endl;; cout << " the number of means collected : " << meanCollected << endl; cout << " total wait time " << waitTime << endl; cout << " total number of jobs finished " << numOfFinished << endl; cout << " average wait time " << waitTime/numOfFinished << endl; cout << " mean wait time " << meanWait << endl; cout << " variance is " << variance << endl; // cout << " confidence interval is " << confInterval << endl; }