forked from SWE501-Spring2017-Bogazici/FinalProject
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCpuOutEvent.cpp
More file actions
31 lines (23 loc) · 686 Bytes
/
CpuOutEvent.cpp
File metadata and controls
31 lines (23 loc) · 686 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
27
28
29
30
31
//
// Created by Can Candan on 04/06/17.
//
#include "CpuOutEvent.h"
#include "CpuInEvent.h"
#include "TaskOutArrivalEvent.h"
using namespace std;
CpuOutEvent::CpuOutEvent(Simulation *pSimulation, Task *pTask, double time, Cpu *pCpu) : Event(pSimulation, pTask, time) {
this->cpu=pCpu;
name="CpuOutEvent";
}
void CpuOutEvent::process() {
log();
cpu->setIdle(true);
Task* newTask= sim->popFromSJFQueue();
if (newTask) {
CpuInEvent* event = new CpuInEvent(sim, newTask, time, cpu);
sim->schedule(event);
}
task->setOutTime(time);
TaskOutArrivalEvent* event= new TaskOutArrivalEvent(sim, task, time);
sim->schedule(event);
}