Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Misc code simplifications guided by Sonar smells.
[simgrid.git] / examples / cpp / exec-cpu-factors / s4u-exec-cpu-factors.cpp
index c62b7c3d542274675bb53535efe8648c03373875..6f6ce5381ed5cea4da5840de18ebf84692188570 100644 (file)
@@ -31,11 +31,7 @@ static double cpu_variability(const sg4::Host* host, double flops)
 {
   /* creates variability for tasks smaller than 1% of CPU power.
    * unrealistic, for learning purposes */
-  double factor = 1.0;
-  double speed  = host->get_speed();
-  if (flops < speed / 100) {
-    factor = 0.5;
-  }
+  double factor = (flops < host->get_speed() / 100) ? 0.5 : 1.0;
   XBT_INFO("Host %s, task with %lf flops, new factor %lf", host->get_cname(), flops, factor);
   return factor;
 }