-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJob.cpp
More file actions
48 lines (41 loc) · 1.49 KB
/
Job.cpp
File metadata and controls
48 lines (41 loc) · 1.49 KB
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
#include <cstdint>
#include <memory>
#include "Job.h"
#include "SchedTypes.h"
ID_t Job::_nextId = 0;
std::shared_ptr<Job>
Job::MakeJob(Time_t curTime, Time_t duration, ULong resReqd)
{
std::shared_ptr<Job> job(new Job(_nextId++, curTime, duration, resReqd));
return job;
}
bool JobPrioritizerFn(const std::shared_ptr<Job> a, const std::shared_ptr<Job> b)
{
std::cout << " PANICCCCCCCCCCC" << std::endl;
#ifdef DEBUG_LEVEL5
std::cout << " CompareJobs left " << a->GetRequirement() << " right " << b->GetRequirement() << std::endl;
#endif
return a->GetRequirement() < b->GetRequirement();
}
bool RawDemandPrioritizerFn(const std::shared_ptr<Job> a, const std::shared_ptr<Job> b)
{
#ifdef DEBUG_LEVEL5
std::cout << " CompareJobs left " << a->GetRequirement() << " right " << b->GetRequirement() << std::endl;
#endif
return a->GetRequirement() < b->GetRequirement();
}
bool TimeWeightedDemandPrioritizerFn(const std::shared_ptr<Job> a, const std::shared_ptr<Job> b)
{
#ifdef DEBUG_LEVEL5
std::cout << " CompareJobs left " << a->GetRequirement() * a->GetDuration()
<< " right " << b->GetRequirement() * b->GetDuration() << std::endl;
#endif
return a->GetRequirement() * a->GetDuration() > b->GetRequirement() * b->GetDuration();
}
bool FCFSPrioritizerFn(const std::shared_ptr<Job> a, const std::shared_ptr<Job> b)
{
#ifdef DEBUG_LEVEL5
std::cout << " CompareJobs left " << a->GetEntryTime() << " right " << b->GetEntryTime() << std::endl;
#endif
return a->GetEntryTime() < b->GetEntryTime();
}