X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/200f407b2a610f22b2b3287773b4d46cce8f3da0..e5597052ce7ec4027dc2e32067338bfe5217395e:/examples/cpp/dag-comm/s4u-dag-comm.cpp diff --git a/examples/cpp/dag-comm/s4u-dag-comm.cpp b/examples/cpp/dag-comm/s4u-dag-comm.cpp index c4a5343a02..184e416f9a 100644 --- a/examples/cpp/dag-comm/s4u-dag-comm.cpp +++ b/examples/cpp/dag-comm/s4u-dag-comm.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2022. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-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. */ @@ -13,24 +13,27 @@ namespace sg4 = simgrid::s4u; int main(int argc, char* argv[]) { sg4::Engine e(&argc, argv); - sg_storage_file_system_init(); e.load_platform(argv[1]); auto tremblay = e.host_by_name("Tremblay"); auto jupiter = e.host_by_name("Jupiter"); // Display the details on vetoed activities - sg4::Activity::on_veto_cb([](const sg4::Activity& a) { - XBT_INFO("Activity '%s' vetoed. Dependencies: %s; Ressources: %s", a.get_cname(), - (a.dependencies_solved() ? "solved" : "NOT solved"), (a.is_assigned() ? "assigned" : "NOT assigned")); + sg4::Exec::on_veto_cb([](sg4::Exec const& exec) { + XBT_INFO("Execution '%s' vetoed. Dependencies: %s; Ressources: %s", exec.get_cname(), + (exec.dependencies_solved() ? "solved" : "NOT solved"), (exec.is_assigned() ? "assigned" : "NOT assigned")); + }); + sg4::Comm::on_veto_cb([](sg4::Comm const& comm) { + XBT_INFO("Communication '%s' vetoed. Dependencies: %s; Ressources: %s", comm.get_cname(), + (comm.dependencies_solved() ? "solved" : "NOT solved"), (comm.is_assigned() ? "assigned" : "NOT assigned")); }); - sg4::Activity::on_completion_cb([](sg4::Activity const& activity) { - if (const auto* exec = dynamic_cast(&activity)) - XBT_INFO("Activity '%s' is complete (start time: %f, finish time: %f)", exec->get_cname(), exec->get_start_time(), - exec->get_finish_time()); - if (const auto* comm = dynamic_cast(&activity)) - XBT_INFO("Activity '%s' is complete", comm->get_cname()); + sg4::Exec::on_completion_cb([](sg4::Exec const& exec) { + XBT_INFO("Exec '%s' is complete (start time: %f, finish time: %f)", exec.get_cname(), exec.get_start_time(), + exec.get_finish_time()); + }); + sg4::Comm::on_completion_cb([](sg4::Comm const& comm) { + XBT_INFO("Comm '%s' is complete", comm.get_cname()); }); // Create a small DAG: parent->transfer->child @@ -42,9 +45,9 @@ int main(int argc, char* argv[]) // Set the parameters (the name is for logging purposes only) // + parent and child end after 1 second - parent->set_name("parent")->set_flops_amount(tremblay->get_speed())->vetoable_start(); - transfer->set_name("transfer")->set_payload_size(125e6)->vetoable_start(); - child->set_name("child")->set_flops_amount(jupiter->get_speed())->vetoable_start(); + parent->set_name("parent")->set_flops_amount(tremblay->get_speed())->start(); + transfer->set_name("transfer")->set_payload_size(125e6)->start(); + child->set_name("child")->set_flops_amount(jupiter->get_speed())->start(); // Schedule the different activities parent->set_host(tremblay);