Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
966438fdce81b421b142be23de57a691f86e2f2f
[simgrid.git] / src / kernel / activity / ExecImpl.hpp
1 /* Copyright (c) 2007-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 SIMIX_SYNCHRO_EXEC_HPP
7 #define SIMIX_SYNCHRO_EXEC_HPP
8
9 #include "src/kernel/activity/ActivityImpl.hpp"
10 #include "src/kernel/context/Context.hpp"
11 #include "surf/surf.hpp"
12
13 namespace simgrid {
14 namespace kernel {
15 namespace activity {
16
17 class XBT_PUBLIC ExecImpl : public ActivityImpl {
18   ~ExecImpl() override;
19
20 public:
21   explicit ExecImpl(std::string name, std::string tracing_category);
22   ExecImpl* start(double flops_amount, double priority, double bound);
23   ExecImpl* start(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
24                   const std::vector<double>& bytes_amounts);
25
26   ExecImpl* set_host(s4u::Host* host);
27   ExecImpl* set_timeout(double timeout);
28   void cancel();
29   void post() override;
30   void finish() override;
31   double get_remaining();
32   double get_seq_remaining_ratio();
33   double get_par_remaining_ratio();
34   void set_bound(double bound);       // deprecated. To be removed in v3.25
35   void set_priority(double priority); // deprecated. To be removed in v3.25
36   virtual ActivityImpl* migrate(s4u::Host* to);
37
38   /* The host where the execution takes place. nullptr means this is a parallel exec (and only surf knows the hosts) */
39   s4u::Host* host_ = nullptr;
40
41 private:
42   resource::Action* timeout_detector_ = nullptr;
43
44 public:
45   static simgrid::xbt::signal<void(ExecImplPtr)> on_creation;
46   static simgrid::xbt::signal<void(ExecImplPtr)> on_completion;
47   static simgrid::xbt::signal<void(ExecImplPtr, simgrid::s4u::Host*)> on_migration;
48 };
49 }
50 }
51 } // namespace simgrid::kernel::activity
52 #endif