X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9ceefed14c83a0f6ea5f78e3acafd53181dc4fa1..ace6ec5d4b81b85275732c9ba244d358ddc30107:/teshsuite/s4u/dependencies/dependencies.cpp diff --git a/teshsuite/s4u/dependencies/dependencies.cpp b/teshsuite/s4u/dependencies/dependencies.cpp index 6a9cf63317..fa1e49dcd4 100644 --- a/teshsuite/s4u/dependencies/dependencies.cpp +++ b/teshsuite/s4u/dependencies/dependencies.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2006-2021. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2006-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. */ @@ -9,23 +9,20 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(dependencies, "Logging specific to this test"); int main(int argc, char** argv) { - simgrid::s4u::Engine e(&argc, argv); + simgrid::s4u::Engine engine(&argc, argv); xbt_assert(argc > 1, "Usage: %s platform_file\n\nExample: %s two_clusters.xml", argv[0], argv[0]); - e.load_platform(argv[1]); + engine.load_platform(argv[1]); - simgrid::s4u::Activity::on_completion.connect([](simgrid::s4u::Activity& activity) { - auto* exec = dynamic_cast(&activity); - if (exec == nullptr) // Only Execs are concerned here - return; - XBT_INFO("Exec '%s' start time: %f, finish time: %f", exec->get_cname(), exec->get_start_time(), - exec->get_finish_time()); + simgrid::s4u::Exec::on_completion_cb([](simgrid::s4u::Exec const& exec) { + XBT_INFO("Exec '%s' start time: %f, finish time: %f", exec.get_cname(), exec.get_start_time(), + exec.get_finish_time()); }); /* creation of the activities and their dependencies */ - simgrid::s4u::ExecPtr A = simgrid::s4u::Exec::init()->set_name("A")->vetoable_start(); - simgrid::s4u::ExecPtr B = simgrid::s4u::Exec::init()->set_name("B")->vetoable_start(); - simgrid::s4u::ExecPtr C = simgrid::s4u::Exec::init()->set_name("C")->vetoable_start(); - simgrid::s4u::ExecPtr D = simgrid::s4u::Exec::init()->set_name("D")->vetoable_start(); + simgrid::s4u::ExecPtr A = simgrid::s4u::Exec::init()->set_name("A")->start(); + simgrid::s4u::ExecPtr B = simgrid::s4u::Exec::init()->set_name("B")->start(); + simgrid::s4u::ExecPtr C = simgrid::s4u::Exec::init()->set_name("C")->start(); + simgrid::s4u::ExecPtr D = simgrid::s4u::Exec::init()->set_name("D")->start(); B->add_successor(A); C->add_successor(A); @@ -35,7 +32,7 @@ int main(int argc, char** argv) try { A->add_successor(A); - ; /* shouldn't work and must raise an exception */ + /* shouldn't work and must raise an exception */ xbt_die("Hey, I can add a dependency between A and A!"); } catch (const std::invalid_argument& e) { XBT_INFO("Caught attempt to self-dependency creation: %s", e.what()); @@ -63,7 +60,7 @@ int main(int argc, char** argv) } /* scheduling parameters */ - const auto hosts = e.get_all_hosts(); + const auto hosts = engine.get_all_hosts(); std::vector host_list = {hosts[2], hosts[4]}; std::vector flops_amounts = {2000000, 1000000}; std::vector bytes_amounts = {0, 2000000, 3000000, 0}; @@ -73,6 +70,6 @@ int main(int argc, char** argv) C->set_flops_amounts(flops_amounts)->set_bytes_amounts(bytes_amounts)->set_hosts(host_list); D->set_flops_amounts(flops_amounts)->set_bytes_amounts(bytes_amounts)->set_hosts(host_list); - e.run(); + engine.run(); return 0; }