Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
implement mpi_isendrecv and mpi_isendrecv_replace
[simgrid.git] / examples / cpp / engine-run-partial / s4u-engine-run-partial.cpp
index 0cc2b4eb7d1ca3332f0cffb4122735c1c3e0246e..bf0ada983163f82aab223248e36669fc9ee9face 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2021. 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. */
@@ -8,9 +8,10 @@
 #include "simgrid/s4u.hpp"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example");
+namespace sg4 = simgrid::s4u;
 
 /* This actor simply executes and waits the activity it got as a parameter. */
-static void runner(simgrid::s4u::ExecPtr activity)
+static void runner(sg4::ExecPtr activity)
 {
   activity->start();
   activity->wait();
@@ -20,21 +21,21 @@ static void runner(simgrid::s4u::ExecPtr activity)
 
 int main(int argc, char* argv[])
 {
-  simgrid::s4u::Engine e(&argc, argv);
+  sg4::Engine e(&argc, argv);
   e.load_platform(argv[1]);
 
-  simgrid::s4u::Host* fafard = e.host_by_name("Fafard");
+  sg4::Host* fafard = e.host_by_name("Fafard");
 
-  simgrid::s4u::ExecPtr activity = simgrid::s4u::this_actor::exec_init(fafard->get_speed() * 10.)->set_host(fafard);
-  simgrid::s4u::Actor::create("runner", fafard, runner, activity);
+  sg4::ExecPtr activity = sg4::this_actor::exec_init(fafard->get_speed() * 10.)->set_host(fafard);
+  sg4::Actor::create("runner", fafard, runner, activity);
 
   while (activity->get_remaining() > 0) {
     XBT_INFO("Remaining amount of flops: %g (%.0f%%)", activity->get_remaining(),
              100 * activity->get_remaining_ratio());
-    e.run_until(simgrid::s4u::Engine::get_clock() + 1);
+    e.run_until(sg4::Engine::get_clock() + 1);
   }
 
-  XBT_INFO("Simulation time %g", simgrid::s4u::Engine::get_clock());
+  XBT_INFO("Simulation time %g", sg4::Engine::get_clock());
 
   return 0;
 }