X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a714f2cc13ccf01d24d8848aafc9085aef8eb6ce..a36a036c5edf09e563f1fe7b1df4aa791e3ea47e:/src/surf/network_interface.hpp diff --git a/src/surf/network_interface.hpp b/src/surf/network_interface.hpp index 2226805752..ca9f7e10c0 100644 --- a/src/surf/network_interface.hpp +++ b/src/surf/network_interface.hpp @@ -33,35 +33,14 @@ class NetworkAction; * Callbacks * *************/ -/** @ingroup SURF_callbacks - * @brief Callbacks handler which emits the callbacks after Link creation - * @details Callback functions have the following signature: `void(Link*)` - */ -XBT_PUBLIC_DATA(simgrid::surf::signal) networkLinkCreatedCallbacks; - -/** @ingroup SURF_callbacks - * @brief Callbacks handler which emits the callbacks after Link destruction - * @details Callback functions have the following signature: `void(Link*)` - */ -XBT_PUBLIC_DATA(simgrid::surf::signal) networkLinkDestructedCallbacks; - -/** @ingroup SURF_callbacks - * @brief Callbacks handler which emits the callbacks after Link State changed - * @details Callback functions have the following signature: `void(LinkAction *action, e_surf_resource_state_t old, e_surf_resource_state_t current)` - */ -XBT_PUBLIC_DATA(simgrid::surf::signal) networkLinkStateChangedCallbacks; -/** @ingroup SURF_callbacks - * @brief Callbacks handler which emits the callbacks after NetworkAction State changed - * @details Callback functions have the following signature: `void(NetworkAction *action, e_surf_action_state_t old, e_surf_action_state_t current)` - */ -XBT_PUBLIC_DATA(simgrid::surf::signal) networkActionStateChangedCallbacks; +/** @brief Callback signal fired when the state of a NetworkAction changes + * Signature: `void(NetworkAction *action, e_surf_action_state_t old, e_surf_action_state_t current)` */ +XBT_PUBLIC_DATA(simgrid::xbt::signal) networkActionStateChangedCallbacks; -/** @ingroup SURF_callbacks - * @brief Callbacks handler which emits the callbacks after communication created - * @details Callback functions have the following signature: `void(NetworkAction *action, RoutingEdge *src, RoutingEdge *dst, double size, double rate)` - */ -XBT_PUBLIC_DATA(simgrid::surf::signal) networkCommunicateCallbacks; +/** @brief Callback signal fired when a NetworkAction is created (when a communication starts) + * Signature: `void(NetworkAction *action, RoutingEdge *src, RoutingEdge *dst, double size, double rate)` */ +XBT_PUBLIC_DATA(simgrid::xbt::signal) networkCommunicateCallbacks; } } @@ -71,8 +50,6 @@ XBT_PUBLIC_DATA(simgrid::surf::signal onCreation; + + /** @brief Callback signal fired when a Link is destroyed. + * Signature: void(Link*) */ + static simgrid::xbt::signal onDestruction; + + /** @brief Callback signal fired when the state of a Link changes (when it is turned on or off) + * Signature: `void(Link*)` */ + static simgrid::xbt::signal onStateChange; + /** @brief Get the bandwidth in bytes per second of current Link */ virtual double getBandwidth(); /** @brief Update the bandwidth in bytes per second of current Link */ - virtual void updateBandwidth(double value, double date=surf_get_clock())=0; + virtual void updateBandwidth(double value)=0; /** @brief Get the latency in seconds of current Link */ virtual double getLatency(); /** @brief Update the latency in seconds of current Link */ - virtual void updateLatency(double value, double date=surf_get_clock())=0; + virtual void updateLatency(double value)=0; - /** @brief The sharing policy is a @{link #e_surf_link_sharing_policy_t} (0: FATPIPE, 1: SHARED, 2: FULLDUPLEX) */ + /** @brief The sharing policy is a @{link e_surf_link_sharing_policy_t::EType} (0: FATPIPE, 1: SHARED, 2: FULLDUPLEX) */ virtual int sharingPolicy(); /** @brief Check if the Link is used */ - bool isUsed(); + bool isUsed() override; - void setState(e_surf_resource_state_t state); + void turnOn() override; + void turnOff() override; - /* Using this object with the public part of - model does not make sense */ - double m_latCurrent = 0; - tmgr_trace_event_t p_latEvent = NULL; + virtual void set_state_trace(tmgr_trace_t trace); /*< setup the trace file with states events (ON or OFF). Trace must contain boolean values. */ + virtual void set_bandwidth_trace(tmgr_trace_t trace); /*< setup the trace file with bandwidth events (peak speed changes due to external load). Trace must contain percentages (value between 0 and 1). */ + virtual void set_latency_trace(tmgr_trace_t trace); /*< setup the trace file with latency events (peak latency changes due to external load). Trace must contain absolute values */ - /* LMM */ - tmgr_trace_event_t p_stateEvent = NULL; - s_surf_metric_t p_speed; + tmgr_trace_iterator_t m_stateEvent = NULL; + s_surf_metric_t m_latency = {1.0,0,NULL}; + s_surf_metric_t m_bandwidth = {1.0,0,NULL}; /* User data */ public: @@ -258,7 +255,7 @@ private: static boost::unordered_map *links; public: static Link *byName(const char* name); - static int linksAmount(); + static int linksCount(); static Link **linksList(); static void linksExit(); };