From: Frederic Suter Date: Tue, 9 Mar 2021 13:46:24 +0000 (+0100) Subject: mv NetworkAction::rate_ to Action::user_bound_ X-Git-Tag: v3.27~203 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/3554e5655733577059c0c636e5010961d703d3f9 mv NetworkAction::rate_ to Action::user_bound_ --- diff --git a/include/simgrid/kernel/resource/Action.hpp b/include/simgrid/kernel/resource/Action.hpp index aad45aa165..b6dfc79b00 100644 --- a/include/simgrid/kernel/resource/Action.hpp +++ b/include/simgrid/kernel/resource/Action.hpp @@ -58,14 +58,36 @@ public: class XBT_PUBLIC Action { friend ActionHeap; + int refcount_ = 1; + double sharing_penalty_ = 1.0; /**< priority (1.0 by default) */ + double max_duration_ = NO_MAX_DURATION; /*< max_duration (may fluctuate until the task is completed) */ + double remains_; /**< How much of that cost remains to be done in the currently running task */ + double start_time_; /**< start time */ + double finish_time_ = -1; /**< finish time (may fluctuate until the task is completed) */ + std::string category_; /**< tracing category for categorized resource utilization monitoring */ + + double cost_; + Model* model_; + void* data_ = nullptr; /**< for your convenience */ + activity::ActivityImpl* activity_ = nullptr; + + /* LMM */ + double last_update_ = 0; + double last_value_ = 0; + lmm::Variable* variable_ = nullptr; + double user_bound_ = -1; + + ActionHeap::Type type_ = ActionHeap::Type::unset; + boost::optional heap_hook_ = boost::none; + boost::intrusive::list_member_hook<> modified_set_hook_; + boost::intrusive::list_member_hook<> state_set_hook_; + public: /* Lazy update needs this Set hook to maintain a list of the tracked actions */ - boost::intrusive::list_member_hook<> modified_set_hook_; bool is_within_modified_set() const { return modified_set_hook_.is_linked(); } using ModifiedSet = boost::intrusive::list< Action, boost::intrusive::member_hook, &Action::modified_set_hook_>>; - boost::intrusive::list_member_hook<> state_set_hook_; using StateSet = boost::intrusive::list< Action, boost::intrusive::member_hook, &Action::state_set_hook_>>; @@ -84,6 +106,11 @@ public: SLEEPING }; +private: + StateSet* state_set_; + Action::SuspendStates suspended_ = Action::SuspendStates::RUNNING; + +public: /** * @brief Action constructor * @@ -206,36 +233,14 @@ public: Model* get_model() const { return model_; } -private: - StateSet* state_set_; - Action::SuspendStates suspended_ = Action::SuspendStates::RUNNING; - int refcount_ = 1; - double sharing_penalty_ = 1.0; /**< priority (1.0 by default) */ - double max_duration_ = NO_MAX_DURATION; /*< max_duration (may fluctuate until the task is completed) */ - double remains_; /**< How much of that cost remains to be done in the currently running task */ - double start_time_; /**< start time */ - double finish_time_ = -1; /**< finish time (may fluctuate until the task is completed) */ - std::string category_; /**< tracing category for categorized resource utilization monitoring */ - - double cost_; - Model* model_; - void* data_ = nullptr; /**< for your convenience */ - activity::ActivityImpl* activity_ = nullptr; - - /* LMM */ - double last_update_ = 0; - double last_value_ = 0; - lmm::Variable* variable_ = nullptr; - - ActionHeap::Type type_ = ActionHeap::Type::unset; - boost::optional heap_hook_ = boost::none; - -public: ActionHeap::Type get_type() const { return type_; } lmm::Variable* get_variable() const { return variable_; } void set_variable(lmm::Variable* var) { variable_ = var; } + double get_user_bound() const { return user_bound_; } + void set_user_bound(double bound) { user_bound_ = bound; } + double get_last_update() const { return last_update_; } void set_last_update(); diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index 6ade12e0ea..cc1574205e 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -218,7 +218,7 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz action = new NetworkWifiAction(this, *src, *dst, size, failed, src_wifi_link, dst_wifi_link); action->sharing_penalty_ = latency; action->latency_ = latency; - action->rate_ = rate; + action->set_user_bound(rate); if (is_update_lazy()) { action->set_last_update(); @@ -238,7 +238,7 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz action->lat_current_ = action->latency_; action->latency_ *= get_latency_factor(size); - action->rate_ = get_bandwidth_constraint(action->rate_, bandwidth_bound, size); + action->set_user_bound(get_bandwidth_constraint(action->get_user_bound(), bandwidth_bound, size)); size_t constraints_per_variable = route.size(); constraints_per_variable += back_route.size(); @@ -257,14 +257,14 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz } else action->set_variable(get_maxmin_system()->variable_new(action, 1.0, -1.0, constraints_per_variable)); - if (action->rate_ < 0) { + if (action->get_user_bound() < 0) { get_maxmin_system()->update_variable_bound( action->get_variable(), (action->lat_current_ > 0) ? cfg_tcp_gamma / (2.0 * action->lat_current_) : -1.0); } else { get_maxmin_system()->update_variable_bound( action->get_variable(), (action->lat_current_ > 0) - ? std::min(action->rate_, cfg_tcp_gamma / (2.0 * action->lat_current_)) - : action->rate_); + ? std::min(action->get_user_bound(), cfg_tcp_gamma / (2.0 * action->lat_current_)) + : action->get_user_bound()); } if (src_wifi_link != nullptr) @@ -388,14 +388,15 @@ LinkImpl* NetworkCm02Link::set_latency(double value) auto* action = static_cast(var->get_id()); action->lat_current_ += delta; action->sharing_penalty_ += delta; - if (action->rate_ < 0) + if (action->get_user_bound() < 0) get_model()->get_maxmin_system()->update_variable_bound(action->get_variable(), NetworkModel::cfg_tcp_gamma / (2.0 * action->lat_current_)); else { get_model()->get_maxmin_system()->update_variable_bound( - action->get_variable(), std::min(action->rate_, NetworkModel::cfg_tcp_gamma / (2.0 * action->lat_current_))); + action->get_variable(), + std::min(action->get_user_bound(), NetworkModel::cfg_tcp_gamma / (2.0 * action->lat_current_))); - if (action->rate_ < NetworkModel::cfg_tcp_gamma / (2.0 * action->lat_current_)) { + if (action->get_user_bound() < NetworkModel::cfg_tcp_gamma / (2.0 * action->lat_current_)) { XBT_INFO("Flow is limited BYBANDWIDTH"); } else { XBT_INFO("Flow is limited BYLATENCY, latency of flow is %f", action->lat_current_); diff --git a/src/surf/network_interface.hpp b/src/surf/network_interface.hpp index 0ff7b133ce..a109c14bf8 100644 --- a/src/surf/network_interface.hpp +++ b/src/surf/network_interface.hpp @@ -202,7 +202,7 @@ public: double latency_ = 0.; // Delay before the action starts double lat_current_ = 0.; // Used to compute the communication RTT, and accordingly limit the communication rate double sharing_penalty_ = {}; - double rate_ = {}; + s4u::Host& get_src() const { return src_; } s4u::Host& get_dst() const { return dst_; } };