Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Various cleanups in the routing code, all by Silas
[simgrid.git] / src / surf / network.c
index 165a1fb..e7292f1 100644 (file)
@@ -20,12 +20,9 @@ double latency_factor = 1.0;    /* default value */
 double bandwidth_factor = 1.0;  /* default value */
 double weight_S_parameter = 0.0;        /* default value */
 
-int card_number = 0;
-int host_count = 0;
 double sg_tcp_gamma = 0.0;
 
 
-
 static link_CM02_t link_new(char *name,
                             double bw_initial,
                             tmgr_trace_t bw_trace,
@@ -266,14 +263,15 @@ static void update_resource_state(void *id,
 
   if (event_type == nw_link->lmm_resource.power.event) {
     double delta =
-      weight_S_parameter / value - weight_S_parameter / nw_link->lmm_resource.power.current;
+      weight_S_parameter / value - weight_S_parameter /
+          (nw_link->lmm_resource.power.peak * nw_link->lmm_resource.power.scale);
     lmm_variable_t var = NULL;
     lmm_element_t elem = NULL;
     surf_action_network_CM02_t action = NULL;
 
-    nw_link->lmm_resource.power.current = value;
+    nw_link->lmm_resource.power.peak = value;
     lmm_update_constraint_bound(network_maxmin_system, nw_link->lmm_resource.constraint,
-                                bandwidth_factor * nw_link->lmm_resource.power.current);
+                                bandwidth_factor * (nw_link->lmm_resource.power.peak * nw_link->lmm_resource.power.scale));
     if (weight_S_parameter > 0) {
       while ((var = lmm_get_var_from_cnst
               (network_maxmin_system, nw_link->lmm_resource.constraint, &elem))) {
@@ -374,7 +372,9 @@ static surf_action_t communicate(const char *src_name, const char *dst_name,int
   xbt_dynar_foreach(route,i,link) {
     action->latency += link->lat_current;
     action->weight +=
-      link->lat_current + weight_S_parameter / link->lmm_resource.power.current;
+      link->lat_current +
+      weight_S_parameter /
+        (link->lmm_resource.power.peak * link->lmm_resource.power.scale);
   }
   /* LARGE PLATFORMS HACK:
      Add src->link and dst->link latencies */
@@ -422,7 +422,8 @@ static surf_action_t communicate(const char *src_name, const char *dst_name,int
 
 static double get_link_bandwidth(const void *link)
 {
-  return ((link_CM02_t) link)->lmm_resource.power.current;
+  surf_resource_lmm_t lmm = (surf_resource_lmm_t)link;
+  return lmm->power.peak * lmm->power.scale;
 }
 
 static double get_link_latency(const void *link)
@@ -470,7 +471,6 @@ static void finalize(void)
   surf_network_model = NULL;
 
   used_routing->finalize();
-  host_count = 0;
   lmm_system_free(network_maxmin_system);
   network_maxmin_system = NULL;
 }