Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of ssh://scm.gforge.inria.fr/gitroot/simgrid/simgrid
[simgrid.git] / include / simgrid / s4u / Exec.hpp
1 /* Copyright (c) 2017-2018. 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_S4U_EXEC_HPP
7 #define SIMGRID_S4U_EXEC_HPP
8
9 #include <simgrid/forward.h>
10 #include <simgrid/s4u/Activity.hpp>
11
12 #include <atomic>
13
14 namespace simgrid {
15 namespace s4u {
16
17 class XBT_PUBLIC Exec : public Activity {
18   Exec() : Activity() {}
19 public:
20   friend XBT_PUBLIC void intrusive_ptr_release(simgrid::s4u::Exec * e);
21   friend XBT_PUBLIC void intrusive_ptr_add_ref(simgrid::s4u::Exec * e);
22   friend XBT_PUBLIC ExecPtr this_actor::exec_init(double flops_amount);
23
24   ~Exec() = default;
25
26   Activity* start() override;
27   Activity* wait() override;
28   Activity* wait(double timeout) override;
29   bool test();
30
31   ExecPtr setPriority(double priority);
32   ExecPtr setBound(double bound);
33   ExecPtr setHost(Host * host);
34   Host* getHost() { return host_; }
35
36   double get_remaining() override;
37   double getRemainingRatio();
38
39 private:
40   Host* host_          = nullptr;
41   double flops_amount_ = 0.0;
42   double priority_     = 1.0;
43   double bound_        = 0.0;
44   std::atomic_int_fast32_t refcount_{0};
45 }; // class
46 }
47 }; // Namespace simgrid::s4u
48
49 #endif /* SIMGRID_S4U_EXEC_HPP */