// here is a list of common including files #include #include #include #include // type definition enum boolean {FALSE, TRUE}; enum eventType {ARRIVE, COMP, NONE}; // event type class jobType // definition for job class { public: double arrivalTime; double cpuReq; int id; jobType * next; // this is used in job queue jobType(); // constructors jobType(double,double); void set(double, double); }; class eventClass // definition for event { public: eventType eventtype; // event type double eventtime; // event time jobType job; // job associated with this event eventClass *prev, *next; // event queue now is a doubly linked // list eventClass(); // the constructor void create(double,eventType,jobType); // initialize a event }; class eventQClass // definition for event queue { private: eventClass *head, *tail; public: int count; // event count eventQClass(); // constructor boolean Empty(); void Enqueue(eventClass); eventClass Front(); void Dequeue(); int Length(); }; class jobQClass // queue that holds the waiting jobs { private: jobType *head, *tail; public: jobQClass(); boolean Empty(); void Enqueue(jobType); jobType Front(); void Dequeue(); }; class Server // server { private: boolean busy; // server status int numOfFinished; // how many jobs finished double waitTime; // this section of variables are for double meanWait; // statistics only double tempWait; int meanCollected; double groupMean[300]; // at most 300 group means collected double variance; double confInterval; public: jobQClass jobQ; Server(); // constructor void setBusy(); // set the state of server to be busy void setFree(); // set the state of server to be free boolean isBusy(); // test if the server is busy void increment(); // increment the number of arrivals void collectStats(double,double); // collecting statistics void printStats(); int BATCHSIZE; // group size, used for statistics collection int arrivals; // number of arrivals at the server // some friend functions friend double getNAvg(int,double*); // calculate average friend double getVar(int,double,double*); // calculate variance friend double getConf(int,double); // calcualte confidence interval at // 95% confidence level }; // external functions // these are the functions in rand.cc and statis.cc , residing at ~meng/lib/C extern int stream(int); extern double expntl(double); // in rand.o extern double getNAvg(int,double*); // in statis.o extern double getVar(int,double,double*); extern double getConf(int,double);