-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScheduler.hxx
69 lines (57 loc) · 1.4 KB
/
Scheduler.hxx
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef SCHEDULER_H
#define SCHEDULER_H
#include "Task.hxx"
#include "Schedule.hxx"
#include "Logger.hxx"
/**
* Scheduler declaration
* @author Richard Kerr
* @author Dillon Koval
* Manages active tasks, updates as needed
* Determines which task runs
*/
class Scheduler
{
public:
/**
* Scheduler constructor
*/
Scheduler(unsigned int cores, bool verbose) : maxSimult(cores), time(0), logger(verbose) {};
/**
* Destructor
*/
~Scheduler();
/**
* Returns task queue
*/
std::list<Task*>* getTaskQueue();
/**
* Returns blocked task queue
*/
std::list<Task*>* getBlockedQueue();
/**
* Set the schedule to be used
*/
void setSchedule(Schedule* sch);
/**
* Increment time passed, unload+log finished tasks
*/
void updateTasks(int timestep = 1);
/**
* Uses the Schedule strategy to order tasks
*/
void sortQueue();
/**
* Print logged data
*/
void logOutput();
private:
void logTask(Task* task);
unsigned int maxSimult;//# of tasks to update simultaneously
int time;
std::list<Task*> runningTasks;
std::list<Task*> blockedTasks;
Schedule* schedule;
Logger logger;
};
#endif // SCHEDULER_H