X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/63ebf4be4ca6a243a64c7ded8df9b96a9d28d3ff..2c0aa88e3d941e79fc79d39e3e58224d282b76d3:/examples/s4u/cloud-simple/s4u-cloud-simple.cpp diff --git a/examples/s4u/cloud-simple/s4u-cloud-simple.cpp b/examples/s4u/cloud-simple/s4u-cloud-simple.cpp index 6487b3268d..65cc5feb7e 100644 --- a/examples/s4u/cloud-simple/s4u-cloud-simple.cpp +++ b/examples/s4u/cloud-simple/s4u-cloud-simple.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2020. 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. */ @@ -15,7 +15,7 @@ static void computation_fun() simgrid::s4u::this_actor::execute(1000000); double clock_end = simgrid::s4u::Engine::get_clock(); - XBT_INFO("%s:%s task executed %g", simgrid::s4u::this_actor::get_host()->get_cname(), + XBT_INFO("%s:%s executed %g", simgrid::s4u::this_actor::get_host()->get_cname(), simgrid::s4u::this_actor::get_cname(), clock_end - clock_sta); } @@ -32,8 +32,8 @@ struct s_payload { static void communication_tx_fun(std::vector args) { - simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(args.at(0)); - s_payload* payload = new s_payload; + simgrid::s4u::Mailbox* mbox = simgrid::s4u::Mailbox::by_name(args.at(0)); + auto* payload = new s_payload; payload->tx_actor_name = simgrid::s4u::Actor::self()->get_cname(); payload->tx_host = simgrid::s4u::this_actor::get_host(); payload->clock_sta = simgrid::s4u::Engine::get_clock(); @@ -45,9 +45,9 @@ static void communication_rx_fun(std::vector args) { const char* actor_name = simgrid::s4u::Actor::self()->get_cname(); const char* host_name = simgrid::s4u::this_actor::get_host()->get_cname(); - simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(args.at(0)); + simgrid::s4u::Mailbox* mbox = simgrid::s4u::Mailbox::by_name(args.at(0)); - struct s_payload* payload = static_cast(mbox->get()); + const auto* payload = static_cast(mbox->get()); double clock_end = simgrid::s4u::Engine::get_clock(); XBT_INFO("%s:%s to %s:%s => %g sec", payload->tx_host->get_cname(), payload->tx_actor_name, host_name, actor_name, @@ -75,26 +75,27 @@ static void master_main() XBT_INFO("## Test 1 (started): check computation on normal PMs"); - XBT_INFO("### Put a task on a PM"); + XBT_INFO("### Put an activity on a PM"); launch_computation_worker(pm0); simgrid::s4u::this_actor::sleep_for(2); - XBT_INFO("### Put two tasks on a PM"); + XBT_INFO("### Put two activities on a PM"); launch_computation_worker(pm0); launch_computation_worker(pm0); simgrid::s4u::this_actor::sleep_for(2); - XBT_INFO("### Put a task on each PM"); + XBT_INFO("### Put an activity on each PM"); launch_computation_worker(pm0); launch_computation_worker(pm1); simgrid::s4u::this_actor::sleep_for(2); XBT_INFO("## Test 1 (ended)"); - XBT_INFO("## Test 2 (started): check impact of running a task inside a VM (there is no degradation for the moment)"); + XBT_INFO( + "## Test 2 (started): check impact of running an activity inside a VM (there is no degradation for the moment)"); - XBT_INFO("### Put a VM on a PM, and put a task to the VM"); - simgrid::s4u::VirtualMachine* vm0 = new simgrid::s4u::VirtualMachine("VM0", pm0, 1); + XBT_INFO("### Put a VM on a PM, and put an activity to the VM"); + auto* vm0 = new simgrid::s4u::VirtualMachine("VM0", pm0, 1); vm0->start(); launch_computation_worker(vm0); simgrid::s4u::this_actor::sleep_for(2); @@ -102,10 +103,10 @@ static void master_main() XBT_INFO("## Test 2 (ended)"); - XBT_INFO( - "## Test 3 (started): check impact of running a task collocated with a VM (there is no VM noise for the moment)"); + XBT_INFO("## Test 3 (started): check impact of running an activity collocated with a VM (there is no VM noise for " + "the moment)"); - XBT_INFO("### Put a VM on a PM, and put a task to the PM"); + XBT_INFO("### Put a VM on a PM, and put an activity to the PM"); vm0 = new simgrid::s4u::VirtualMachine("VM0", pm0, 1); vm0->start(); launch_computation_worker(pm0); @@ -113,20 +114,21 @@ static void master_main() vm0->destroy(); XBT_INFO("## Test 3 (ended)"); - XBT_INFO("## Test 4 (started): compare the cost of running two tasks inside two different VMs collocated or not (for" - " the moment, there is no degradation for the VMs. Hence, the time should be equals to the time of test 1"); + XBT_INFO( + "## Test 4 (started): compare the cost of running two activities inside two different VMs collocated or not (for" + " the moment, there is no degradation for the VMs. Hence, the time should be equals to the time of test 1"); - XBT_INFO("### Put two VMs on a PM, and put a task to each VM"); + XBT_INFO("### Put two VMs on a PM, and put an activity to each VM"); vm0 = new simgrid::s4u::VirtualMachine("VM0", pm0, 1); vm0->start(); - simgrid::s4u::VirtualMachine* vm1 = new simgrid::s4u::VirtualMachine("VM1", pm0, 1); + auto* vm1 = new simgrid::s4u::VirtualMachine("VM1", pm0, 1); launch_computation_worker(vm0); launch_computation_worker(vm1); simgrid::s4u::this_actor::sleep_for(2); vm0->destroy(); vm1->destroy(); - XBT_INFO("### Put a VM on each PM, and put a task to each VM"); + XBT_INFO("### Put a VM on each PM, and put an activity to each VM"); vm0 = new simgrid::s4u::VirtualMachine("VM0", pm0, 1); vm1 = new simgrid::s4u::VirtualMachine("VM1", pm1, 1); vm0->start(); @@ -193,7 +195,7 @@ static void master_main() " network one"); XBT_INFO("### Relocate VM0 between PM0 and PM1"); vm0 = new simgrid::s4u::VirtualMachine("VM0", pm0, 1); - vm0->setRamsize(1L * 1024 * 1024 * 1024); // 1GiB + vm0->set_ramsize(1L * 1024 * 1024 * 1024); // 1GiB vm0->start(); launch_communication_worker(vm0, pm2);