1 /* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved. */
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. */
6 #ifndef SIMIX_SYNCHRO_EXEC_HPP
7 #define SIMIX_SYNCHRO_EXEC_HPP
9 #include "src/kernel/activity/ActivityImpl.hpp"
10 #include "src/kernel/context/Context.hpp"
11 #include "surf/surf.hpp"
17 class XBT_PUBLIC ExecImpl : public ActivityImpl_T<ExecImpl> {
18 resource::Action* timeout_detector_ = nullptr;
19 double priority_ = 1.0;
21 std::vector<s4u::Host*> hosts_;
22 std::vector<double> flops_amounts_;
23 std::vector<double> bytes_amounts_;
27 ExecImpl& set_timeout(double timeout);
28 ExecImpl& set_bound(double bound);
29 ExecImpl& set_priority(double priority);
31 ExecImpl& set_flops_amount(double flop_amount);
32 ExecImpl& set_host(s4u::Host* host);
33 s4u::Host* get_host() const { return hosts_.front(); }
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);
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);
47 void finish() override;
49 static xbt::signal<void(ExecImpl&)> on_creation;
50 static xbt::signal<void(ExecImpl const&)> on_completion;
51 static xbt::signal<void(ExecImpl const&, s4u::Host*)> on_migration;
53 } // namespace activity
55 } // namespace simgrid