Logo AND Algorithmique Numérique Distribuée

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