X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/1a163867e88aadbc98da14c686a06ad2920e825d..40ee10e13b61bfb28374d96ade010a262b5abd44:/include/simgrid/s4u/Host.hpp diff --git a/include/simgrid/s4u/Host.hpp b/include/simgrid/s4u/Host.hpp index dacce60bf4..28ce4691ef 100644 --- a/include/simgrid/s4u/Host.hpp +++ b/include/simgrid/s4u/Host.hpp @@ -51,6 +51,11 @@ class XBT_PUBLIC Host : public xbt::Extendable { friend kernel::resource::CpuAction; // signal exec_state_changed #endif + static xbt::signal on_creation; + static xbt::signal on_destruction; + xbt::signal on_this_destruction; + static xbt::signal on_exec_state_change; + public: explicit Host(kernel::resource::HostImpl* pimpl) : pimpl_(pimpl) {} @@ -58,28 +63,31 @@ protected: virtual ~Host(); // Call destroy() instead of manually deleting it. Host* set_netpoint(kernel::routing::NetPoint* netpoint); - static xbt::signal on_creation; - static xbt::signal on_destruction; - xbt::signal on_this_destruction; - static xbt::signal on_exec_state_change; - public: static xbt::signal on_speed_change; xbt::signal on_this_speed_change; - static xbt::signal on_state_change; - xbt::signal on_this_state_change; + static xbt::signal on_onoff; + xbt::signal on_this_onoff; #endif - /** Add a callback fired on each newly created host */ + /** \static Add a callback fired on each newly created host */ static void on_creation_cb(const std::function& cb) { on_creation.connect(cb); } - /** Add a callback fired when any machine is turned on or off (called AFTER the change) */ - static void on_state_change_cb(const std::function& cb) { on_state_change.connect(cb); } + /** \static Add a callback fired when any machine is turned on or off (called AFTER the change) */ + static void on_onoff_cb(const std::function& cb) + { + on_onoff.connect(cb); + } + XBT_ATTRIB_DEPRECATED_v338("Please use on_onoff_cb() instead") static void on_state_change_cb( + const std::function& cb) + { + on_onoff.connect(cb); + } /** Add a callback fired when this specific machine is turned on or off (called AFTER the change) */ - void on_this_state_change_cb(const std::function& cb) + void on_this_onoff_cb(const std::function& cb) { - on_this_state_change.connect(cb); + on_this_onoff.connect(cb); } - /** Add a callback fired when the speed of any machine is changed (called AFTER the change) + /** \static Add a callback fired when the speed of any machine is changed (called AFTER the change) * (either because of a pstate switch or because of an external load event coming from the profile) */ static void on_speed_change_cb(const std::function& cb) { on_speed_change.connect(cb); } /** Add a callback fired when the speed of this specific machine is changed (called AFTER the change) @@ -88,14 +96,14 @@ public: { on_this_speed_change.connect(cb); } - /** Add a callback fired just before destructing any host */ + /** \static Add a callback fired just before destructing any host */ static void on_destruction_cb(const std::function& cb) { on_destruction.connect(cb); } /** Add a callback fired just before destructing this specific host */ void on_this_destruction_cb(const std::function& cb) { on_this_destruction.connect(cb); } - /** Add a callback fired when the state of any exec activity changes */ + /** \static Add a callback fired when the state of any exec activity changes */ static void on_exec_state_change_cb( const std::function& cb) { @@ -109,11 +117,11 @@ public: Host& operator=(Host const&) = delete; #endif - /** Retrieve a host from its name, or return nullptr */ + /** \static Retrieve a host from its name, or return nullptr */ static Host* by_name_or_null(const std::string& name); - /** Retrieve a host from its name, or die */ + /** \static Retrieve a host from its name, or die */ static Host* by_name(const std::string& name); - /** Retrieves the host on which the running actor is located */ + /** \static Retrieves the host on which the running actor is located */ static Host* current(); /** Retrieves the name of that host as a C++ string */ @@ -172,7 +180,7 @@ public: Host* set_concurrency_limit(int limit); int get_concurrency_limit() const; - /** @brief Convert the CPU's speed from string to double */ + /** \static @brief Convert the CPU's speed from string to double */ static std::vector convert_pstate_speed_vector(const std::vector& speed_per_state); /** * @brief Set the CPU's speed