Name: Siddiqui, Matheen EXECUTION TESTS ========= ===== ====================================================================== hw6-sim < hw6.in1 Enter customer data file name: Enter the start time: Enter the stop time: Enter the minimum number of queues to simulate: Enter the maximum number of queues to simulate: File: /home/course/cs113/homework/grading/hw6/q.data3 number of customers: 14 start time: 0 customer arrival rate: 0.14 total time: 100 total time: 100 number of queues: 2 3 4 percent idle time: 19.50 46.67 60.25 average wait: 5.86 1.36 0.00 average service time: 9.64 9.64 9.64 longest wait: 17 12 0 time longest wait: 53 53 0 average queue length: 0.41 0.06 0.00 cust in queues at end: 0 0 0 ====================================================================== hw6-sim < hw6.in2 Enter customer data file name: Enter the start time: Enter the stop time: Enter the minimum number of queues to simulate: Enter the maximum number of queues to simulate: File: /home/course/cs113/homework/grading/hw6/q.data4 number of customers: 172 start time: 0 customer arrival rate: 0.17 total time: 1000 total time: 1000 number of queues: 1 2 3 4 5 percent idle time: 1.80 1.85 2.17 17.23 33.62 average wait: 342.80 194.72 48.74 10.08 2.68 average service time: 17.88 17.75 17.66 17.55 17.55 longest wait: 689 360 140 68 25 time longest wait: 298 597 826 810 780 average queue length: 58.12 16.57 2.85 0.43 0.09 cust in queues at end: 122 71 21 0 0 ====================================================================== hw6-sim < hw6.in3 Enter customer data file name: Enter the start time: Enter the stop time: Enter the minimum number of queues to simulate: Enter the maximum number of queues to simulate: File: /home/course/cs113/homework/grading/hw6/q.data7 number of customers: 208 start time: 1000 customer arrival rate: 0.14 total time: 2500 total time: 1500 number of queues: 7 percent idle time: 57.20 average wait: 2.45 average service time: 19.64 longest wait: 34 time longest wait: 1978 average queue length: 0.05 cust in queues at end: 0 ====================================================================== SOURCE FILES ====== ===== /* * File: hw6-sim.c * Author: Matheen Siddiqui * Class: CS113 * Assignment: HomeWork 6 * Due: Thurs, Nov 13 * Modified: Fri , Nov 14 * ------------------------------------------------------ * * USAGE: no commandline args * ===== * * OVERVIEW: * ======== * * This program simulates a group of checkout lines, such as one you * might encounter in a grocery store. Customers arrive and go to the * line that is shortest. Then they wait in that line until * they get to the cashier, where they are proccessed for a time. * After this procces time the cashier works on the next customer * in his line. * * The arrival and service times are determined by a data file, for which * the name is entered by the user. * The whole simulation runs within a set time period and for a range * of lines to uses. The user inputs these values as starting and stop times, * and the minimum and maximum number of queues to use in simulation. * * A simulation is run for each number of lines to use as specified in the * range and the following statistics are calculated and printed in a table: * * 1. name of data file, * 2. start time, end time, total time, * 3. the numbers of queues used in simulation, * 4. number of customers * 5. arrival rate (number of customers/total time), * 6. the average service time for customers, * 7. the average wait for customers, * 8. the time and length of the longest wait by a customer * 9. the average queue length, * 10. the number of customers waiting in the queues when the simulation ends * 11. percent idle time (idle cashier time/total time). * * * ALGORITHM NOTES: * =============== * * The data for each simulation of a given number of queues * is tracked using a type called multSimDataT which is a struct. * The values that must be calculated continously during the simulation and * are tracked using the cumData field of that struct. * * So in each unit of time the following operations are performed: * * 1. Determine whether a new customer has arrived. * * 2. Put that customer in the shortest queue * When a customer is added the numCustomer field of cumData is incrmented * * 3. Then update the status of the queues. * During the updata part of the simulation mSimData is passed by * by referece so that cumData can be talley properly. * * After the simulation has ended these values are proccessed and * stored into a simResults struct so that it may be printed later on. * Note that when the time ends any customers that are left in line * are not processed, and hence don't contribute to some of the stats. * That is why the average service time is printed in the tabular part * of the output, it may vary depending on how many customers are left * in line when the simulation ends. * * This simulation is run for each of the number of queues to use and * the results are stored into an array of simResultT. Then * these results are printed. * * */ /*--------------------Includes---------------------*/ #include #include #include "simpio.h" #include "genlib.h" #include "strlib.h" #include "random.h" #include "queue.h" /*--------------Defines--------------------*/ /* TAB_STEP is the number of columns in the table*/ #define TAB_STEP 5 /* * Type: customerT * --------------- * A customer is represented using a pointer to a record * containing the following information: * * o The customer number (for debugging traces) * o The arrival time (to compute the waiting time) * o The time required for service */ typedef struct { int customerNumber; /*the cutomer number*/ int arrivalTime; /*the time a customer arrived*/ int serviceTime; /*the time neccisary for service*/ } *customerT; /* * Type: cumDataT * -------------- * This type stores information that is talleyed through * the simulation */ typedef struct { int numCustomers; /* the number of customers */ int numServed; /* the number of customers served*/ int totalServiceTime; /* the total spent serving customers*/ long totalWaitTime; /* the total time customers served at * spent waiting in line*/ long lengthLongWait; /* the longest time a customer spent in line*/ long timeLongWait; /* the time the longest wait occurs*/ long idleTime; /* the time queues spent without any * customers to proccess*/ long totalQueLength; /* the sum of the queue lengths * at every time interval,(neccissary to find * average queue length)*/ int numCustInLine; /* the number of customers in line at the * end of the simulation*/ } cumDataT; /* * Type: cumDataT * -------------- * This type stores information on one queue of the simulation */ typedef struct { queueADT queue; /* a queue that holds the data * for the customers in line,(customerT)*/ customerT activeCustomer; /* holds data pertaining to the customer * being prossesed.*/ } simQueueT; /* type: multSimDataT * ---------------------------------------- * This type stores the data neccisary for the simulation. The * main program declares a variable of this type and passes it * to the RunSimulation function. */ typedef struct { string custFileName; /* The name of the file that contains * the customer data*/ int maxNumQue, minNumQue; /* The maximum and minimum number of * queues to use in simulation*/ int strtTime, stopTime; /* The starting and ending times of * the simulation*/ cumDataT cumData; /* Data that is cumulated in sim*/ simQueueT *simQueue; /* An array holding the simulated queues */ int numQue; /* The current number of queues to simulate*/ int time; /* the current time*/ } multSimDataT; /* type: simResults * ---------------------------- * This type holds information obtained after a simulation for a fixed * number of queues is run. */ typedef struct { long numQue; /* The number of queues used in the simulation*/ long numCustomers; /* The number of customers in the simulation*/ float arrivalRate; /* The arrival rate of customers*/ float averageServiceTime;/* The average time neccisary to serve a customer*/ float averageWaitTime; /* The average wait time for a customer*/ long lengthLongWait, /* The longest wait time for a customer*/ timeLongWait; /* The time that wait occured*/ float averageQueLength; /* The average length amound the queues*/ long numCustInQue; /* The number of customers in line at end of * the simulation*/ float percIdleTime; /* The percent idle time of all the queues*/ } simResultsT; /*----------------- Private function declarations--------------*/ /* Function: InitializeSimulation * Usage : InitializeSimulation( mSimDataP ) * -------------------------------------------- * This function takes a multSimDataT pointer, mSimDataP, and stores * into the struct it points to the customer data file name, * the start and end times, and the max and min number * of ques to print, as read from stdin. It also initials the simQueues */ static void InitializeSimulation(multSimDataT *mSimDataP ); /* Function: ReSizeSim * Usage : ReSimSim( mSimDataP, numQue ) * -------------------------------------------- * sets up the intitalized mSimDataT pointed to mSimDataP, to * run a simulation for numQue(int) queues. It also * initialize data cummulated by the simulation, * and frees any non empty queues. */ static void ReSizeSim( multSimDataT *mSimDataP, int numQue ); /* Function: GetCustomer * Usage : cust = GetCustomer( custFile ); * -------------------------------------------- * Returns a customerT sturct pointer read * from the file pointed to by CustFile. NULL * is returned if EOF was reached */ static customerT GetCustomer( FILE *custFile ); /* Function: RunSimulation * Usage : results = RunSimulation( mSimDataP, &numRes); * -------------------------------------------- * Runs the full queue simulation (simulations for each * of the number of queues to use) for mult simulation data * pionted to by mSimDataP. It returns an array pointer(simResult*) * that contains the results for each simulation, * the int pointed to by numRes holds the size of that array. */ static simResultsT* RunSimulation( multSimDataT *multSimDataP, int *numRes ); /* Function: Simulate * Usage : result = Simulate( mSimDataP ) * -------------------------------------------- * Runs a simulation for the data pointed to by mSimDataP(multSimDataT*), * this simulatoin is for a fixed number of queues, as determined by * the numQue field of the sturct. the result of the simulation * is returned (simResultT) */ static simResultsT Simulate(multSimDataT *mSimDataP ); /* Function: ProccessResults * Usage : results = ProccessResults( mSimDataP ) * -------------------------------------------- * After a simulation, mSimDataP( multSimdataT*) contains * cummulated data. ProccessResults takes this data and * returns a simResultT that holds the finilaized results. */ static simResultsT ProccessResults( multSimDataT *mSimDataP); /* Function: FindShortestLine * Usage : FindShortestLine( mSimDataP ) * -------------------------------------------- * returns the index(int) of the shortest queue * held in mSimDataP ( multSimDataT *) */ static int FindShortestLine( multSimDataT *mSimDataP ); /* Function: EnqueueCustomer * Usage : EnqueueCustomer( mSimDataP, cust, queNum ); * -------------------------------------------- * adds the customerT cust to que of index queNum(int) in * mSimDataP (multSimDataT*) */ static void EnqueueCustomer(multSimDataT *mSimData,customerT cst,int queNum ); /* Function: ProcessQueue * Usage : ProcessQueue( mSimData, queNum ); * -------------------------------------------- * Updates the queNum(int) th queue held in mSimData( multSimDataT*) */ static void ProcessQueue(multSimDataT *mSimDataP, int queNum ); /* Function: ServeCustomer * Usage : ServeCustomer( mSimDataP, queNum ); * -------------------------------------------- * This function is called if the queue with index queNum (int) * in mSimDataP (multSimDataT*), currently does not serve * a customer. It enables a queue to serve the next customer waiting * in line */ static void ServeCustomer(multSimDataT *mSimDataP, int queNum); /* Function: DismissCustomer * Usage : DismissCustomer( mSimDatap, queNum ); * -------------------------------------------- * This function is called if the queue with index queNum (int) * in mSimDataP (multSimDataT*), has completed serving a * customer, to get rid of the served customer */ static void DismissCustomer(multSimDataT *mSimDataP, int queNum); /* Function: ReportResults * Usage : ReportResults( mSimDataP, results, numResults ); * -------------------------------------------- * Prints the results of the simulation with simdata pointed * to by mSimDataP( multSimDataT*), and has results( simResultsT[] ), * of size numResults (int). */ static void ReportResults(multSimDataT *mSimDataP, simResultsT results[], int numResults); /* Function: PrintSection * Usage : PrintSection( results, numRes, strt, stp ); * -------------------------------------------- * Prints in table format, the results of in result (simResults[]) * staring at index strt, and ending at index stp. numRes(int) is * the size of the array. if stp > numRes-1, the function * prints as much as it can but does not go out of the array */ void PrintSection( simResultsT result[], int numRes, int strt, int stp ); /* Main program */ int main() { multSimDataT simData; /*data for the simulation*/ simResultsT *results; /*the results of the simulation*/ int numResults; /* the size of results*/ /*initilize data and runsimulation*/ InitializeSimulation(&simData); printf("\n\n"); results = RunSimulation(&simData, &numResults); /*print results*/ printf("\n\n"); ReportResults(&simData, results, numResults); /*free mem*/ free( results ); ReSizeSim( &simData, 0 ); free( simData.simQueue ); exit(0); } /* function: InitializeSimulation * -------------------------------------------- * get custFileName, start time, stop time, max * and min number of queues for simulation and * allocates memory for for the queues. */ static void InitializeSimulation(multSimDataT *mSimDataP ) { int i; /*loop var*/ /*get the name of the data file*/ printf("\nEnter customer data file name: "); mSimDataP->custFileName = GetLine(); /*get the start time of sim*/ printf("\nEnter the start time: "); mSimDataP->strtTime = GetInteger(); /*get the stop time */ printf("\nEnter the stop time: "); mSimDataP->stopTime = GetInteger(); /*get minimum number of queues used in sim*/ printf("\nEnter the minimum number of queues to simulate: "); mSimDataP->minNumQue = GetInteger(); /*get maximum number of queues used in sim*/ printf("\nEnter the maximum number of queues to simulate: "); mSimDataP->maxNumQue = GetInteger(); /*allocate a block for the data of the maximum number of queues*/ mSimDataP->simQueue = (simQueueT*) malloc( sizeof( simQueueT) * mSimDataP -> maxNumQue ); /*allocate queues for each queDatat element in mSimData*/ for( i = 0; i < mSimDataP->maxNumQue; i++ ) { mSimDataP->simQueue[i].queue = NewQueue(); mSimDataP->simQueue[i].activeCustomer = NULL; } mSimDataP->numQue = 0; } /* Function: ReSizeSim * -------------------------------------------- * set all cumulated data to 0; * Goes through each queue of mSimDataP, * removes and frees each element from that queue using Dequeue, * gets rid of any active customer , * Then the numQue is resassigned, and first numQue queues' */ static void ReSizeSim( multSimDataT *mSimDataP, int numQue ) { int i; customerT *cust; /*reset data that will be agreagated during simulation*/ mSimDataP->cumData.numServed = 0; mSimDataP->cumData.totalServiceTime = 0; mSimDataP->cumData.idleTime = 0; mSimDataP->cumData.totalWaitTime = 0; mSimDataP->cumData.totalQueLength = 0; mSimDataP->cumData.idleTime = 0; mSimDataP->cumData.numCustomers = 0; mSimDataP->cumData.timeLongWait = 0; mSimDataP->cumData.lengthLongWait = 0; /*empty all the ques*/ for( i = 0; i < mSimDataP->maxNumQue; i++ ) { /*dequeue elements until queue is empty*/ while( !QueueIsEmpty( (mSimDataP->simQueue[i]).queue )) { cust = Dequeue( (mSimDataP->simQueue[i]).queue ); free( cust ); } /*get rid of active customer*/ if ( mSimDataP->simQueue[i].activeCustomer != NULL ) { free( mSimDataP->simQueue[i].activeCustomer ); mSimDataP->simQueue[i].activeCustomer = NULL; } } /*assign number of queues used in simulation*/ mSimDataP->numQue = numQue; } /*end of reSizeSim*/ /* Function: GetCustomer * -------------------------------------------- * allocate space for customer * scan in arrival time and service time * if at eof return null else return customer */ static customerT GetCustomer( FILE *custFile ) { customerT cst; /*a pointer to a block of memory holding customer data*/ /*allocate a customer*/ cst = New( customerT ); /*read in customer data from file, and *return null if the end of file is reached*/ if( fscanf( custFile, "%d,%d;", &(cst->arrivalTime), &(cst->serviceTime )) == EOF ) { return NULL; }; /*return customer pointer*/ return cst; } /*end of GetCustomer*/ /* * Function: RunSimulation * ------------------------------- * Allocates an array to hold the results for each simulation, from * the minium to the maximum number of queues to use. * * Then the corresponding results are found by using Simulate for * each of the sizes * */ static simResultsT* RunSimulation(multSimDataT *multSimDataP, int *numResults ) { simResultsT *sResults; /* an array that holds * the results from each simulation run*/ int numQue; /*number of queues to simulate*/ int i; /*allocate memory block for results*/ sResults = (simResultsT*) malloc( sizeof(simResultsT)*multSimDataP->maxNumQue); /* run the simulation for min.. max number of ques, * storing the results of the simulation in * simResults array*/ for( i = 0, numQue = multSimDataP->minNumQue; numQue <= multSimDataP->maxNumQue; numQue++, i++ ) { /*setup multSimdata to run with numQue queues*/ ReSizeSim( multSimDataP, numQue); /*run simultation with i queues*/ sResults[i] = Simulate( multSimDataP ); } /*find size of array*/ *numResults = multSimDataP->maxNumQue - multSimDataP->minNumQue +1; /*return results*/ return sResults; } /*end RunSimulation*/ /* Function: Simulate * -------------------------------------------- * This function uses the general outline: * Geting a customer with GetCustomer * Adding him to the shortest queue with EnqueueCustomer * then proccess all the queues with ProcessQueue * repeatedly for the time of the simulation. */ static simResultsT Simulate(multSimDataT *mSimDataP ) { customerT cust; /* customer to add to queue*/ FILE *custFile; /* file of cusomter data*/ int indexShortQue; /* index of the shortest queue*/ int i; /* loop var*/ custFile = fopen( mSimDataP->custFileName, "r"); /* read customers until get one that starts within * time of the simulation */ cust = GetCustomer( custFile ); while( cust!= NULL && cust->arrivalTime < mSimDataP->strtTime ) { free( cust ); /*free cust*/ cust = GetCustomer( custFile ); /*get new customer*/ } /*loop from startime to end time of simulation*/ for (mSimDataP->time = mSimDataP->strtTime; mSimDataP->time <= mSimDataP->stopTime; (mSimDataP->time)++) { /* if customer is NULL then eof file is reached so cust isn't added to * simulation. ( && opreates left to right). Otherwise * if customers arrival time is the current time * add to simulation*/ if ( cust!=NULL && cust->arrivalTime == mSimDataP->time ) { /* find index of shortest que and place customer in * that queue*/ indexShortQue = FindShortestLine( mSimDataP ); EnqueueCustomer( mSimDataP, cust, indexShortQue ); /*get the next customer*/ cust = GetCustomer( custFile ); } /*procces queues*/ for( i = 0; i < mSimDataP->numQue; i++ ) { ProcessQueue(mSimDataP, i ); } } fclose( custFile ); return ProccessResults( mSimDataP ); } /*end Simulate*/ /* Function: ProccessResults * -------------------------------------------- * transfers data from mSimDataP into * results and returns results */ static simResultsT ProccessResults( multSimDataT *mSimDataP ) { simResultsT results; /* the results struct returned*/ int i ; /*loop counter*/ /*find number of ques*/ results.numQue = mSimDataP->numQue; /*find cumulative number of customers*/ results.numCustomers = mSimDataP->cumData.numCustomers; /*find arrrival rate*/ results.arrivalRate = (float)results.numCustomers/ (mSimDataP->stopTime - mSimDataP->strtTime ); /* find average service time*/ results.averageServiceTime = (float)mSimDataP->cumData.totalServiceTime/ mSimDataP->cumData.numServed; /*average wait time*/ results.averageWaitTime = (float)mSimDataP->cumData.totalWaitTime/ mSimDataP->cumData.numServed; /*find length and time of longest wait*/ results.timeLongWait = mSimDataP->cumData.timeLongWait; results.lengthLongWait = mSimDataP->cumData.lengthLongWait; /* now the average line length*/ results.averageQueLength = (float)mSimDataP->cumData.totalQueLength/ ((mSimDataP->stopTime - mSimDataP->strtTime )*mSimDataP->numQue); /* percent idle time is found */ results.percIdleTime = (float)mSimDataP->cumData.idleTime/ ((mSimDataP->stopTime - mSimDataP->strtTime )*mSimDataP->numQue) ; /* the number of customers in line at the end of the * simulation is found by summing the length of each queue.*/ results.numCustInQue = 0; for( i = 0; i < results.numQue; i++ ) { results.numCustInQue += QueueLength(mSimDataP->simQueue[i].queue); } return results; } /*end ProccessResults*/ /* Function: FindShortestLine * -------------------------------------------- * loops through the queues and * compares each queue to a shortest queue. * if a queue is shorter it becomes the shortest * the shortest queue's index is returned. */ static int FindShortestLine( multSimDataT *mSimDataP ) { int shortestLen; /*length of shortest queue*/ int indexShortestQue; /*index of the shortest queue*/ int length; /*length of current queue*/ int i; /*loop var*/ /* assume shortest queue has index 0*/ indexShortestQue = 0; /* the length of queue is deteremined by * the length of the queue part of the sturture + * the active customer if there is on. The second term * in the sum handles the active customer by * using c's use of 0 and 1 for bools*/ shortestLen = QueueLength( mSimDataP->simQueue[0].queue ) +(mSimDataP->simQueue[0].activeCustomer != NULL) ; /* loop and compare to other queues * if an other queue is shorter make it the shortest*/ for( i = 1; i < mSimDataP->numQue; i++ ) { /*find length*/ length = QueueLength( mSimDataP->simQueue[i].queue ) +(mSimDataP->simQueue[i].activeCustomer != NULL) ; /*if shorter make it shortest*/ if ( length < shortestLen ) { indexShortestQue = i; shortestLen = length; } } return indexShortestQue; } /*end FindShortestLine*/ /* * Function: EnqueueCustomer * --------------------------------- * increments number of customer and adds it to the queue. */ static void EnqueueCustomer(multSimDataT *mSimDataP,customerT cst,int queNum) { mSimDataP->cumData.numCustomers++; Enqueue(mSimDataP->simQueue[queNum].queue, cst ); } /*end EnqueueCustomer*/ /* * Function: ProcessQueue * ------------------------------ * If the queue had an active customer its service time is decremented * if it doesn't than it tries to get an active customer, * if it has no customers in its line, then total idle time is * incremented. totatlQueLength is always incremented. */ static void ProcessQueue( multSimDataT *mSimDataP, int queNum ) { /*if no active customer than get a customer*/ if ( mSimDataP->simQueue[queNum].activeCustomer == NULL) { /*if no customers then increment idleTime*/ if (!QueueIsEmpty(mSimDataP->simQueue[queNum].queue)) { ServeCustomer(mSimDataP, queNum ); } else { mSimDataP->cumData.idleTime++; } } else { /*if serviceTime is 0 then customer is served so dismiss him * otherwise decrease the serviceTime*/ if (mSimDataP->simQueue[queNum].activeCustomer->serviceTime == 0) { DismissCustomer(mSimDataP, queNum); } else { mSimDataP->simQueue[queNum].activeCustomer->serviceTime--; } } /*add to total line length*/ mSimDataP->cumData.totalQueLength += QueueLength( mSimDataP->simQueue[queNum].queue); } /*end ProcessQueue*/ /* * Function: ServeCustomer * Usage: ServeCustomer(&simData); * ------------------------------- * First get a customer for the queue and set to active customer * Then update various statistics */ static void ServeCustomer(multSimDataT *mSimDataP, int queNum) { customerT cust; /*customer to be made active*/ int waitTime; /*the corresponding wait time of the customers*/ /*pull customer form queue and set as active*/ cust = Dequeue(mSimDataP->simQueue[queNum].queue); mSimDataP->simQueue[queNum].activeCustomer = cust; /*increase number of customers served*/ mSimDataP->cumData.numServed++; /*increase total service time*/ mSimDataP->cumData.totalServiceTime += cust-> serviceTime; /*wait time is current time - the customers arriveal time*/ waitTime = mSimDataP->time - cust->arrivalTime; /*add wait time to total waittime*/ mSimDataP->cumData.totalWaitTime+= waitTime; /*see if wait time is longs one*/ if ( mSimDataP->cumData.lengthLongWait < waitTime ) { mSimDataP->cumData.lengthLongWait = waitTime; mSimDataP->cumData.timeLongWait = cust->arrivalTime; } } /*end ServiceCustomer*/ /* * Function: DismissCustomer * --------------------------------- * Frees customer and sets active customer to null */ static void DismissCustomer(multSimDataT *mSimDataP, int queNum) { FreeBlock(mSimDataP->simQueue[queNum].activeCustomer); mSimDataP->simQueue[queNum].activeCustomer = NULL; } /* * Function: ReportResults * ------------------------------- * first prints the genaral data part of the table then * uses PrintSection to print the tabular portion the * partition talbes. */ static void ReportResults(multSimDataT *mSimDataP, simResultsT results[], int numResult ) { int i; /*loop var*/ /*print common data*/ printf("File: %s\n", mSimDataP->custFileName ); printf(" number of customers: %10ld", results[0].numCustomers ); printf(" start time: %10d\n", mSimDataP->strtTime ); printf("customer arrival rate: %10.2f", results[0].arrivalRate ); printf(" total time: %10d\n", mSimDataP->stopTime ); printf(" "); printf(" total time: %10d\n\n\n", mSimDataP->stopTime - mSimDataP->strtTime ); /*print tables with TAB_STEP colums at a time*/ for( i = 0; i < numResult; i+=TAB_STEP ) { PrintSection( results, numResult, i, i+TAB_STEP-1 ); } }/*end ReportResults*/ /* * Function: PrintSection * Usage: ReportResults(&simData); * ------------------------------- * prints the individual stats for the * queues in a row. * Starting with strt and ending with stp */ void PrintSection( simResultsT results[], int numRes, int strt, int stp ) { int i; /*print the number of queues*/ printf("\n\n number of queues: "); for( i = strt; i <= stp && i < numRes; i++ ) { printf("%8ld", results[i].numQue ); } /*print idle times*/ printf("\n percent idle time: "); for( i = strt; i <= stp && i < numRes; i++ ) { printf("%8.2f", results[i].percIdleTime*100 ); } /*print average wait times*/ printf("\n\n average wait: "); for( i = strt; i <= stp && i < numRes; i++ ) { printf("%8.2f", results[i].averageWaitTime); } /*print average service times*/ printf("\n average service time: "); for( i = strt; i <= stp && i < numRes; i++ ) { printf("%8.2f", results[i].averageServiceTime); } /*print longest wait time*/ printf("\n longest wait: "); for( i = strt; i <= stp && i < numRes; i++ ) { printf("%8ld", results[i].lengthLongWait ); } /*print time long wait*/ printf("\n time longest wait: "); for( i = strt; i <= stp && i < numRes; i++ ) { printf("%8ld", results[i].timeLongWait ); } /*print the average length of queues*/ printf("\n\n average queue length: "); for( i = strt; i <= stp && i < numRes; i++ ) { printf("%8.2f", results[i].averageQueLength ); } /*print cust in queues at end*/ printf("\n cust in queues at end: "); for( i = strt; i <= stp && i < numRes; i++ ) { printf("%8ld", results[i].numCustInQue ); } } /* end PrintSection*/ /*---------------End Of File---------------------*/ -- END OF LOG FILE FOR siddiqui --