Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics
[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   resource::Action* timeout_detector_ = nullptr;
19   ~ExecImpl();
20
21 public:
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_name(const std::string& name);
27   ExecImpl* set_tracing_category(const std::string& category);
28   ExecImpl* set_host(s4u::Host* host);
29   ExecImpl* set_timeout(double timeout);
30   void cancel();
31   void post() override;
32   void finish() override;
33   double get_remaining() const;
34   double get_seq_remaining_ratio();
35   double get_par_remaining_ratio();
36   void set_bound(double bound);       // deprecated. To be removed in v3.25
37   void set_priority(double priority); // deprecated. To be removed in v3.25
38   virtual ActivityImpl* migrate(s4u::Host* to);
39
40   /* The host where the execution takes place. nullptr means this is a parallel exec (and only surf knows the hosts) */
41   s4u::Host* host_ = nullptr;
42
43   static xbt::signal<void(ExecImpl&)> on_creation;
44   static xbt::signal<void(ExecImpl const&)> on_completion;
45   static xbt::signal<void(ExecImpl const&, s4u::Host*)> on_migration;
46 };
47 } // namespace activity
48 } // namespace kernel
49 } // namespace simgrid
50 #endif