Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fdae8c5f9d5cb9f396d9dbfed3d8ff39364a4edf
[simgrid.git] / src / kernel / resource / profile / Profile.hpp
1 /* Copyright (c) 2004-2019. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef PROFILE_HPP
7 #define PROFILE_HPP
8
9 #include "src/kernel/resource/profile/DatedValue.hpp"
10 #include "src/kernel/resource/profile/FutureEvtSet.hpp"
11 #include <queue>
12 #include <vector>
13
14 namespace simgrid {
15 namespace kernel {
16 namespace profile {
17
18 class Event {
19 public:
20   Profile* profile;
21   unsigned int idx;
22   resource::Resource* resource;
23   bool free_me;
24 };
25
26 /** @brief A profile is a set of timed values, encoding the value that a variable takes at what time
27  *
28  * It is useful to model dynamic platforms, where an external load that makes the resource availability change over
29  * time. To model that, you have to set several profiles per resource: one for the on/off state and one for each
30  * numerical value (computational speed, bandwidth and/or latency).
31  */
32 class XBT_PUBLIC Profile {
33 public:
34   /**  Creates an empty trace */
35   explicit Profile();
36   virtual ~Profile();
37   Event* schedule(FutureEvtSet* fes, resource::Resource* resource);
38   DatedValue next(Event* event);
39
40   static Profile* from_file(const std::string& path);
41   static Profile* from_string(const std::string& name, const std::string& input, double periodicity);
42   // private:
43   std::vector<DatedValue> event_list;
44
45 private:
46   FutureEvtSet* fes_ = nullptr;
47 };
48
49 } // namespace profile
50 } // namespace kernel
51 } // namespace simgrid
52
53 #endif