Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename Action::priority into Action::sharing_penalty in surf as it should be
[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_T<ExecImpl> {
18   resource::Action* timeout_detector_ = nullptr;
19   double sharing_penalty_             = 1.0;
20   double bound_                       = 0.0;
21   std::vector<s4u::Host*> hosts_;
22   std::vector<double> flops_amounts_;
23   std::vector<double> bytes_amounts_;
24   ~ExecImpl();
25
26 public:
27   ExecImpl& set_timeout(double timeout);
28   ExecImpl& set_bound(double bound);
29   ExecImpl& set_sharing_penalty(double sharing_penalty);
30
31   ExecImpl& set_flops_amount(double flop_amount);
32   ExecImpl& set_host(s4u::Host* host);
33   s4u::Host* get_host() const { return hosts_.front(); }
34
35   ExecImpl& set_flops_amounts(const std::vector<double>& flops_amounts);
36   ExecImpl& set_bytes_amounts(const std::vector<double>& bytes_amounts);
37   ExecImpl& set_hosts(const std::vector<s4u::Host*>& hosts);
38
39   unsigned int get_host_number() const { return hosts_.size(); }
40   double get_seq_remaining_ratio();
41   double get_par_remaining_ratio();
42   virtual ActivityImpl* migrate(s4u::Host* to);
43
44   ExecImpl* start();
45   void post() override;
46   void finish() override;
47
48   static xbt::signal<void(ExecImpl&)> on_creation;
49   static xbt::signal<void(ExecImpl const&)> on_completion;
50   static xbt::signal<void(ExecImpl const&, s4u::Host*)> on_migration;
51 };
52 } // namespace activity
53 } // namespace kernel
54 } // namespace simgrid
55 #endif