Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make cmd-line option "network/TCP-gamma" neat and clean
[simgrid.git] / src / surf / network_cm02.cpp
index c264794..3970dcc 100644 (file)
@@ -17,7 +17,6 @@ double sg_latency_factor = 1.0; /* default value; can be set by model or from co
 double sg_bandwidth_factor = 1.0;       /* default value; can be set by model or from command line */
 double sg_weight_S_parameter = 0.0;     /* default value; can be set by model or from command line */
 
-double sg_tcp_gamma = 0.0;
 int sg_network_crosstraffic = 0;
 
 /************************************************************************/
@@ -310,11 +309,11 @@ kernel::resource::Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Hos
 
   if (action->rate_ < 0) {
     get_maxmin_system()->update_variable_bound(
-        action->get_variable(), (action->lat_current_ > 0) ? sg_tcp_gamma / (2.0 * action->lat_current_) : -1.0);
+        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_, sg_tcp_gamma / (2.0 * action->lat_current_))
+                                    ? std::min(action->rate_, cfg_tcp_gamma / (2.0 * action->lat_current_))
                                     : action->rate_);
   }
 
@@ -371,7 +370,7 @@ void NetworkCm02Link::apply_event(tmgr_trace_event_t triggered, double value)
       turn_on();
     else {
       kernel::lmm::Variable* var = nullptr;
-      const_lmm_element_t elem = nullptr;
+      const kernel::lmm::Element* elem = nullptr;
       double now               = surf_get_clock();
 
       turn_off();
@@ -407,8 +406,8 @@ void NetworkCm02Link::setBandwidth(double value)
     double delta = sg_weight_S_parameter / value - sg_weight_S_parameter / (bandwidth_.peak * bandwidth_.scale);
 
     kernel::lmm::Variable* var;
-    const_lmm_element_t elem     = nullptr;
-    const_lmm_element_t nextelem = nullptr;
+    const kernel::lmm::Element* elem     = nullptr;
+    const kernel::lmm::Element* nextelem = nullptr;
     int numelem                  = 0;
     while ((var = get_constraint()->get_variable_safe(&elem, &nextelem, &numelem))) {
       NetworkCm02Action* action = static_cast<NetworkCm02Action*>(var->get_id());
@@ -423,8 +422,8 @@ void NetworkCm02Link::setLatency(double value)
 {
   double delta                 = value - latency_.peak;
   kernel::lmm::Variable* var   = nullptr;
-  const_lmm_element_t elem     = nullptr;
-  const_lmm_element_t nextelem = nullptr;
+  const kernel::lmm::Element* elem     = nullptr;
+  const kernel::lmm::Element* nextelem = nullptr;
   int numelem                  = 0;
 
   latency_.peak = value;
@@ -434,13 +433,13 @@ void NetworkCm02Link::setLatency(double value)
     action->lat_current_ += delta;
     action->weight_ += delta;
     if (action->rate_ < 0)
-      get_model()->get_maxmin_system()->update_variable_bound(action->get_variable(),
-                                                              sg_tcp_gamma / (2.0 * action->lat_current_));
+      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_, sg_tcp_gamma / (2.0 * action->lat_current_)));
+          action->get_variable(), std::min(action->rate_, NetworkModel::cfg_tcp_gamma / (2.0 * action->lat_current_)));
 
-      if (action->rate_ < sg_tcp_gamma / (2.0 * action->lat_current_)) {
+      if (action->rate_ < 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_);