-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExit.cpp
More file actions
26 lines (23 loc) · 876 Bytes
/
Copy pathExit.cpp
File metadata and controls
26 lines (23 loc) · 876 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
*Name : Kabir Bhakta Student Number: 7900098
*Purpose : Exit implementation which gathers all the statistics of the process and store it in to be printed at the end of the execution of the entire simulation
*/
#include "Simulation.h"
#include "Exit.h"
#include "Process.h"
#include <iostream>
using namespace std;
//constructor
Exit::Exit(int time, Process *currProcess, Simulation *siml) : Event(time, currProcess, siml) {}
//Set the exit time of the process and also set the wait time of the process
void Exit::handleEvent()
{
Simulation *sim = this->getSim();
Process *process = this->getProcess();
process->setExitTime(this->getTime());
process->setWaitTime();
}
void Exit::print()
{
cout << "Time\t" << this->getTime() << ":\tProcess\t" << this->getProcess()->getId() << " completes all its CPU and I/O burst. It exits Simulation." << endl;
}