Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
NO_MAX_DURATION is a double.
[simgrid.git] / src / surf / cpu_ti.cpp
index df5dd66..a24b853 100644 (file)
@@ -56,11 +56,10 @@ CpuTiProfile::CpuTiProfile(const profile::Profile* profile)
  */
 double CpuTiTmgr::integrate(double a, double b) const
 {
-  if ((a < 0.0) || (a > b)) {
-    xbt_die("Error, invalid integration interval [%.2f,%.2f]. "
-            "You probably have a task executing with negative computation amount. Check your code.",
-            a, b);
-  }
+  xbt_assert(a >= 0.0 && a <= b,
+             "Error, invalid integration interval [%.2f,%.2f]. You probably have a task executing with negative "
+             "computation amount. Check your code.",
+             a, b);
   if (fabs(a - b) < EPSILON)
     return 0.0;
 
@@ -158,8 +157,8 @@ double CpuTiTmgr::solve(double a, double amount) const
   XBT_DEBUG("amount %f total %f", amount, total_);
   /* Reduce the problem to one where amount <= trace_total */
   double quotient       = floor(amount / total_);
-  double reduced_amount = (total_) * ((amount / total_) - floor(amount / total_));
-  double reduced_a      = a - (last_time_) * static_cast<int>(floor(a / last_time_));
+  double reduced_amount = total_ * ((amount / total_) - floor(amount / total_));
+  double reduced_a      = a - last_time_ * static_cast<int>(floor(a / last_time_));
 
   XBT_DEBUG("Quotient: %g reduced_amount: %f reduced_a: %f", quotient, reduced_amount, reduced_a);
 
@@ -412,7 +411,7 @@ void CpuTi::update_actions_finish_time(double now)
   }
 
   for (CpuTiAction& action : action_set_) {
-    double min_finish = -1;
+    double min_finish = NO_MAX_DURATION;
     /* action not running, skip it */
     if (action.get_state_set() != get_model()->get_started_action_set())
       continue;