WRENCH  1.10
Cyberinfrastructure Simulation Workbench
Overview Installation Getting Started WRENCH 101 WRENCH 102
NodeAvailabilityTimeLine.h
1 
10 #ifndef WRENCH_NODEAVAILABILITYTIMELINE_H
11 #define WRENCH_NODEAVAILABILITYTIMELINE_H
12 
13 #include <vector>
14 #include <boost/icl/interval_map.hpp>
15 #include "BatchJobSet.h"
16 
17 /***********************/
19 /***********************/
20 
21 namespace wrench {
22 
23 
24  class BatchJob;
25 
29  class NodeAvailabilityTimeLine {
30 
31  public:
32  explicit NodeAvailabilityTimeLine(unsigned long max_num_nodes);
33  void setTimeOrigin(u_int32_t t);
34  void add(u_int32_t start, u_int32_t end, std::shared_ptr<BatchJob>job) { update(true, start, end, job);}
35  void remove(u_int32_t start, u_int32_t end, std::shared_ptr<BatchJob> job) { update(false, start, end, job);}
36  void clear();
37  void print();
38  std::set<std::shared_ptr<BatchJob>> getJobsInFirstSlot();
39  u_int32_t findEarliestStartTime(uint32_t duration, unsigned long num_nodes);
40 
41  private:
42  unsigned long max_num_nodes;
43  boost::icl::interval_map<u_int32_t, BatchJobSet, boost::icl::partial_enricher> availability_timeslots;
44 
45  void update(bool add, u_int32_t start, u_int32_t end, std::shared_ptr<BatchJob>job);
46 
47  };
48 
49 }
50 
51 /***********************/
53 /***********************/
54 
55 #endif //WRENCH_NODEAVAILABILITYTIMELINE_H
wrench
Definition: Alarm.cpp:20