Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
have a on_completion per activity type to save users some dynamic_cast-based filtering
[simgrid.git] / examples / cpp / exec-cpu-factors / s4u-exec-cpu-factors.cpp
index c62b7c3d542274675bb53535efe8648c03373875..ea80a2231d4522a477415745f75658f374dc039e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2022. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2023. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -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;
 }