1 /* Copyright (c) 2017-2018. 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 SIMGRID_S4U_EXEC_HPP
7 #define SIMGRID_S4U_EXEC_HPP
9 #include <simgrid/forward.h>
10 #include <simgrid/s4u/Activity.hpp>
17 /** Computation #Activity, representing the asynchronous disk access.
19 * They are generated from simgrid::s4u::this_actor::exec_init() or simgrid::s4u::Host::execute().
22 class XBT_PUBLIC Exec : public Activity {
23 Exec() : Activity() {}
25 friend XBT_PUBLIC void intrusive_ptr_release(simgrid::s4u::Exec * e);
26 friend XBT_PUBLIC void intrusive_ptr_add_ref(simgrid::s4u::Exec * e);
27 friend XBT_PUBLIC ExecPtr this_actor::exec_init(double flops_amount);
31 static simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> on_start;
32 static simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> on_completion;
34 Activity* start() override;
35 Activity* wait() override;
36 Activity* wait(double timeout) override;
37 Activity* cancel() override;
40 ExecPtr set_priority(double priority);
41 ExecPtr set_bound(double bound);
42 ExecPtr set_host(Host* host);
43 ExecPtr set_name(std::string name);
44 ExecPtr set_tracing_category(std::string category);
47 double get_remaining() override;
48 double get_remaining_ratio();
50 //////////////// Deprecated functions
51 /** @deprecated See Exec::set_priority() */
52 XBT_ATTRIB_DEPRECATED_v323("Please use Exec::set_priority()") ExecPtr setPriority(double priority)
54 return set_priority(priority);
56 /** @deprecated See Exec::set_bound() */
57 XBT_ATTRIB_DEPRECATED_v323("Please use Exec::set_bound()") ExecPtr setBound(double bound) { return set_bound(bound); }
58 /** @deprecated See Exec::set_host() */
59 XBT_ATTRIB_DEPRECATED_v323("Please use Exec::set_host()") ExecPtr setHost(Host* host) { return set_host(host); }
60 /** @deprecated See Exec::get_host() */
61 XBT_ATTRIB_DEPRECATED_v323("Please use Exec::get_host()") Host* getHost() { return get_host(); }
62 /** @deprecated See Exec::get_remaining_ratio() */
63 XBT_ATTRIB_DEPRECATED_v323("Please use Exec::get_remaining_ratio()") double getRemainingRatio()
65 return get_remaining_ratio();
69 Host* host_ = nullptr;
70 double flops_amount_ = 0.0;
71 double priority_ = 1.0;
73 std::string name_ = "";
74 std::string tracing_category_ = "";
75 std::atomic_int_fast32_t refcount_{0};
78 }; // Namespace simgrid::s4u
80 #endif /* SIMGRID_S4U_EXEC_HPP */