Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines with new year.
[simgrid.git] / teshsuite / s4u / cloud-sharing / cloud-sharing.cpp
index 1cbb06b..7604ded 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2018. The SimGrid Team.
+/* Copyright (c) 2007-2020. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -7,11 +7,12 @@
 #include "simgrid/s4u.hpp"
 #include "simgrid/plugins/energy.h"
 #include "simgrid/s4u/VirtualMachine.hpp"
+#include <cmath>
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this msg example");
 
 const int FAIL_ON_ERROR = 0;
-const int flop_amount = 100000000;
+const int flop_amount   = 100000000; // 100Mf, so that computing this on a 1Gf core takes exactly 0.1s
 int failed_test = 0;
 
 double energy = 0;
@@ -38,13 +39,13 @@ static int computation_fun(std::vector<std::string> argv)
   return 0;
 }
 
-static void run_test_process(std::string name, simgrid::s4u::Host *location, int size)
+static void run_test_process(const std::string& name, simgrid::s4u::Host* location, int size)
 {
   std::vector<std::string> arg = {std::to_string(size)};
-  simgrid::s4u::Actor::create(name, location, computation_fun, arg);
+  simgrid::s4u::Actor::create(std::move(name), location, computation_fun, arg);
 }
 
-static void test_energy_consumption(std::string name, int nb_cores)
+static void test_energy_consumption(const std::string& name, int nb_cores)
 {
   double new_energy = 0;
   
@@ -66,7 +67,7 @@ static void test_energy_consumption(std::string name, int nb_cores)
   }
 }
 
-static void run_test(std::string chooser)
+static void run_test(const std::string& chooser)
 {
   simgrid::s4u::Host *pm0 = simgrid::s4u::Host::by_name("node-0.1core.org");
   simgrid::s4u::Host *pm1 = simgrid::s4u::Host::by_name("node-1.1core.org");