Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : move functions about snapshot comparison in a separate file mc_compare.c
[simgrid.git] / src / surf / network.c
index 5bc5bab..e295c73 100644 (file)
@@ -122,15 +122,17 @@ static double smpi_bandwidth_factor(double size)
 
   unsigned int iter = 0;
   s_smpi_factor_t fact;
-
+  double current=1.0;
   xbt_dynar_foreach(smpi_bw_factor, iter, fact) {
-    if (size < fact.factor) {
-      XBT_DEBUG("%lf < %ld return %f", size, fact.factor, fact.value);
-      return fact.value;
-    }
+    if (size <= fact.factor) {
+      XBT_DEBUG("%lf <= %ld return %f", size, fact.factor, current);
+      return current;
+    }else
+      current=fact.value;
   }
+  XBT_DEBUG("%lf > %ld return %f", size, fact.factor, current);
 
-  return 1.0;
+  return current;
 }
 
 static double smpi_latency_factor(double size)
@@ -141,16 +143,17 @@ static double smpi_latency_factor(double size)
 
   unsigned int iter = 0;
   s_smpi_factor_t fact;
-
+  double current=1.0;
   xbt_dynar_foreach(smpi_lat_factor, iter, fact) {
-    if (size < fact.factor) {
-      XBT_DEBUG("%lf < %ld return %f", size, fact.factor, fact.value);
-      return fact.value;
-    }
-
+    if (size <= fact.factor) {
+      XBT_DEBUG("%lf <= %ld return %f", size, fact.factor, current);
+      return current;
+    }else
+      current=fact.value;
   }
+  XBT_DEBUG("%lf > %ld return %f", size, fact.factor, current);
 
-  return 1.0;
+  return current;
 }
 
 /**--------- <copy/paste C code snippet in surf/network.c> -----------*/