Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cleanup after the split of kernel/resource/profile into several classes
[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 SIMGRID_KERNEL_PROFILE_HPP
7 #define SIMGRID_KERNEL_PROFILE_HPP
8
9 #include "simgrid/forward.h"
10 #include "src/kernel/resource/profile/DatedValue.hpp"
11 #include "src/kernel/resource/profile/FutureEvtSet.hpp"
12
13 #include <queue>
14 #include <vector>
15
16 namespace simgrid {
17 namespace kernel {
18 namespace profile {
19
20 /** @brief A profile is a set of timed values, encoding the value that a variable takes at what time
21  *
22  * It is useful to model dynamic platforms, where an external load that makes the resource availability change over
23  * time. To model that, you have to set several profiles per resource: one for the on/off state and one for each
24  * numerical value (computational speed, bandwidth and/or latency).
25  */
26 class XBT_PUBLIC Profile {
27 public:
28   /**  Creates an empty trace */
29   explicit Profile();
30   virtual ~Profile();
31   Event* schedule(FutureEvtSet* fes, resource::Resource* resource);
32   DatedValue next(Event* event);
33
34   static Profile* from_file(const std::string& path);
35   static Profile* from_string(const std::string& name, const std::string& input, double periodicity);
36   // private:
37   std::vector<DatedValue> event_list;
38
39 private:
40   FutureEvtSet* fes_ = nullptr;
41 };
42
43 } // namespace profile
44 } // namespace kernel
45 } // namespace simgrid
46
47 /** Module finalizer: frees all profiles */
48 XBT_PUBLIC void tmgr_finalize();
49
50 #endif