Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill unused constants.
[simgrid.git] / examples / s4u / cloud-capping / s4u-cloud-capping.cpp
index 07392b7..69f3323 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2019. 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. */
@@ -32,11 +32,10 @@ static void worker(double computation_amount, bool use_bound, double bound)
     XBT_INFO("not bound => duration %f (%f flops/s)", duration, flops_per_sec);
 }
 
-#define DOUBLE_MAX 1e11
 static void worker_busy_loop(const char* name, double speed)
 {
-  simgrid::s4u::ExecPtr exec = simgrid::s4u::this_actor::exec_async(DOUBLE_MAX);
-  double exec_remain_prev    = DOUBLE_MAX;
+  double exec_remain_prev    = 1e11;
+  simgrid::s4u::ExecPtr exec = simgrid::s4u::this_actor::exec_async(exec_remain_prev);
   for (int i = 0; i < 10; i++) {
     if (speed > 0) {
       double new_bound = (speed / 10) * i;
@@ -63,7 +62,7 @@ static void test_dynamic_change()
   vm1->start();
 
   simgrid::s4u::Actor::create("worker0", vm0, worker_busy_loop, "Task0", -1);
-  simgrid::s4u::Actor::create("worker1", vm1, worker_busy_loop, "Task1", pm0->getSpeed());
+  simgrid::s4u::Actor::create("worker1", vm1, worker_busy_loop, "Task1", pm0->get_speed());
 
   simgrid::s4u::this_actor::sleep_for(3000); // let the tasks end
   vm0->destroy();
@@ -72,10 +71,10 @@ static void test_dynamic_change()
 
 static void test_one_task(simgrid::s4u::Host* host)
 {
-  const double cpu_speed          = host->getSpeed();
+  const double cpu_speed          = host->get_speed();
   const double computation_amount = cpu_speed * 10;
 
-  XBT_INFO("### Test: with/without MSG_task_set_bound");
+  XBT_INFO("### Test: with/without task set_bound");
 
   XBT_INFO("### Test: no bound for Task1@%s", host->get_cname());
   simgrid::s4u::Actor::create("worker0", host, worker, computation_amount, false, 0);
@@ -105,8 +104,8 @@ static void test_one_task(simgrid::s4u::Host* host)
 
 static void test_two_tasks(simgrid::s4u::Host* hostA, simgrid::s4u::Host* hostB)
 {
-  const double cpu_speed = hostA->getSpeed();
-  xbt_assert(cpu_speed == hostB->getSpeed());
+  const double cpu_speed = hostA->get_speed();
+  xbt_assert(cpu_speed == hostB->get_speed());
   const double computation_amount = cpu_speed * 10;
   const char* hostA_name          = hostA->get_cname();
   const char* hostB_name          = hostB->get_cname();
@@ -189,7 +188,7 @@ static void master_main()
   vm0->destroy();
 
   vm0 = new simgrid::s4u::VirtualMachine("VM0", pm0, 1);
-  vm0->set_bound(pm0->getSpeed() / 10);
+  vm0->set_bound(pm0->get_speed() / 10);
   vm0->start();
 
   XBT_INFO("# 7. Put a single task on the VM capped by 10%%.");
@@ -210,7 +209,7 @@ static void master_main()
   vm0->set_ramsize(1e9); // 1GB
   vm0->start();
 
-  double cpu_speed = pm0->getSpeed();
+  double cpu_speed = pm0->get_speed();
 
   XBT_INFO("# 10. Test migration");
   const double computation_amount = cpu_speed * 10;