WRENCH  1.10
Cyberinfrastructure Simulation Workbench
Overview Installation Getting Started WRENCH 101 WRENCH 102
CoreAvailabilityTimeLine.h
1 
10 #ifndef WRENCH_COREAVAILABILITYTIMELINE_H
11 #define WRENCH_COREAVAILABILITYTIMELINE_H
12 
13 #include <vector>
14 #include <boost/icl/interval_map.hpp>
15 #include "BatchJobSetCoreLevel.h"
16 
17 /***********************/
19 /***********************/
20 
21 namespace wrench {
22 
23 
24  class BatchJob;
25 
29  class CoreAvailabilityTimeLine {
30 
31  public:
32  explicit CoreAvailabilityTimeLine(unsigned long max_num_nodes, unsigned long max_num_cores_per_node);
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  std::pair<u_int32_t, std::vector<int>> findEarliestStartTime(uint32_t duration, unsigned long num_nodes, unsigned long num_cores_per_node);
40 
41  private:
42  unsigned long max_num_nodes;
43  unsigned long max_num_cores_per_node;
44  boost::icl::interval_map<u_int32_t, BatchJobSetCoreLevel, boost::icl::partial_enricher> availability_timeslots;
45 
46  void update(bool add, u_int32_t start, u_int32_t end, std::shared_ptr<BatchJob>job);
47 
48  std::set<int> integer_sequence;
49 
50  };
51 
52 }
53 
54 /***********************/
56 /***********************/
57 
58 #endif //WRENCH_COREEAVAILABILITYTIMELINE_H
wrench
Definition: Alarm.cpp:20