Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of framagit.org:simgrid/simgrid
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 23 May 2023 18:57:11 +0000 (20:57 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 23 May 2023 18:57:11 +0000 (20:57 +0200)
94 files changed:
ChangeLog
FindSimGrid.cmake
MANIFEST.in
doc/doxygen/uhood_switch.doc
docs/source/Start_your_own_project.rst
docs/source/tuto_disk/CMakeLists.txt
docs/source/tuto_network_calibration/CMakeLists.txt
examples/cpp/CMakeLists.txt
examples/cpp/dag-comm/s4u-dag-comm.cpp
examples/cpp/dag-comm/s4u-dag-comm.tesh
examples/cpp/dag-failure/s4u-dag-failure.cpp
examples/cpp/dag-from-dax-simple/s4u-dag-from-dax-simple.cpp
examples/cpp/dag-from-dax-simple/s4u-dag-from-dax-simple.tesh
examples/cpp/dag-from-dot-simple/s4u-dag-from-dot-simple.cpp
examples/cpp/dag-from-dot-simple/s4u-dag-from-dot-simple.tesh
examples/cpp/dag-from-json-simple/s4u-dag-from-json-simple.cpp
examples/cpp/dag-from-json-simple/s4u-dag-from-json-simple.tesh
examples/cpp/dag-io/s4u-dag-io.cpp
examples/cpp/dag-io/s4u-dag-io.tesh
examples/cpp/dag-scheduling/s4u-dag-scheduling.cpp
examples/cpp/dag-simple/s4u-dag-simple.cpp
examples/cpp/dag-tuto/s4u-dag-tuto.cpp
examples/cpp/dag-tuto/s4u-dag-tuto.tesh
examples/cpp/operation-io/s4u-operation-io.cpp [new file with mode: 0644]
examples/cpp/operation-io/s4u-operation-io.tesh [new file with mode: 0644]
examples/cpp/trace-process-migration/s4u-trace-process-migration.tesh
include/simgrid/instr.h
include/simgrid/kernel/ProfileBuilder.hpp
include/simgrid/kernel/Timer.hpp
include/simgrid/kernel/resource/Action.hpp
include/simgrid/kernel/resource/Model.hpp
include/simgrid/kernel/routing/ClusterZone.hpp
include/simgrid/kernel/routing/DijkstraZone.hpp
include/simgrid/kernel/routing/DragonflyZone.hpp
include/simgrid/kernel/routing/EmptyZone.hpp
include/simgrid/kernel/routing/FatTreeZone.hpp
include/simgrid/kernel/routing/FloydZone.hpp
include/simgrid/kernel/routing/FullZone.hpp
include/simgrid/kernel/routing/NetPoint.hpp
include/simgrid/kernel/routing/NetZoneImpl.hpp
include/simgrid/kernel/routing/RoutedZone.hpp
include/simgrid/kernel/routing/StarZone.hpp
include/simgrid/kernel/routing/TorusZone.hpp
include/simgrid/kernel/routing/VivaldiZone.hpp
include/simgrid/kernel/routing/WifiZone.hpp
include/simgrid/plugins/ProducerConsumer.hpp
include/simgrid/plugins/operation.hpp
include/simgrid/s4u/Activity.hpp
include/simgrid/s4u/Barrier.hpp
include/simgrid/s4u/Comm.hpp
include/simgrid/s4u/ConditionVariable.hpp
include/simgrid/s4u/Engine.hpp
include/simgrid/s4u/Exec.hpp
include/simgrid/s4u/Io.hpp
include/simgrid/s4u/Mailbox.hpp
include/simgrid/s4u/Mutex.hpp
include/simgrid/s4u/NetZone.hpp
include/simgrid/s4u/Semaphore.hpp
include/simgrid/s4u/VirtualMachine.hpp
include/simgrid/simix.hpp
include/smpi/forward.hpp
include/xbt/Extendable.hpp
include/xbt/PropertyHolder.hpp
include/xbt/automaton.hpp
include/xbt/backtrace.hpp
include/xbt/config.hpp
include/xbt/file.hpp
include/xbt/functional.hpp
include/xbt/log.hpp
include/xbt/promise.hpp
include/xbt/random.hpp
include/xbt/range.hpp
include/xbt/replay.hpp
include/xbt/signal.hpp
include/xbt/string.hpp
include/xbt/system_error.hpp
include/xbt/utility.hpp
sonar-project.properties
src/instr/instr_platform.cpp
src/kernel/lmm/bmf.cpp
src/kernel/resource/VirtualMachineImpl.cpp
src/kernel/resource/models/network_ns3.hpp
src/kernel/routing/TorusZone.cpp
src/mc/remote/RemotePtr.hpp
src/mc/sosp/PageStore_test.cpp
src/mc/sosp/Snapshot_test.cpp
src/plugins/host_dvfs.cpp
src/plugins/host_load.cpp
src/plugins/operation.cpp
src/plugins/vm/dirty_page_tracking.cpp
src/s4u/s4u_Activity.cpp
src/s4u/s4u_Comm.cpp
src/smpi/internals/smpi_replay.cpp
teshsuite/s4u/dependencies/dependencies.cpp

index e898652..1b96e01 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,13 +1,15 @@
 SimGrid (3.32.1) not released yet (target december 22)
 
 General:
+ - SimGrid now requires a compiler with C++17 support for public headers too.
+   Sibling projects should upgrade their FindSimGrid.cmake
  - Remove the MSG API: its EOL was scheduled for 2020.
  - Remove the Java bindings: they were limited to the MSG interface.
  - On Windows, you now need to install WSL2 as the native builds are now disabled.
    It was not really working anyway.
  - Support for 32bits architecture is not tested anymore on our CI infrastructure.
    It may break in the future, but we think that nobody's using SimGrid on 32 bits.
- - Remove the surf module. It was replaced by the kernel/models module, and that 
+ - Remove the surf module. It was replaced by the kernel/models module, and that
    refactoring took almost 10 years to properly complete.
 
 S4U:
@@ -70,8 +72,8 @@ Model checking:
  - Synchronize the MBI tests with upstream.
  - Show the full actor bactraces when replaying a MC trace (with model-check/replay)
    and the status of all actors on deadlocks in MC mode.
- - The safety/stateless aspects of the MC are now enabled by default in all simgrid builds. 
-   Liveness and stateful aspects are still controled by the enabling_model-checking 
+ - The safety/stateless aspects of the MC are now enabled by default in all simgrid builds.
+   Liveness and stateful aspects are still controled by the enabling_model-checking
    configuration option.
  - Stateless model-checking is now usable on any system, including Mac OSX and ARM processors.
 
@@ -672,7 +674,7 @@ The Release release (the French lockdown was eased today).
 
 Important user-visible changes:
  - SimGrid now requires a compiler with C++14 support.
-   Sibling projects should upgrade their FindSimgrid.cmake
+   Sibling projects should upgrade their FindSimGrid.cmake
  - Surf precision default value is now 1e-9, instead of 1e-5. This was changed as
    several users had difficulties to understand issues when using high bandwidth or
    small latency events. The new value was already the default for SMPI and
index 209d709..6f9d9e1 100644 (file)
@@ -37,7 +37,7 @@
 #      (code to use with SimGrid v3.19+)
 #    #endif
 #
-#  Since SimGrid header files require C++14, so we set CMAKE_CXX_STANDARD to 14.
+#  Since SimGrid header files require C++17, so we set CMAKE_CXX_STANDARD to 17.
 #    Change this variable in your own file if you need a later standard.
 
 #
@@ -50,7 +50,7 @@
 
 cmake_minimum_required(VERSION 2.8.12)
 
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 17)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 
 find_path(SimGrid_INCLUDE_DIR
@@ -109,26 +109,23 @@ if (SimGrid_FOUND)
     INTERFACE_COMPILE_FEATURES cxx_alias_templates
     IMPORTED_LOCATION ${SimGrid_LIBRARY}
   )
-  # We need C++14, so check for it just in case the user removed it since compiling SimGrid
+  # We need C++17, so check for it just in case the user removed it since compiling SimGrid
   if (NOT CMAKE_VERSION VERSION_LESS 3.8)
-    # 3.8+ allows us to simply require C++14 (or higher)
-    set_property(TARGET SimGrid::SimGrid PROPERTY INTERFACE_COMPILE_FEATURES cxx_std_14)
-  elseif (NOT CMAKE_VERSION VERSION_LESS 3.1)
-    # 3.1+ is similar but for certain features. We pick just one
-    set_property(TARGET SimGrid::SimGrid PROPERTY INTERFACE_COMPILE_FEATURES cxx_attribute_deprecated)
+    # 3.8+ allows us to simply require C++17 (or higher)
+    set_property(TARGET SimGrid::SimGrid PROPERTY INTERFACE_COMPILE_FEATURES cxx_std_17)
   else ()
-    # Old CMake can't do much. Just check the CXX_FLAGS and inform the user when a C++14 feature does not work
+    # Old CMake can't do much. Just check the CXX_FLAGS and inform the user when a C++17 feature does not work
     include(CheckCXXSourceCompiles)
     set(CMAKE_REQUIRED_FLAGS "${CMAKE_CXX_FLAGS}")
     check_cxx_source_compiles("
-#if __cplusplus < 201402L
+#if __cplusplus < 201703L
 #error
 #else
 int main(){}
 #endif
-" _SIMGRID_CXX14_ENABLED)
-    if (NOT _SIMGRID_CXX14_ENABLED)
-        message(WARNING "C++14 is required to use SimGrid. Enable it with e.g. -std=c++14")
+" _SIMGRID_CXX17_ENABLED)
+    if (NOT _SIMGRID_CXX17_ENABLED)
+        message(WARNING "C++17 is required to use SimGrid. Enable it with e.g. -std=c++17")
     endif ()
     unset(_SIMGRID_CXX14_ENABLED CACHE)
   endif ()
index 3a5d39c..8a1999b 100644 (file)
@@ -350,6 +350,8 @@ include examples/cpp/network-ns3/s4u-network-ns3-timed.tesh
 include examples/cpp/network-ns3/s4u-network-ns3.cpp
 include examples/cpp/network-wifi/s4u-network-wifi.cpp
 include examples/cpp/network-wifi/s4u-network-wifi.tesh
+include examples/cpp/operation-io/s4u-operation-io.cpp
+include examples/cpp/operation-io/s4u-operation-io.tesh
 include examples/cpp/operation-simple/s4u-operation-simple.cpp
 include examples/cpp/operation-simple/s4u-operation-simple.tesh
 include examples/cpp/operation-switch-host/s4u-operation-switch-host.cpp
index dc40367..98d55a9 100644 (file)
@@ -411,7 +411,7 @@ type and properly handles exceptions:
 
 @code{cpp}
 template<class F>
-typename std::result_of<F()>::type kernelImmediate(F&& code)
+typename std::result_of_t<F()> kernelImmediate(F&& code)
 {
   // If we are in the simulation kernel, we take the fast path and
   // execute the code directly without simcall
@@ -421,7 +421,7 @@ typename std::result_of<F()>::type kernelImmediate(F&& code)
 
   // If we are in the application, pass the code to the simulation
   // kernel which executes it for us and reports the result:
-  typedef typename std::result_of<F()>::type R;
+  typedef typename std::result_of_t<F()> R;
   simgrid::xbt::Result<R> result;
   simcall_run_kernel([&]{
     xbt_assert(SIMIX_is_maestro(), "Not in maestro");
index 20f31c4..c339a00 100644 (file)
@@ -33,7 +33,7 @@ of source files.
    cmake_minimum_required(VERSION 2.8.12)
    project(MyFirstSimulator)
 
-   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
+   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
 
    set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
    find_package(SimGrid REQUIRED)
@@ -124,7 +124,7 @@ Develop in C++ with Eclipse
 If you wish to develop your plugin or modify SimGrid using
 Eclipse. You have to run cmake and import it as a Makefile project.
 
-Next, you have to activate C++14 in your build settings, add -std=c++14
+Next, you have to activate C++17 in your build settings, add -std=c++17
 in the CDT GCC Built-in compiler settings.
 
 .. image:: /img/eclipseScreenShot.png
index d346172..ea673f3 100644 (file)
@@ -1,7 +1,7 @@
 cmake_minimum_required(VERSION 2.8.12)
 project(tuto_disk)
 
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
 
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/" "../../../")
 find_package(SimGrid REQUIRED)
index 72660b4..d8a7314 100644 (file)
@@ -1,7 +1,7 @@
 cmake_minimum_required(VERSION 2.8.12)
 project(tuto_network)
 
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
 
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/" "../../../")
 find_package(SimGrid REQUIRED)
index 76dc61e..5e15581 100644 (file)
@@ -168,7 +168,7 @@ foreach (example activity-testany activity-waitany
                  mc-bugged1 mc-bugged1-liveness mc-bugged2 mc-bugged2-liveness mc-centralized-mutex mc-electric-fence mc-failing-assert
                  network-ns3 network-ns3-wifi network-wifi
                  io-async io-priority io-degradation io-file-system io-file-remote io-disk-raw io-dependent
-                 operation-simple operation-variable-load operation-switch-host
+                 operation-io operation-simple operation-variable-load operation-switch-host
                  platform-comm-serialize platform-failures platform-profile platform-properties
                  plugin-host-load plugin-link-load plugin-prodcons
                  replay-comm replay-io
@@ -278,7 +278,7 @@ foreach(example mc-failing-assert)
                                       --setenv srcdir=${CMAKE_CURRENT_SOURCE_DIR}/${example}
                                       --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example}
                                       ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}-nodpor.tesh)
-  endif()                                    
+  endif()
   set(tesh_files    ${tesh_files}   ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}-statequality.tesh)
   set(tesh_files    ${tesh_files}   ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}-nodpor.tesh)
 endforeach()
index 9e671b4..2263b55 100644 (file)
@@ -25,12 +25,12 @@ int main(int argc, char* argv[])
              (a.dependencies_solved() ? "solved" : "NOT solved"), (a.is_assigned() ? "assigned" : "NOT assigned"));
   });
 
-  sg4::Activity::on_completion_cb([](sg4::Activity const& activity) {
-    if (const auto* exec = dynamic_cast<sg4::Exec const*>(&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<sg4::Comm const*>(&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
index 2d000a0..512c110 100644 (file)
@@ -8,11 +8,11 @@ $ ${bindir:=.}/s4u-dag-comm ${platfdir}/two_hosts.xml --log=s4u_activity.t:verbo
 > [  0.000000] (0:maestro@) Activity 'transfer' vetoed. Dependencies: NOT solved; Ressources: NOT assigned
 > [  0.000000] (0:maestro@) Activity 'child' vetoed. Dependencies: NOT solved; Ressources: assigned
 > [  0.000000] (0:maestro@) Activity 'transfer' vetoed. Dependencies: NOT solved; Ressources: assigned
-> [  1.000000] (0:maestro@) Activity 'parent' is complete (start time: 0.000000, finish time: 1.000000)
+> [  1.000000] (0:maestro@) Exec 'parent' is complete (start time: 0.000000, finish time: 1.000000)
 > [  1.000000] (0:maestro@) Remove a dependency from 'parent' on 'transfer'
 > [  1.000000] (0:maestro@) 'transfer' is assigned to a resource and all dependencies are solved. Let's start
-> [  2.083775] (0:maestro@) Activity 'transfer' is complete
+> [  2.083775] (0:maestro@) Comm 'transfer' is complete
 > [  2.083775] (0:maestro@) Remove a dependency from 'transfer' on 'child'
 > [  2.083775] (0:maestro@) 'child' is assigned to a resource and all dependencies are solved. Let's start
-> [  3.083775] (0:maestro@) Activity 'child' is complete (start time: 2.083775, finish time: 3.083775)
+> [  3.083775] (0:maestro@) Exec 'child' is complete (start time: 2.083775, finish time: 3.083775)
 > [  3.083775] (0:maestro@) Simulation time 3.08378
index 631b24c..c2ab8d5 100644 (file)
@@ -18,19 +18,16 @@ int main(int argc, char** argv)
 
   auto* faulty = e.host_by_name("Faulty Host");
   auto* safe   = e.host_by_name("Safe Host");
-  sg4::Activity::on_completion_cb([](sg4::Activity const& activity) {
-    const auto* exec = dynamic_cast<sg4::Exec const*>(&activity);
-    if (exec == nullptr) // Only Execs are concerned here
-      return;
-    if (exec->get_state() == sg4::Activity::State::FINISHED)
-      XBT_INFO("Activity '%s' is complete (start time: %f, finish time: %f)", exec->get_cname(), exec->get_start_time(),
-               exec->get_finish_time());
-    if (exec->get_state() == sg4::Activity::State::FAILED) {
-      if (exec->is_parallel())
-        XBT_INFO("Activity '%s' has failed. %.f %% remain to be done", exec->get_cname(),
-                 100 * exec->get_remaining_ratio());
+  sg4::Exec::on_completion_cb([](sg4::Exec const& exec) {
+    if (exec.get_state() == sg4::Activity::State::FINISHED)
+      XBT_INFO("Activity '%s' is complete (start time: %f, finish time: %f)", exec.get_cname(), exec.get_start_time(),
+               exec.get_finish_time());
+    if (exec.get_state() == sg4::Activity::State::FAILED) {
+      if (exec.is_parallel())
+        XBT_INFO("Activity '%s' has failed. %.f %% remain to be done", exec.get_cname(),
+                 100 * exec.get_remaining_ratio());
       else
-        XBT_INFO("Activity '%s' has failed. %.f flops remain to be done", exec->get_cname(), exec->get_remaining());
+        XBT_INFO("Activity '%s' has failed. %.f flops remain to be done", exec.get_cname(), exec.get_remaining());
     }
   });
 
index d55ec54..950cd77 100644 (file)
@@ -32,9 +32,14 @@ int main(int argc, char* argv[])
     }
   }
 
-  simgrid::s4u::Activity::on_completion_cb([](simgrid::s4u::Activity const& activity) {
-    XBT_INFO("Activity '%s' is complete (start time: %f, finish time: %f)", activity.get_cname(),
-             activity.get_start_time(), activity.get_finish_time());
+  simgrid::s4u::Exec::on_completion_cb([](simgrid::s4u::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());
+  });
+
+  simgrid::s4u::Comm::on_completion_cb([](simgrid::s4u::Comm const& comm) {
+    XBT_INFO("Comm '%s' is complete (start time: %f, finish time: %f)", comm.get_cname(),
+             comm.get_start_time(), comm.get_finish_time());
   });
 
   e.run();
index 7e78194..af5a6f2 100644 (file)
@@ -1,12 +1,12 @@
 #!/usr/bin/env tesh
 
 $ ${bindir:=.}/s4u-dag-from-dax-simple --log=no_loc ${platfdir}/small_platform.xml ${srcdir:=.}/dag.xml
-> [0.000000] [dag_from_dax_simple/INFO] Activity 'root' is complete (start time: 0.000000, finish time: 0.000000)
-> [33.394394] [dag_from_dax_simple/INFO] Activity 'root_i2_2@c2' is complete (start time: 0.000000, finish time: 33.394394)
-> [39.832311] [dag_from_dax_simple/INFO] Activity 'root_i1_1@c1' is complete (start time: 0.000000, finish time: 39.832311)
-> [467.988690] [dag_from_dax_simple/INFO] Activity '1@c1' is complete (start time: 39.832311, finish time: 467.988690)
-> [543.077868] [dag_from_dax_simple/INFO] Activity '1@c1_o1_3@c3' is complete (start time: 467.988690, finish time: 543.077868)
-> [2785.832267] [dag_from_dax_simple/INFO] Activity '2@c2' is complete (start time: 33.394394, finish time: 2785.832267)
-> [3886.807417] [dag_from_dax_simple/INFO] Activity '3@c3' is complete (start time: 2785.832267, finish time: 3886.807417)
-> [3887.221639] [dag_from_dax_simple/INFO] Activity '3@c3_o3_end' is complete (start time: 3886.807417, finish time: 3887.221639)
-> [3887.221639] [dag_from_dax_simple/INFO] Activity 'end' is complete (start time: 3887.221639, finish time: 3887.221639)
\ No newline at end of file
+> [0.000000] [dag_from_dax_simple/INFO] Exec 'root' is complete (start time: 0.000000, finish time: 0.000000)
+> [33.394394] [dag_from_dax_simple/INFO] Comm 'root_i2_2@c2' is complete (start time: 0.000000, finish time: 33.394394)
+> [39.832311] [dag_from_dax_simple/INFO] Comm 'root_i1_1@c1' is complete (start time: 0.000000, finish time: 39.832311)
+> [467.988690] [dag_from_dax_simple/INFO] Exec '1@c1' is complete (start time: 39.832311, finish time: 467.988690)
+> [543.077868] [dag_from_dax_simple/INFO] Comm '1@c1_o1_3@c3' is complete (start time: 467.988690, finish time: 543.077868)
+> [2785.832267] [dag_from_dax_simple/INFO] Exec '2@c2' is complete (start time: 33.394394, finish time: 2785.832267)
+> [3886.807417] [dag_from_dax_simple/INFO] Exec '3@c3' is complete (start time: 2785.832267, finish time: 3886.807417)
+> [3887.221639] [dag_from_dax_simple/INFO] Comm '3@c3_o3_end' is complete (start time: 3886.807417, finish time: 3887.221639)
+> [3887.221639] [dag_from_dax_simple/INFO] Exec 'end' is complete (start time: 3887.221639, finish time: 3887.221639)
\ No newline at end of file
index 5fbcf2c..a5532eb 100644 (file)
@@ -32,9 +32,14 @@ int main(int argc, char* argv[])
     }
   }
 
-  simgrid::s4u::Activity::on_completion_cb([](simgrid::s4u::Activity const& activity) {
-    XBT_INFO("Activity '%s' is complete (start time: %f, finish time: %f)", activity.get_cname(),
-             activity.get_start_time(), activity.get_finish_time());
+  simgrid::s4u::Exec::on_completion_cb([](simgrid::s4u::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());
+  });
+
+  simgrid::s4u::Comm::on_completion_cb([](simgrid::s4u::Comm const& comm) {
+    XBT_INFO("Comm '%s' is complete (start time: %f, finish time: %f)", comm.get_cname(),
+             comm.get_start_time(), comm.get_finish_time());
   });
 
   e.run();
index d6a88d5..6133b1b 100644 (file)
@@ -1,12 +1,12 @@
 #!/usr/bin/env tesh
 
 $ ${bindir:=.}/s4u-dag-from-dot-simple --log=no_loc ${platfdir}/small_platform.xml ${srcdir:=.}/dag.dot
-> [0.000000] [dag_from_dot_simple/INFO] Activity 'root' is complete (start time: 0.000000, finish time: 0.000000)
-> [33.394394] [dag_from_dot_simple/INFO] Activity 'root->c2' is complete (start time: 0.000000, finish time: 33.394394)
-> [39.832311] [dag_from_dot_simple/INFO] Activity 'root->c1' is complete (start time: 0.000000, finish time: 39.832311)
-> [50.026511] [dag_from_dot_simple/INFO] Activity 'c1' is complete (start time: 39.832311, finish time: 50.026511)
-> [98.928629] [dag_from_dot_simple/INFO] Activity 'c2' is complete (start time: 33.394394, finish time: 98.928629)
-> [125.115689] [dag_from_dot_simple/INFO] Activity 'c1->c3' is complete (start time: 50.026511, finish time: 125.115689)
-> [151.329383] [dag_from_dot_simple/INFO] Activity 'c3' is complete (start time: 125.115689, finish time: 151.329383)
-> [151.743605] [dag_from_dot_simple/INFO] Activity 'c3->end' is complete (start time: 151.329383, finish time: 151.743605)
-> [151.743605] [dag_from_dot_simple/INFO] Activity 'end' is complete (start time: 151.743605, finish time: 151.743605)
\ No newline at end of file
+> [0.000000] [dag_from_dot_simple/INFO] Exec 'root' is complete (start time: 0.000000, finish time: 0.000000)
+> [33.394394] [dag_from_dot_simple/INFO] Comm 'root->c2' is complete (start time: 0.000000, finish time: 33.394394)
+> [39.832311] [dag_from_dot_simple/INFO] Comm 'root->c1' is complete (start time: 0.000000, finish time: 39.832311)
+> [50.026511] [dag_from_dot_simple/INFO] Exec 'c1' is complete (start time: 39.832311, finish time: 50.026511)
+> [98.928629] [dag_from_dot_simple/INFO] Exec 'c2' is complete (start time: 33.394394, finish time: 98.928629)
+> [125.115689] [dag_from_dot_simple/INFO] Comm 'c1->c3' is complete (start time: 50.026511, finish time: 125.115689)
+> [151.329383] [dag_from_dot_simple/INFO] Exec 'c3' is complete (start time: 125.115689, finish time: 151.329383)
+> [151.743605] [dag_from_dot_simple/INFO] Comm 'c3->end' is complete (start time: 151.329383, finish time: 151.743605)
+> [151.743605] [dag_from_dot_simple/INFO] Exec 'end' is complete (start time: 151.743605, finish time: 151.743605)
\ No newline at end of file
index e6246b1..bf87897 100644 (file)
@@ -14,9 +14,14 @@ int main(int argc, char* argv[])
 
   std::vector<simgrid::s4u::ActivityPtr> dag = simgrid::s4u::create_DAG_from_json(argv[2]);
 
-  simgrid::s4u::Activity::on_completion_cb([](simgrid::s4u::Activity const& activity) {
-    XBT_INFO("Activity '%s' is complete (start time: %f, finish time: %f)", activity.get_cname(),
-             activity.get_start_time(), activity.get_finish_time());
+   simgrid::s4u::Exec::on_completion_cb([](simgrid::s4u::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());
+  });
+
+  simgrid::s4u::Comm::on_completion_cb([](simgrid::s4u::Comm const& comm) {
+    XBT_INFO("Comm '%s' is complete (start time: %f, finish time: %f)", comm.get_cname(),
+             comm.get_start_time(), comm.get_finish_time());
   });
 
   e.run();
index 1d37a65..cd41320 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/env tesh
 
 $ ${bindir:=.}/s4u-dag-from-json-simple --log=no_loc ${platfdir}/small_platform.xml ${srcdir:=.}/dag.json
-> [10.194200] [dag_from_json_simple/INFO] Activity 'c1' is complete (start time: 0.000000, finish time: 10.194200)
-> [65.534235] [dag_from_json_simple/INFO] Activity 'c2' is complete (start time: 0.000000, finish time: 65.534235)
-> [85.283378] [dag_from_json_simple/INFO] Activity 't1' is complete (start time: 10.194200, finish time: 85.283378)
-> [111.497072] [dag_from_json_simple/INFO] Activity 'c3' is complete (start time: 85.283378, finish time: 111.497072)
\ No newline at end of file
+> [10.194200] [dag_from_json_simple/INFO] Exec 'c1' is complete (start time: 0.000000, finish time: 10.194200)
+> [65.534235] [dag_from_json_simple/INFO] Exec 'c2' is complete (start time: 0.000000, finish time: 65.534235)
+> [85.283378] [dag_from_json_simple/INFO] Comm 't1' is complete (start time: 10.194200, finish time: 85.283378)
+> [111.497072] [dag_from_json_simple/INFO] Exec 'c3' is complete (start time: 85.283378, finish time: 111.497072)
\ No newline at end of file
index ee00eb0..7ac9b55 100644 (file)
@@ -25,12 +25,9 @@ int main(int argc, char* argv[])
              (a.dependencies_solved() ? "solved" : "NOT solved"), (a.is_assigned() ? "assigned" : "NOT assigned"));
   });
 
-  sg4::Activity::on_completion_cb([](sg4::Activity const& activity) {
-    const auto* exec = dynamic_cast<sg4::Exec const*>(&activity);
-    if (exec == nullptr) // Only Execs are concerned here
-      return;
-    XBT_INFO("Activity '%s' is complete (start time: %f, finish time: %f)", exec->get_cname(), exec->get_start_time(),
-             exec->get_finish_time());
+  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());
   });
 
   // Create a small DAG: parent->write_output->read_input->child
index 186126b..d067ae0 100644 (file)
@@ -5,12 +5,12 @@ $ ${bindir:=.}/s4u-dag-io ${platfdir}/hosts_with_disks.xml --log=s4u_activity.t:
 > [  0.000000] (0:maestro@) Activity 'write' vetoed. Dependencies: NOT solved; Ressources: assigned
 > [  0.000000] (0:maestro@) Activity 'read' vetoed. Dependencies: NOT solved; Ressources: assigned
 > [  0.000000] (0:maestro@) Activity 'child' vetoed. Dependencies: NOT solved; Ressources: assigned
-> [  1.000000] (0:maestro@) Activity 'parent' is complete (start time: 0.000000, finish time: 1.000000)
+> [  1.000000] (0:maestro@) Exec 'parent' is complete (start time: 0.000000, finish time: 1.000000)
 > [  1.000000] (0:maestro@) Remove a dependency from 'parent' on 'write'
 > [  1.000000] (0:maestro@) 'write' is assigned to a resource and all dependencies are solved. Let's start
 > [ 26.000000] (0:maestro@) Remove a dependency from 'write' on 'read'
 > [ 26.000000] (0:maestro@) 'read' is assigned to a resource and all dependencies are solved. Let's start
 > [ 36.000000] (0:maestro@) Remove a dependency from 'read' on 'child'
 > [ 36.000000] (0:maestro@) 'child' is assigned to a resource and all dependencies are solved. Let's start
-> [ 37.000000] (0:maestro@) Activity 'child' is complete (start time: 36.000000, finish time: 37.000000)
+> [ 37.000000] (0:maestro@) Exec 'child' is complete (start time: 36.000000, finish time: 37.000000)
 > [ 37.000000] (0:maestro@) Simulation time 37
index 6c82ad0..7b76aa9 100644 (file)
@@ -118,15 +118,12 @@ int main(int argc, char** argv)
   std::set<sg4::Activity*> vetoed;
   e.track_vetoed_activities(&vetoed);
 
-  sg4::Activity::on_completion_cb([](sg4::Activity const& activity) {
+  sg4::Exec::on_completion_cb([](sg4::Exec const& exec) {
     // when an Exec completes, we need to set the potential start time of all its ouput comms
-    const auto* exec = dynamic_cast<sg4::Exec const*>(&activity);
-    if (exec == nullptr) // Only Execs are concerned here
-      return;
-    for (const auto& succ : exec->get_successors()) {
+    for (const auto& succ : exec.get_successors()) {
       auto* comm = dynamic_cast<sg4::Comm*>(succ.get());
       if (comm != nullptr) {
-        auto* finish_time = new double(exec->get_finish_time());
+        auto* finish_time = new double(exec.get_finish_time());
         // We use the user data field to store the finish time of the predecessor of the comm, i.e., its potential start
         // time
         comm->set_data(finish_time);
index aae95e7..c0c2a3e 100644 (file)
@@ -27,12 +27,9 @@ int main(int argc, char* argv[])
              (exec.is_assigned() ? "assigned" : "NOT assigned"));
   });
 
-  sg4::Activity::on_completion_cb([](sg4::Activity const& activity) {
-    const auto* exec = dynamic_cast<sg4::Exec const*>(&activity);
-    if (exec == nullptr) // Only Execs are concerned here
-      return;
-    XBT_INFO("Activity '%s' is complete (start time: %f, finish time: %f)", exec->get_cname(), exec->get_start_time(),
-             exec->get_finish_time());
+  sg4::Exec::on_completion_cb([](sg4::Exec const& exec) {
+    XBT_INFO("Activity '%s' is complete (start time: %f, finish time: %f)", exec.get_cname(), exec.get_start_time(),
+             exec.get_finish_time());
   });
 
   // Define an amount of work that should take 1 second to execute.
index 39b56d6..f90c9f9 100644 (file)
@@ -43,9 +43,13 @@ int main(int argc, char* argv[])
   c1->start();
   c2->start();
 
-  simgrid::s4u::Activity::on_completion_cb([](simgrid::s4u::Activity const& activity) {
-    XBT_INFO("Activity '%s' is complete (start time: %f, finish time: %f)", activity.get_cname(),
-             activity.get_start_time(), activity.get_finish_time());
+  simgrid::s4u::Exec::on_completion_cb([](simgrid::s4u::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());
+  });
+ simgrid::s4u::Comm::on_completion_cb([](simgrid::s4u::Comm const& comm) {
+    XBT_INFO("Comm '%s' is complete (start time: %f, finish time: %f)", comm.get_cname(),
+             comm.get_start_time(), comm.get_finish_time());
   });
 
   e.run();
index 56e448f..f5b8b15 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/env tesh
 
 $ ${bindir:=.}/s4u-dag-tuto --log=no_loc ${platfdir}/small_platform.xml
-> [10.194200] [dag_tuto/INFO] Activity 'c1' is complete (start time: 0.000000, finish time: 10.194200)
-> [65.534235] [dag_tuto/INFO] Activity 'c2' is complete (start time: 0.000000, finish time: 65.534235)
-> [85.283378] [dag_tuto/INFO] Activity 't1' is complete (start time: 10.194200, finish time: 85.283378)
-> [111.497072] [dag_tuto/INFO] Activity 'c3' is complete (start time: 85.283378, finish time: 111.497072)
\ No newline at end of file
+> [10.194200] [dag_tuto/INFO] Exec 'c1' is complete (start time: 0.000000, finish time: 10.194200)
+> [65.534235] [dag_tuto/INFO] Exec 'c2' is complete (start time: 0.000000, finish time: 65.534235)
+> [85.283378] [dag_tuto/INFO] Comm 't1' is complete (start time: 10.194200, finish time: 85.283378)
+> [111.497072] [dag_tuto/INFO] Exec 'c3' is complete (start time: 85.283378, finish time: 111.497072)
\ No newline at end of file
diff --git a/examples/cpp/operation-io/s4u-operation-io.cpp b/examples/cpp/operation-io/s4u-operation-io.cpp
new file mode 100644 (file)
index 0000000..3491246
--- /dev/null
@@ -0,0 +1,55 @@
+/* Copyright (c) 2017-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. */
+
+/* This example demonstrate basic use of the operation plugin.
+ *
+ * We model the following graph:
+ *
+ * exec1 -> comm -> exec2
+ *
+ * exec1 and exec2 are execution operations.
+ * comm is a communication operation.
+ */
+
+#include <simgrid/plugins/file_system.h>
+#include "simgrid/plugins/operation.hpp"
+#include "simgrid/s4u.hpp"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(operation_simple, "Messages specific for this operation example");
+
+int main(int argc, char* argv[])
+{
+  simgrid::s4u::Engine e(&argc, argv);
+  sg_storage_file_system_init();
+  e.load_platform(argv[1]);
+  simgrid::plugins::Operation::init();
+
+  // Retrieve hosts
+  auto bob  = e.host_by_name("bob");
+  auto carl = e.host_by_name("carl");
+
+  // Create operations
+  auto exec1 = simgrid::plugins::ExecOp::init("exec1", 1e9, bob);
+  auto exec2 = simgrid::plugins::ExecOp::init("exec2", 1e9, carl);
+  auto write = simgrid::plugins::IoOp::init("write", 1e7, bob->get_disks().front(), simgrid::s4u::Io::OpType::WRITE);
+  auto read  = simgrid::plugins::IoOp::init("read", 1e7, carl->get_disks().front(), simgrid::s4u::Io::OpType::READ);
+
+  // Create the graph by defining dependencies between operations
+  exec1->add_successor(write);
+  write->add_successor(read);
+  read->add_successor(exec2);
+
+  // Add a function to be called when operations end for log purpose
+  simgrid::plugins::Operation::on_end_cb([](const simgrid::plugins::Operation* op) {
+    XBT_INFO("Operation %s finished (%d)", op->get_name().c_str(), op->get_count());
+  });
+
+  // Enqueue two executions for operation exec1
+  exec1->enqueue_execs(2);
+
+  // Start the simulation
+  e.run();
+  return 0;
+}
diff --git a/examples/cpp/operation-io/s4u-operation-io.tesh b/examples/cpp/operation-io/s4u-operation-io.tesh
new file mode 100644 (file)
index 0000000..89adedd
--- /dev/null
@@ -0,0 +1,11 @@
+#!/usr/bin/env tesh
+
+$ ${bindir:=.}/s4u-operation-io ${platfdir}/hosts_with_disks.xml
+> [1.000000] [operation_simple/INFO] Operation exec1 finished (1)
+> [1.250000] [operation_simple/INFO] Operation write finished (1)
+> [1.350000] [operation_simple/INFO] Operation read finished (1)
+> [2.000000] [operation_simple/INFO] Operation exec1 finished (2)
+> [2.250000] [operation_simple/INFO] Operation write finished (2)
+> [2.350000] [operation_simple/INFO] Operation exec2 finished (1)
+> [2.350000] [operation_simple/INFO] Operation read finished (2)
+> [3.350000] [operation_simple/INFO] Operation exec2 finished (2)
index b6dafe2..42fcd20 100644 (file)
@@ -117,253 +117,257 @@ $ tail -n +3 procmig.trace
 > %EndEventDef
 > 0 1 0 HOST
 > 6 0.000000 1 1 0 "Tremblay"
+> 2 2 1 HOST_STATE
+> 5 3 2 receive "1 0 0"
+> 5 4 2 send "0 0 1"
+> 5 5 2 execute "0 1 1"
 > 6 0.000000 2 1 0 "Jupiter"
 > 6 0.000000 3 1 0 "Fafard"
 > 6 0.000000 4 1 0 "Ginette"
 > 6 0.000000 5 1 0 "Bourassa"
 > 6 0.000000 6 1 0 "Jacquelin"
 > 6 0.000000 7 1 0 "Boivin"
-> 0 2 0 LINK
-> 6 0.000000 8 2 0 "6"
-> 6 0.000000 9 2 0 "3"
-> 6 0.000000 10 2 0 "7"
-> 6 0.000000 11 2 0 "9"
-> 6 0.000000 12 2 0 "2"
-> 6 0.000000 13 2 0 "8"
-> 6 0.000000 14 2 0 "1"
-> 6 0.000000 15 2 0 "4"
-> 6 0.000000 16 2 0 "0"
-> 6 0.000000 17 2 0 "5"
-> 6 0.000000 18 2 0 "145"
-> 6 0.000000 19 2 0 "10"
-> 6 0.000000 20 2 0 "11"
-> 6 0.000000 21 2 0 "16"
-> 6 0.000000 22 2 0 "17"
-> 6 0.000000 23 2 0 "44"
-> 6 0.000000 24 2 0 "47"
-> 6 0.000000 25 2 0 "54"
-> 6 0.000000 26 2 0 "56"
-> 6 0.000000 27 2 0 "59"
-> 6 0.000000 28 2 0 "78"
-> 6 0.000000 29 2 0 "79"
-> 6 0.000000 30 2 0 "80"
-> 6 0.000000 31 2 0 "loopback"
-> 4 3 0 2 2 0-LINK2-LINK2
-> 4 4 0 1 2 0-HOST1-LINK2
-> 4 5 0 2 1 0-LINK2-HOST1
-> 15 0.000000 3 0 topology 12 0
-> 16 0.000000 3 0 topology 16 0
-> 15 0.000000 3 0 topology 9 1
-> 16 0.000000 3 0 topology 16 1
-> 15 0.000000 3 0 topology 16 2
-> 16 0.000000 3 0 topology 14 2
-> 15 0.000000 3 0 topology 21 3
-> 16 0.000000 3 0 topology 19 3
-> 15 0.000000 3 0 topology 8 4
-> 16 0.000000 3 0 topology 19 4
-> 15 0.000000 3 0 topology 19 5
-> 16 0.000000 3 0 topology 20 5
-> 15 0.000000 3 0 topology 8 6
-> 16 0.000000 3 0 topology 20 6
-> 15 0.000000 3 0 topology 27 7
-> 16 0.000000 3 0 topology 18 7
-> 15 0.000000 4 0 topology 5 8
-> 16 0.000000 4 0 topology 18 8
-> 15 0.000000 4 0 topology 4 9
-> 16 0.000000 4 0 topology 18 9
-> 15 0.000000 4 0 topology 2 10
-> 16 0.000000 4 0 topology 18 10
-> 15 0.000000 3 0 topology 16 11
-> 16 0.000000 3 0 topology 21 11
-> 15 0.000000 3 0 topology 21 12
-> 16 0.000000 3 0 topology 22 12
-> 15 0.000000 3 0 topology 9 13
-> 16 0.000000 3 0 topology 12 13
-> 15 0.000000 3 0 topology 15 14
-> 16 0.000000 3 0 topology 9 14
-> 15 0.000000 4 0 topology 1 15
-> 16 0.000000 4 0 topology 9 15
-> 15 0.000000 3 0 topology 20 16
-> 16 0.000000 3 0 topology 23 16
-> 15 0.000000 3 0 topology 23 17
-> 16 0.000000 3 0 topology 24 17
-> 15 0.000000 4 0 topology 5 18
-> 16 0.000000 4 0 topology 24 18
-> 15 0.000000 4 0 topology 4 19
-> 16 0.000000 4 0 topology 24 19
-> 15 0.000000 4 0 topology 2 20
-> 16 0.000000 4 0 topology 24 20
-> 15 0.000000 3 0 topology 11 21
-> 16 0.000000 3 0 topology 15 21
-> 15 0.000000 4 0 topology 1 22
-> 16 0.000000 4 0 topology 15 22
-> 15 0.000000 3 0 topology 12 23
-> 16 0.000000 3 0 topology 17 23
-> 15 0.000000 3 0 topology 9 24
-> 16 0.000000 3 0 topology 17 24
-> 15 0.000000 3 0 topology 22 25
-> 16 0.000000 3 0 topology 25 25
-> 15 0.000000 3 0 topology 12 26
-> 16 0.000000 3 0 topology 25 26
-> 15 0.000000 3 0 topology 25 27
-> 16 0.000000 3 0 topology 26 27
-> 15 0.000000 3 0 topology 26 28
-> 16 0.000000 3 0 topology 27 28
-> 15 0.000000 3 0 topology 14 29
-> 16 0.000000 3 0 topology 8 29
-> 15 0.000000 3 0 topology 13 30
-> 16 0.000000 3 0 topology 8 30
-> 15 0.000000 3 0 topology 11 31
-> 16 0.000000 3 0 topology 8 31
-> 15 0.000000 3 0 topology 8 32
-> 16 0.000000 3 0 topology 10 32
-> 15 0.000000 3 0 topology 30 33
-> 16 0.000000 3 0 topology 28 33
-> 15 0.000000 4 0 topology 3 34
-> 16 0.000000 4 0 topology 28 34
-> 15 0.000000 3 0 topology 28 35
-> 16 0.000000 3 0 topology 29 35
-> 15 0.000000 4 0 topology 3 36
-> 16 0.000000 4 0 topology 30 36
-> 15 0.000000 3 0 topology 14 37
-> 16 0.000000 3 0 topology 13 37
-> 15 0.000000 3 0 topology 29 38
-> 16 0.000000 3 0 topology 11 38
-> 15 0.000000 4 0 topology 1 39
-> 16 0.000000 4 0 topology 11 39
-> 15 0.000000 5 0 topology 24 40
-> 16 0.000000 5 0 topology 7 40
-> 15 0.000000 5 0 topology 10 41
-> 16 0.000000 5 0 topology 5 41
-> 15 0.000000 5 0 topology 13 42
-> 16 0.000000 5 0 topology 3 42
-> 15 0.000000 5 0 topology 17 43
-> 16 0.000000 5 0 topology 4 43
-> 15 0.000000 5 0 topology 18 44
-> 16 0.000000 5 0 topology 6 44
-> 15 0.000000 5 0 topology 11 45
-> 16 0.000000 5 0 topology 2 45
-> 0 6 1 ACTOR
-> 6 0.000000 32 6 3 "emigrant-1"
-> 2 7 6 ACTOR_STATE
-> 5 8 7 suspend "1 0 1"
-> 5 9 7 sleep "1 1 0"
-> 5 10 7 receive "1 0 0"
-> 5 11 7 send "0 0 1"
-> 5 12 7 execute "0 1 1"
-> 4 13 0 6 6 ACTOR_LINK
-> 6 0.000000 33 6 1 "policeman-2"
-> 12 0.000000 7 32 9
-> 12 0.000000 7 33 11
-> 13 2.000000 7 32
-> 12 2.000000 7 32 10
-> 13 2.025708 7 33
-> 12 2.025708 7 33 11
-> 13 2.025708 7 32
-> 15 2.025708 13 0 M 32 0
-> 7 2.025708 6 32
-> 6 2.025708 34 6 1 "emigrant-1"
-> 16 2.025708 13 0 M 34 0
-> 12 2.025708 7 34 9
-> 13 4.025708 7 34
-> 12 4.025708 7 34 10
-> 13 4.025903 7 33
-> 12 4.025903 7 33 11
-> 13 4.025903 7 34
-> 15 4.025903 13 0 M 34 1
-> 7 4.025903 6 34
-> 6 4.025903 35 6 2 "emigrant-1"
-> 16 4.025903 13 0 M 35 1
-> 12 4.025903 7 35 9
-> 13 6.025903 7 35
-> 12 6.025903 7 35 10
-> 13 6.044918 7 33
-> 12 6.044918 7 33 11
-> 13 6.044918 7 35
-> 15 6.044918 13 0 M 35 2
-> 7 6.044918 6 35
-> 6 6.044918 36 6 3 "emigrant-1"
-> 16 6.044918 13 0 M 36 2
-> 12 6.044918 7 36 9
-> 13 8.044918 7 36
-> 12 8.044918 7 36 10
-> 13 8.070626 7 33
-> 12 8.070626 7 33 11
-> 13 8.070626 7 36
-> 15 8.070626 13 0 M 36 3
-> 7 8.070626 6 36
-> 6 8.070626 37 6 4 "emigrant-1"
-> 16 8.070626 13 0 M 37 3
-> 12 8.070626 7 37 9
-> 13 10.070626 7 37
-> 12 10.070626 7 37 10
-> 13 10.087178 7 33
-> 12 10.087178 7 33 11
-> 13 10.087178 7 37
-> 15 10.087178 13 0 M 37 4
-> 7 10.087178 6 37
-> 6 10.087178 38 6 5 "emigrant-1"
-> 16 10.087178 13 0 M 38 4
-> 12 10.087178 7 38 9
-> 13 12.087178 7 38
-> 12 12.087178 7 38 10
-> 13 12.112617 7 33
-> 12 12.112617 7 33 11
-> 13 12.112617 7 38
-> 15 12.112617 13 0 M 38 5
-> 7 12.112617 6 38
-> 6 12.112617 39 6 3 "emigrant-1"
-> 16 12.112617 13 0 M 39 5
-> 12 12.112617 7 39 9
-> 13 14.112617 7 39
-> 12 14.112617 7 39 10
-> 13 14.138325 7 33
-> 12 14.138325 7 33 11
-> 13 14.138325 7 39
-> 15 14.138325 13 0 M 39 6
-> 7 14.138325 6 39
-> 6 14.138325 40 6 1 "emigrant-1"
-> 16 14.138325 13 0 M 40 6
-> 12 14.138325 7 40 9
-> 13 16.138325 7 40
-> 12 16.138325 7 40 10
-> 13 16.138521 7 33
-> 12 16.138521 7 33 11
-> 13 16.138521 7 40
-> 15 16.138521 13 0 M 40 7
-> 7 16.138521 6 40
-> 6 16.138521 41 6 4 "emigrant-1"
-> 16 16.138521 13 0 M 41 7
-> 12 16.138521 7 41 9
-> 13 18.138521 7 41
-> 12 18.138521 7 41 10
-> 13 18.155073 7 33
-> 13 18.155073 7 41
-> 7 18.155073 6 33
-> 7 18.155073 6 41
-> 7 18.155073 2 16
-> 7 18.155073 2 14
-> 7 18.155073 2 19
-> 7 18.155073 2 20
-> 7 18.155073 2 18
-> 7 18.155073 2 21
-> 7 18.155073 2 22
-> 7 18.155073 2 12
-> 7 18.155073 2 9
-> 7 18.155073 2 15
-> 7 18.155073 2 23
-> 7 18.155073 2 24
-> 7 18.155073 2 17
-> 7 18.155073 2 25
-> 7 18.155073 2 26
-> 7 18.155073 2 27
-> 7 18.155073 2 8
-> 7 18.155073 2 10
-> 7 18.155073 2 28
-> 7 18.155073 2 29
-> 7 18.155073 2 13
-> 7 18.155073 2 30
-> 7 18.155073 2 11
+> 0 6 0 LINK
+> 6 0.000000 8 6 0 "6"
+> 6 0.000000 9 6 0 "3"
+> 6 0.000000 10 6 0 "7"
+> 6 0.000000 11 6 0 "9"
+> 6 0.000000 12 6 0 "2"
+> 6 0.000000 13 6 0 "8"
+> 6 0.000000 14 6 0 "1"
+> 6 0.000000 15 6 0 "4"
+> 6 0.000000 16 6 0 "0"
+> 6 0.000000 17 6 0 "5"
+> 6 0.000000 18 6 0 "145"
+> 6 0.000000 19 6 0 "10"
+> 6 0.000000 20 6 0 "11"
+> 6 0.000000 21 6 0 "16"
+> 6 0.000000 22 6 0 "17"
+> 6 0.000000 23 6 0 "44"
+> 6 0.000000 24 6 0 "47"
+> 6 0.000000 25 6 0 "54"
+> 6 0.000000 26 6 0 "56"
+> 6 0.000000 27 6 0 "59"
+> 6 0.000000 28 6 0 "78"
+> 6 0.000000 29 6 0 "79"
+> 6 0.000000 30 6 0 "80"
+> 6 0.000000 31 6 0 "loopback"
+> 4 7 0 6 6 0-LINK6-LINK6
+> 4 8 0 1 6 0-HOST1-LINK6
+> 4 9 0 6 1 0-LINK6-HOST1
+> 15 0.000000 7 0 topology 12 0
+> 16 0.000000 7 0 topology 16 0
+> 15 0.000000 7 0 topology 9 1
+> 16 0.000000 7 0 topology 16 1
+> 15 0.000000 7 0 topology 16 2
+> 16 0.000000 7 0 topology 14 2
+> 15 0.000000 7 0 topology 21 3
+> 16 0.000000 7 0 topology 19 3
+> 15 0.000000 7 0 topology 8 4
+> 16 0.000000 7 0 topology 19 4
+> 15 0.000000 7 0 topology 19 5
+> 16 0.000000 7 0 topology 20 5
+> 15 0.000000 7 0 topology 8 6
+> 16 0.000000 7 0 topology 20 6
+> 15 0.000000 7 0 topology 27 7
+> 16 0.000000 7 0 topology 18 7
+> 15 0.000000 8 0 topology 5 8
+> 16 0.000000 8 0 topology 18 8
+> 15 0.000000 8 0 topology 4 9
+> 16 0.000000 8 0 topology 18 9
+> 15 0.000000 8 0 topology 2 10
+> 16 0.000000 8 0 topology 18 10
+> 15 0.000000 7 0 topology 16 11
+> 16 0.000000 7 0 topology 21 11
+> 15 0.000000 7 0 topology 21 12
+> 16 0.000000 7 0 topology 22 12
+> 15 0.000000 7 0 topology 9 13
+> 16 0.000000 7 0 topology 12 13
+> 15 0.000000 7 0 topology 15 14
+> 16 0.000000 7 0 topology 9 14
+> 15 0.000000 8 0 topology 1 15
+> 16 0.000000 8 0 topology 9 15
+> 15 0.000000 7 0 topology 20 16
+> 16 0.000000 7 0 topology 23 16
+> 15 0.000000 7 0 topology 23 17
+> 16 0.000000 7 0 topology 24 17
+> 15 0.000000 8 0 topology 5 18
+> 16 0.000000 8 0 topology 24 18
+> 15 0.000000 8 0 topology 4 19
+> 16 0.000000 8 0 topology 24 19
+> 15 0.000000 8 0 topology 2 20
+> 16 0.000000 8 0 topology 24 20
+> 15 0.000000 7 0 topology 11 21
+> 16 0.000000 7 0 topology 15 21
+> 15 0.000000 8 0 topology 1 22
+> 16 0.000000 8 0 topology 15 22
+> 15 0.000000 7 0 topology 12 23
+> 16 0.000000 7 0 topology 17 23
+> 15 0.000000 7 0 topology 9 24
+> 16 0.000000 7 0 topology 17 24
+> 15 0.000000 7 0 topology 22 25
+> 16 0.000000 7 0 topology 25 25
+> 15 0.000000 7 0 topology 12 26
+> 16 0.000000 7 0 topology 25 26
+> 15 0.000000 7 0 topology 25 27
+> 16 0.000000 7 0 topology 26 27
+> 15 0.000000 7 0 topology 26 28
+> 16 0.000000 7 0 topology 27 28
+> 15 0.000000 7 0 topology 14 29
+> 16 0.000000 7 0 topology 8 29
+> 15 0.000000 7 0 topology 13 30
+> 16 0.000000 7 0 topology 8 30
+> 15 0.000000 7 0 topology 11 31
+> 16 0.000000 7 0 topology 8 31
+> 15 0.000000 7 0 topology 8 32
+> 16 0.000000 7 0 topology 10 32
+> 15 0.000000 7 0 topology 30 33
+> 16 0.000000 7 0 topology 28 33
+> 15 0.000000 8 0 topology 3 34
+> 16 0.000000 8 0 topology 28 34
+> 15 0.000000 7 0 topology 28 35
+> 16 0.000000 7 0 topology 29 35
+> 15 0.000000 8 0 topology 3 36
+> 16 0.000000 8 0 topology 30 36
+> 15 0.000000 7 0 topology 14 37
+> 16 0.000000 7 0 topology 13 37
+> 15 0.000000 7 0 topology 29 38
+> 16 0.000000 7 0 topology 11 38
+> 15 0.000000 8 0 topology 1 39
+> 16 0.000000 8 0 topology 11 39
+> 15 0.000000 9 0 topology 24 40
+> 16 0.000000 9 0 topology 7 40
+> 15 0.000000 9 0 topology 10 41
+> 16 0.000000 9 0 topology 5 41
+> 15 0.000000 9 0 topology 13 42
+> 16 0.000000 9 0 topology 3 42
+> 15 0.000000 9 0 topology 17 43
+> 16 0.000000 9 0 topology 4 43
+> 15 0.000000 9 0 topology 18 44
+> 16 0.000000 9 0 topology 6 44
+> 15 0.000000 9 0 topology 11 45
+> 16 0.000000 9 0 topology 2 45
+> 0 10 1 ACTOR
+> 6 0.000000 32 10 3 "emigrant-1"
+> 2 11 10 ACTOR_STATE
+> 5 12 11 suspend "1 0 1"
+> 5 13 11 sleep "1 1 0"
+> 5 14 11 receive "1 0 0"
+> 5 15 11 send "0 0 1"
+> 5 16 11 execute "0 1 1"
+> 4 17 0 10 10 ACTOR_LINK
+> 6 0.000000 33 10 1 "policeman-2"
+> 12 0.000000 11 32 13
+> 12 0.000000 11 33 15
+> 13 2.000000 11 32
+> 12 2.000000 11 32 14
+> 13 2.025708 11 33
+> 12 2.025708 11 33 15
+> 13 2.025708 11 32
+> 15 2.025708 17 0 M 32 0
+> 7 2.025708 10 32
+> 6 2.025708 34 10 1 "emigrant-1"
+> 16 2.025708 17 0 M 34 0
+> 12 2.025708 11 34 13
+> 13 4.025708 11 34
+> 12 4.025708 11 34 14
+> 13 4.025903 11 33
+> 12 4.025903 11 33 15
+> 13 4.025903 11 34
+> 15 4.025903 17 0 M 34 1
+> 7 4.025903 10 34
+> 6 4.025903 35 10 2 "emigrant-1"
+> 16 4.025903 17 0 M 35 1
+> 12 4.025903 11 35 13
+> 13 6.025903 11 35
+> 12 6.025903 11 35 14
+> 13 6.044918 11 33
+> 12 6.044918 11 33 15
+> 13 6.044918 11 35
+> 15 6.044918 17 0 M 35 2
+> 7 6.044918 10 35
+> 6 6.044918 36 10 3 "emigrant-1"
+> 16 6.044918 17 0 M 36 2
+> 12 6.044918 11 36 13
+> 13 8.044918 11 36
+> 12 8.044918 11 36 14
+> 13 8.070626 11 33
+> 12 8.070626 11 33 15
+> 13 8.070626 11 36
+> 15 8.070626 17 0 M 36 3
+> 7 8.070626 10 36
+> 6 8.070626 37 10 4 "emigrant-1"
+> 16 8.070626 17 0 M 37 3
+> 12 8.070626 11 37 13
+> 13 10.070626 11 37
+> 12 10.070626 11 37 14
+> 13 10.087178 11 33
+> 12 10.087178 11 33 15
+> 13 10.087178 11 37
+> 15 10.087178 17 0 M 37 4
+> 7 10.087178 10 37
+> 6 10.087178 38 10 5 "emigrant-1"
+> 16 10.087178 17 0 M 38 4
+> 12 10.087178 11 38 13
+> 13 12.087178 11 38
+> 12 12.087178 11 38 14
+> 13 12.112617 11 33
+> 12 12.112617 11 33 15
+> 13 12.112617 11 38
+> 15 12.112617 17 0 M 38 5
+> 7 12.112617 10 38
+> 6 12.112617 39 10 3 "emigrant-1"
+> 16 12.112617 17 0 M 39 5
+> 12 12.112617 11 39 13
+> 13 14.112617 11 39
+> 12 14.112617 11 39 14
+> 13 14.138325 11 33
+> 12 14.138325 11 33 15
+> 13 14.138325 11 39
+> 15 14.138325 17 0 M 39 6
+> 7 14.138325 10 39
+> 6 14.138325 40 10 1 "emigrant-1"
+> 16 14.138325 17 0 M 40 6
+> 12 14.138325 11 40 13
+> 13 16.138325 11 40
+> 12 16.138325 11 40 14
+> 13 16.138521 11 33
+> 12 16.138521 11 33 15
+> 13 16.138521 11 40
+> 15 16.138521 17 0 M 40 7
+> 7 16.138521 10 40
+> 6 16.138521 41 10 4 "emigrant-1"
+> 16 16.138521 17 0 M 41 7
+> 12 16.138521 11 41 13
+> 13 18.138521 11 41
+> 12 18.138521 11 41 14
+> 13 18.155073 11 33
+> 13 18.155073 11 41
+> 7 18.155073 10 33
+> 7 18.155073 10 41
+> 7 18.155073 6 16
+> 7 18.155073 6 14
+> 7 18.155073 6 19
+> 7 18.155073 6 20
+> 7 18.155073 6 18
+> 7 18.155073 6 21
+> 7 18.155073 6 22
+> 7 18.155073 6 12
+> 7 18.155073 6 9
+> 7 18.155073 6 15
+> 7 18.155073 6 23
+> 7 18.155073 6 24
+> 7 18.155073 6 17
+> 7 18.155073 6 25
+> 7 18.155073 6 26
+> 7 18.155073 6 27
+> 7 18.155073 6 8
+> 7 18.155073 6 10
+> 7 18.155073 6 28
+> 7 18.155073 6 29
+> 7 18.155073 6 13
+> 7 18.155073 6 30
+> 7 18.155073 6 11
 > 7 18.155073 1 7
 > 7 18.155073 1 5
 > 7 18.155073 1 3
@@ -371,6 +375,6 @@ $ tail -n +3 procmig.trace
 > 7 18.155073 1 6
 > 7 18.155073 1 2
 > 7 18.155073 1 1
-> 7 18.155073 2 31
+> 7 18.155073 6 31
 
 $ rm -f procmig.trace
index 7fee147..f8cd62d 100644 (file)
@@ -13,8 +13,7 @@
 #include <set>
 #include <string>
 
-namespace simgrid {
-namespace instr {
+namespace simgrid::instr {
 /* User-variables related functions*/
 /* for host variables */
 XBT_PUBLIC void declare_host_variable(const std::string& variable, const std::string& color = "");
@@ -67,8 +66,7 @@ XBT_PUBLIC const std::set<std::string, std::less<>>& get_tracing_categories();
 XBT_PUBLIC void platform_graph_export_graphviz(const std::string& output_filename);
 /* Function used by graphicator (transform a SimGrid platform file in a CSV file with the network topology) */
 XBT_PUBLIC void platform_graph_export_csv(const std::string& output_filename);
-} // namespace instr
-} // namespace simgrid
+} // namespace simgrid::instr
 
 #endif
 SG_BEGIN_DECL
index 8e72a2d..8ec4f7c 100644 (file)
@@ -9,10 +9,7 @@
 #include <simgrid/forward.h>
 #include <functional>
 
-namespace simgrid {
-namespace kernel {
-namespace profile {
-
+namespace simgrid::kernel::profile {
 
 /** @brief Modeling of the availability profile (due to an external load) or the churn
  *
@@ -75,8 +72,6 @@ public:
   static Profile* from_callback(const std::string& name, const std::function<UpdateCb>& cb, double repeat_delay);
 };
 
-} // namespace profile
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::profile
 
 #endif /* SIMGRID_KERNEL_PROFILEBUILDER_HPP */
index 3a98068..010a66f 100644 (file)
@@ -12,9 +12,7 @@
 
 #include <boost/heap/fibonacci_heap.hpp>
 
-namespace simgrid {
-namespace kernel {
-namespace timer {
+namespace simgrid::kernel::timer {
 
 inline auto& kernel_timers() // avoid static initialization order fiasco
 {
@@ -48,8 +46,6 @@ public:
   static bool execute_all();
 };
 
-} // namespace timer
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::timer
 
 #endif /* SRC_KERNEL_TIMER_TIMER_HPP_ */
index 613ae78..9524e89 100644 (file)
@@ -16,9 +16,7 @@
 
 static constexpr double NO_MAX_DURATION = -1.0;
 
-namespace simgrid {
-namespace kernel {
-namespace resource {
+namespace simgrid::kernel::resource {
 
 using heap_element_type = std::pair<double, Action*>;
 using heap_type =
@@ -273,7 +271,5 @@ public:
   void set_suspend_state(Action::SuspendStates state) { suspended_ = state; }
 };
 
-} // namespace resource
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::resource
 #endif
index 87f8eee..3a5affb 100644 (file)
@@ -10,9 +10,7 @@
 #include <simgrid/kernel/resource/Action.hpp>
 #include <unordered_map>
 
-namespace simgrid {
-namespace kernel {
-namespace resource {
+namespace simgrid::kernel::resource {
 
 class XBT_PUBLIC Model {
 public:
@@ -110,8 +108,6 @@ private:
   ActionHeap action_heap_;
 };
 
-} // namespace resource
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::resource
 
 #endif
index b08bba7..8fc4512 100644 (file)
@@ -11,9 +11,7 @@
 
 #include <unordered_map>
 
-namespace simgrid {
-namespace kernel {
-namespace routing {
+namespace simgrid::kernel::routing {
 
 /**
  * @brief Placeholder for old ClusterZone class
@@ -150,8 +148,6 @@ public:
     return node_pos_with_loopback(id) + (has_limiter_ ? 1 : 0);
   }
 };
-} // namespace routing
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::routing
 
 #endif /* SIMGRID_ROUTING_CLUSTER_HPP_ */
index fa4c176..dbaef58 100644 (file)
@@ -8,9 +8,7 @@
 
 #include <simgrid/kernel/routing/RoutedZone.hpp>
 
-namespace simgrid {
-namespace kernel {
-namespace routing {
+namespace simgrid::kernel::routing {
 
 /** @ingroup ROUTING_API
  *  @brief NetZone with an explicit routing computed on need with Dijkstra
@@ -53,8 +51,6 @@ public:
   void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
                  const std::vector<s4u::LinkInRoute>& link_list, bool symmetrical) override;
 };
-} // namespace routing
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::routing
 
 #endif /* SIMGRID_ROUTING_DIJKSTRA_HPP_ */
index 558af8d..acb1122 100644 (file)
@@ -9,9 +9,7 @@
 #include <simgrid/kernel/routing/ClusterZone.hpp>
 #include <simgrid/s4u/Link.hpp>
 
-namespace simgrid {
-namespace kernel {
-namespace routing {
+namespace simgrid::kernel::routing {
 
 class DragonflyRouter {
 public:
@@ -109,7 +107,5 @@ private:
   unsigned int num_links_per_link_     = 1; // splitduplex -> 2, only for local link
   std::vector<DragonflyRouter> routers_;
 };
-} // namespace routing
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::routing
 #endif
index 7240493..f5fd334 100644 (file)
@@ -9,9 +9,7 @@
 #include <simgrid/kernel/routing/NetZoneImpl.hpp>
 #include <xbt/asserts.h>
 
-namespace simgrid {
-namespace kernel {
-namespace routing {
+namespace simgrid::kernel::routing {
 
 /** @ingroup ROUTING_API
  *  @brief NetZone with no routing, useful with the constant network model
@@ -32,8 +30,6 @@ public:
   void get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t, std::less<>>* /*nodes*/,
                  std::map<std::string, xbt_edge_t, std::less<>>* /*edges*/) override;
 };
-} // namespace routing
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::routing
 
 #endif /* SIMGRID_ROUTING_NONE_HPP_ */
index a0623a2..fabeea2 100644 (file)
@@ -8,9 +8,7 @@
 
 #include <simgrid/kernel/routing/ClusterZone.hpp>
 
-namespace simgrid {
-namespace kernel {
-namespace routing {
+namespace simgrid::kernel::routing {
 
 class XBT_PRIVATE FatTreeLink;
 
@@ -159,8 +157,6 @@ public:
   void build_upper_levels(const s4u::ClusterCallbacks& set_callbacks);
   void generate_dot_file(const std::string& filename = "fat_tree.dot") const;
 };
-} // namespace routing
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::routing
 
 #endif
index a384746..6cfaa76 100644 (file)
@@ -8,9 +8,7 @@
 
 #include <simgrid/kernel/routing/RoutedZone.hpp>
 
-namespace simgrid {
-namespace kernel {
-namespace routing {
+namespace simgrid::kernel::routing {
 
 /** @ingroup ROUTING_API
  *  @brief NetZone with an explicit routing computed at initialization with Floyd-Warshal
@@ -39,8 +37,6 @@ public:
   void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
                  const std::vector<s4u::LinkInRoute>& link_list, bool symmetrical) override;
 };
-} // namespace routing
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::routing
 
 #endif /* SIMGRID_ROUTING_FLOYD_HPP_ */
index 5e34451..3a83895 100644 (file)
@@ -8,9 +8,7 @@
 
 #include <simgrid/kernel/routing/RoutedZone.hpp>
 
-namespace simgrid {
-namespace kernel {
-namespace routing {
+namespace simgrid::kernel::routing {
 
 /** @ingroup ROUTING_API
  *  @brief NetZone with an explicit routing provided by the user
@@ -33,8 +31,6 @@ public:
   void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
                  const std::vector<s4u::LinkInRoute>& link_list, bool symmetrical) override;
 };
-} // namespace routing
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::routing
 
 #endif /* SIMGRID_ROUTING_FULL_HPP_ */
index 566eee3..aca2452 100644 (file)
@@ -16,8 +16,7 @@ namespace simgrid {
 
 extern template class XBT_PUBLIC xbt::Extendable<kernel::routing::NetPoint>;
 
-namespace kernel {
-namespace routing {
+namespace kernel::routing {
 
 /** @ingroup ROUTING_API
  *  @brief Network cards are the vertices in the graph representing the network, used to compute paths between nodes.
@@ -54,8 +53,7 @@ private:
   NetPoint::Type component_type_;
   NetZoneImpl* englobing_zone_ = nullptr;
 };
-} // namespace routing
-} // namespace kernel
+} // namespace kernel::routing
 } // namespace simgrid
 
 XBT_PUBLIC simgrid::kernel::routing::NetPoint* sg_netpoint_by_name_or_null(const char* name);
index b7d16fb..ffb4322 100644 (file)
@@ -16,9 +16,7 @@
 #include <unordered_set>
 #include <vector>
 
-namespace simgrid {
-namespace kernel {
-namespace routing {
+namespace simgrid::kernel::routing {
 
 class Route {
 public:
@@ -287,8 +285,6 @@ private:
   virtual resource::StandardLinkImpl* do_create_link(const std::string& name, const std::vector<double>& bandwidths);
   void add_child(NetZoneImpl* new_zone);
 };
-} // namespace routing
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::routing
 
 #endif /* SIMGRID_ROUTING_NETZONEIMPL_HPP */
index a4e9b67..cf96ee0 100644 (file)
@@ -8,9 +8,7 @@
 
 #include <simgrid/kernel/routing/NetZoneImpl.hpp>
 
-namespace simgrid {
-namespace kernel {
-namespace routing {
+namespace simgrid::kernel::routing {
 
 /** @ingroup ROUTING_API
  *  @brief NetZone with an explicit routing (abstract class)
@@ -59,8 +57,6 @@ protected:
   void add_route_check_params(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
                               const std::vector<s4u::LinkInRoute>& link_list, bool symmetrical) const;
 };
-} // namespace routing
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::routing
 
 #endif /* SIMGRID_ROUTING_GENERIC_HPP_ */
index dcf740c..dc533e0 100644 (file)
@@ -11,9 +11,7 @@
 #include <unordered_map>
 #include <unordered_set>
 
-namespace simgrid {
-namespace kernel {
-namespace routing {
+namespace simgrid::kernel::routing {
 
 /** @ingroup ROUTING_API
  *  @brief NetZone where components are connected following a star topology
@@ -93,8 +91,6 @@ private:
                              bool symmetrical) const;
   std::unordered_map<unsigned long, StarRoute> routes_;
 };
-} // namespace routing
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::routing
 
 #endif /* SIMGRID_KERNEL_ROUTING_STARZONE_HPP_ */
index af661d3..4eeed3e 100644 (file)
@@ -10,9 +10,7 @@
 
 #include <vector>
 
-namespace simgrid {
-namespace kernel {
-namespace routing {
+namespace simgrid::kernel::routing {
 
 /** @ingroup ROUTING_API
  * @brief NetZone using a Torus topology
@@ -32,7 +30,5 @@ public:
   static std::vector<unsigned long> parse_topo_parameters(const std::string& topo_parameters);
 };
 
-} // namespace routing
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::routing
 #endif
index 0af8f0e..c64353a 100644 (file)
@@ -9,9 +9,7 @@
 #include <simgrid/kernel/routing/StarZone.hpp>
 #include <xbt/Extendable.hpp>
 
-namespace simgrid {
-namespace kernel {
-namespace routing {
+namespace simgrid::kernel::routing {
 
 /** @ingroup ROUTING_API
  *  @brief NetZone modeling peers connected to the cloud through a private link
@@ -60,8 +58,6 @@ public:
   std::vector<double> coords;
 };
 } // namespace vivaldi
-} // namespace routing
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::routing
 
 #endif /* SIMGRID_ROUTING_VIVALDI_HPP_ */
index 2f25143..d2c6108 100644 (file)
@@ -8,9 +8,7 @@
 
 #include <simgrid/kernel/routing/RoutedZone.hpp>
 
-namespace simgrid {
-namespace kernel {
-namespace routing {
+namespace simgrid::kernel::routing {
 
 /** @ingroup ROUTING_API
  *  @brief NetZone modeling a Wifi zone
@@ -33,8 +31,6 @@ public:
   void get_local_route(const NetPoint* src, const NetPoint* dst, Route* into, double* latency) override;
   NetPoint* get_access_point() const { return access_point_; }
 };
-} // namespace routing
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::routing
 
 #endif /* SIMGRID_ROUTING_WIFI_HPP_ */
index b6af5a4..87d4cfa 100644 (file)
@@ -22,8 +22,7 @@ XBT_LOG_EXTERNAL_CATEGORY(producer_consumer);
 
 /** Stock implementation of a generic monitored queue to solve the producer-consumer problem */
 
-namespace simgrid {
-namespace plugin {
+namespace simgrid::plugin {
 
 template <typename T> class ProducerConsumer;
 template <typename T> using ProducerConsumerPtr = boost::intrusive_ptr<ProducerConsumer<T>>;
@@ -104,7 +103,7 @@ public:
    */
   ProducerConsumer* set_max_queue_size(unsigned int max_queue_size)
   {
-    const std::lock_guard<s4u::Mutex> lock(*mutex_);
+    const std::scoped_lock lock(*mutex_);
     max_queue_size_ = max_queue_size;
     return this;
   }
@@ -214,7 +213,6 @@ public:
   }
 };
 
-} // namespace plugin
-} // namespace simgrid
+} // namespace simgrid::plugin
 
 #endif // SIMGRID_PLUGIN_PRODUCERCONSUMER_HPP
index 303b0d1..f335c6d 100644 (file)
@@ -2,6 +2,7 @@
 #define SIMGRID_PLUGINS_OPERATION_H_
 
 #include <simgrid/s4u/Activity.hpp>
+#include <simgrid/s4u/Io.hpp>
 #include <xbt/Extendable.hpp>
 
 #include <atomic>
@@ -23,6 +24,10 @@ class CommOp;
 using CommOpPtr =  boost::intrusive_ptr<CommOp>;
 XBT_PUBLIC void intrusive_ptr_release(CommOp* c);
 XBT_PUBLIC void intrusive_ptr_add_ref(CommOp* c);
+class IoOp;
+using IoOpPtr =  boost::intrusive_ptr<IoOp>;
+XBT_PUBLIC void intrusive_ptr_release(IoOp* i);
+XBT_PUBLIC void intrusive_ptr_add_ref(IoOp* i);
 
 struct ExtendedAttributeActivity {
   static simgrid::xbt::Extension<simgrid::s4u::Activity, ExtendedAttributeActivity> EXTENSION_ID;
@@ -30,7 +35,6 @@ struct ExtendedAttributeActivity {
 };
 
 class Operation {
-private:
   static bool inited_;
   std::set<Operation*> successors_                 = {};
   std::map<Operation*, unsigned int> predecessors_ = {};
@@ -48,8 +52,8 @@ protected:
   int count_        = 0;
   bool working_     = false;
   s4u::ActivityPtr current_activity_;
-  std::function<void(Operation*)> end_func_;
-  std::function<void(Operation*)> start_func_;
+  std::vector<std::function<void(Operation*)>> end_func_handlers_;
+  std::vector<std::function<void(Operation*)>> start_func_handlers_;
   explicit Operation(const std::string& name);
   virtual ~Operation()   = default;
   virtual void execute() = 0;
@@ -94,7 +98,6 @@ public:
 };
 
 class ExecOp : public Operation {
-private:
   s4u::Host* host_;
 
   explicit ExecOp(const std::string& name);
@@ -112,7 +115,6 @@ public:
 };
 
 class CommOp : public Operation {
-private:
   s4u::Host* source_;
   s4u::Host* destination_;
 
@@ -132,5 +134,22 @@ public:
   friend void inline intrusive_ptr_release(CommOp* c) { intrusive_ptr_release(static_cast<Operation*>(c)); }
   friend void inline intrusive_ptr_add_ref(CommOp* c) { intrusive_ptr_add_ref(static_cast<Operation*>(c)); }
 };
+
+class IoOp : public Operation {
+  s4u::Disk* disk_;
+  s4u::Io::OpType type_;
+  explicit IoOp(const std::string& name);
+  void execute() override;
+
+public:
+  static IoOpPtr init(const std::string& name);
+  static IoOpPtr init(const std::string& name, double bytes, s4u::Disk* disk, s4u::Io::OpType type);
+  IoOpPtr set_disk(s4u::Disk* disk);
+  IoOpPtr set_bytes(double bytes);
+  IoOpPtr set_op_type(s4u::Io::OpType type);
+
+  friend void inline intrusive_ptr_release(IoOp* i) { intrusive_ptr_release(static_cast<Operation*>(i)); }
+  friend void inline intrusive_ptr_add_ref(IoOp* i) { intrusive_ptr_add_ref(static_cast<Operation*>(i)); }
+};
 } // namespace simgrid::plugins
 #endif
index 83f929d..506cd3c 100644 (file)
@@ -51,6 +51,7 @@ public:
   bool has_no_successor() const { return successors_.empty(); }
   const std::set<ActivityPtr>& get_dependencies() const { return dependencies_; }
   const std::vector<ActivityPtr>& get_successors() const { return successors_; }
+  virtual void fire_this_completion() const = 0;
 
 protected:
   Activity()  = default;
@@ -104,7 +105,6 @@ protected:
 
 private:
   static xbt::signal<void(Activity&)> on_veto;
-  static xbt::signal<void(Activity const&)> on_completion;
   static xbt::signal<void(Activity const&)> on_suspend;
   static xbt::signal<void(Activity const&)> on_resume;
 
@@ -112,8 +112,6 @@ public:
   /*! Add a callback fired each time that the activity fails to start because of a veto (e.g., unsolved dependency or no
    * resource assigned) */
   static void on_veto_cb(const std::function<void(Activity&)>& cb) { on_veto.connect(cb); }
-  /*! Add a callback fired when the activity completes (either normally, cancelled or failed) */
-  static void on_completion_cb(const std::function<void(Activity const&)>& cb) { on_completion.connect(cb); }
   /*! Add a callback fired when the activity is suspended */
   static void on_suspend_cb(const std::function<void(Activity const&)>& cb)
   {
@@ -159,7 +157,7 @@ public:
     // released by the on_completion() callbacks.
     ActivityPtr keepalive(this);
     state_ = state;
-    on_completion(*this);
+    fire_this_completion();
     if (state == State::FINISHED)
       release_dependencies();
   }
@@ -258,6 +256,10 @@ template <class AnyActivity> class Activity_T : public Activity {
   std::string tracing_category_ = "";
 
 public:
+  inline static xbt::signal<void(AnyActivity const&)> on_completion;
+  /*! Add a callback fired when the activity completes (either normally, cancelled or failed) */
+  static void on_completion_cb(const std::function<void(AnyActivity const&)>& cb) { on_completion.connect(cb); }
+
   AnyActivity* add_successor(ActivityPtr a)
   {
     Activity::add_successor(a);
@@ -278,7 +280,8 @@ public:
 
   AnyActivity* set_tracing_category(const std::string& category)
   {
-    xbt_assert(get_state() == State::INITED, "Cannot change the tracing category of an activity after its start");
+    xbt_assert(get_state() == State::INITED || get_state() == State::STARTING,
+               "Cannot change the tracing category of an activity after its start");
     tracing_category_ = category;
     return static_cast<AnyActivity*>(this);
   }
@@ -306,7 +309,9 @@ public:
 
   AnyActivity* cancel() { return static_cast<AnyActivity*>(Activity::cancel()); }
   AnyActivity* wait() { return wait_for(-1.0); }
-  virtual AnyActivity* wait_for(double timeout) { return static_cast<AnyActivity*>(Activity::wait_for(timeout)); }
+  virtual AnyActivity* wait_for(double timeout) {
+    return static_cast<AnyActivity*>(Activity::wait_for(timeout));
+  }
 
 #ifndef DOXYGEN
   /* The refcounting is done in the ancestor class, Activity, but we want each of the classes benefiting of the CRTP
index c031859..5419c53 100644 (file)
@@ -15,8 +15,7 @@
 #include <atomic>
 #include <future>
 
-namespace simgrid {
-namespace s4u {
+namespace simgrid::s4u {
 
 class XBT_PUBLIC Barrier {
   kernel::activity::BarrierImpl* pimpl_;
@@ -43,7 +42,6 @@ public:
   friend XBT_PUBLIC void intrusive_ptr_release(Barrier* barrier);
 #endif
 };
-} // namespace s4u
-} // namespace simgrid
+} // namespace simgrid::s4u
 
 #endif
index 8d1d856..d371641 100644 (file)
@@ -12,8 +12,7 @@
 #include <string>
 #include <vector>
 
-namespace simgrid {
-namespace s4u {
+namespace simgrid::s4u {
 /** @brief Communication async
  *
  * Represents all asynchronous communications, that you can test or wait onto.
@@ -51,6 +50,7 @@ public:
   static void on_send_cb(const std::function<void(Comm const&)>& cb) { on_send.connect(cb); }
   static void on_recv_cb(const std::function<void(Comm const&)>& cb) { on_recv.connect(cb); }
   static void on_start_cb(const std::function<void(Comm const&)>& cb) { on_start.connect(cb); }
+  void fire_this_completion() const override { on_completion(*this); }
   /* More callbacks */
   CommPtr set_copy_data_callback(const std::function<void(kernel::activity::CommImpl*, void*, size_t)>& callback);
   XBT_ATTRIB_DEPRECATED_v337("Please manifest if you actually need this function") static void copy_buffer_callback(
@@ -177,7 +177,6 @@ public:
    * occurs). */
   static size_t wait_all_for(const std::vector<CommPtr>& comms, double timeout);
 };
-} // namespace s4u
-} // namespace simgrid
+} // namespace simgrid::s4u
 
 #endif /* SIMGRID_S4U_COMM_HPP */
index 56c74c3..0e0e672 100644 (file)
@@ -14,8 +14,7 @@
 
 #include <future>
 
-namespace simgrid {
-namespace s4u {
+namespace simgrid::s4u {
 
 /**
  * @beginrst
@@ -117,7 +116,6 @@ public:
   void notify_all();
 };
 
-} // namespace s4u
-} // namespace simgrid
+} // namespace simgrid::s4u
 
 #endif
index 742bb36..beff27c 100644 (file)
@@ -18,8 +18,7 @@
 #include <utility>
 #include <vector>
 
-namespace simgrid {
-namespace s4u {
+namespace simgrid::s4u {
 /** @brief Simulation engine
  *
  * This is a singleton containing all the main functions of the simulation.
@@ -193,7 +192,7 @@ public:
   /** @brief Retrieves all netzones of the type indicated by the template argument */
   template <class T> std::vector<T*> get_filtered_netzones() const
   {
-    static_assert(std::is_base_of<kernel::routing::NetZoneImpl, T>::value,
+    static_assert(std::is_base_of_v<kernel::routing::NetZoneImpl, T>,
                   "Filtering netzones is only possible for subclasses of kernel::routing::NetZoneImpl");
     std::vector<T*> res;
     get_filtered_netzones_recursive(get_netzone_root(), &res);
@@ -272,7 +271,7 @@ std::vector<ActivityPtr> create_DAG_from_json(const std::string& filename);
 template <class T>
 XBT_PRIVATE void get_filtered_netzones_recursive(const s4u::NetZone* current, std::vector<T*>* whereto)
 {
-  static_assert(std::is_base_of<kernel::routing::NetZoneImpl, T>::value,
+  static_assert(std::is_base_of_v<kernel::routing::NetZoneImpl, T>,
                 "Filtering netzones is only possible for subclasses of kernel::routing::NetZoneImpl");
   for (auto const& elem : current->get_children()) {
     get_filtered_netzones_recursive(elem, whereto);
@@ -282,7 +281,6 @@ XBT_PRIVATE void get_filtered_netzones_recursive(const s4u::NetZone* current, st
   }
 }
 #endif
-} // namespace s4u
-} // namespace simgrid
+} // namespace simgrid::s4u
 
 #endif /* SIMGRID_S4U_ENGINE_HPP */
index cd514ea..6d788ed 100644 (file)
@@ -11,8 +11,7 @@
 #include <simgrid/s4u/Actor.hpp>
 #include <xbt/ex.h>
 
-namespace simgrid {
-namespace s4u {
+namespace simgrid::s4u {
 
 /** Computation Activity, representing the asynchronous executions.
  *
@@ -52,6 +51,7 @@ public:
 #endif
   /*! Signal fired each time that an execution actually starts (no veto) */
   static void on_start_cb(const std::function<void(Exec const&)>& cb) { on_start.connect(cb); }
+  void fire_this_completion() const override { on_completion(*this); }
 
   static ExecPtr init();
 
@@ -88,7 +88,6 @@ public:
   bool is_assigned() const override;
 };
 
-} // namespace s4u
-} // namespace simgrid
+} // namespace simgrid::s4u
 
 #endif /* SIMGRID_S4U_EXEC_HPP */
index 8c626f7..f3e1e49 100644 (file)
@@ -11,8 +11,7 @@
 
 #include <string>
 
-namespace simgrid {
-namespace s4u {
+namespace simgrid::s4u {
 
 /** I/O Activity, representing the asynchronous disk access.
  *
@@ -35,6 +34,7 @@ public:
   enum class OpType { READ, WRITE };
 
   static void on_start_cb(const std::function<void(Io const&)>& cb) { on_start.connect(cb); }
+  void fire_this_completion() const override{ on_completion(*this); }
 
   static IoPtr init();
   /*! take a vector of s4u::IoPtr and return when one of them is finished.
@@ -64,7 +64,6 @@ public:
   bool is_assigned() const override;
 };
 
-} // namespace s4u
-} // namespace simgrid
+} // namespace simgrid::s4u
 
 #endif /* SIMGRID_S4U_IO_HPP */
index 75201ec..d3bec35 100644 (file)
@@ -14,8 +14,7 @@
 #include <memory>
 #include <string>
 
-namespace simgrid {
-namespace s4u {
+namespace simgrid::s4u {
 
 /** @brief Mailboxes: Network rendez-vous points. */
 class XBT_PUBLIC Mailbox {
@@ -151,7 +150,6 @@ template <typename T> T* Mailbox::get(double timeout)
   get_async<T>(&res)->wait_for(timeout);
   return res;
 }
-} // namespace s4u
-} // namespace simgrid
+} // namespace simgrid::s4u
 
 #endif /* SIMGRID_S4U_MAILBOX_HPP */
index 60eb8d0..b653f1b 100644 (file)
@@ -9,8 +9,7 @@
 #include <simgrid/forward.h>
 #include <xbt/asserts.h>
 
-namespace simgrid {
-namespace s4u {
+namespace simgrid::s4u {
 
 /** @brief A classical mutex, but blocking in the simulation world.
  *
@@ -55,7 +54,6 @@ public:
   bool try_lock();
 };
 
-} // namespace s4u
-} // namespace simgrid
+} // namespace simgrid::s4u
 
 #endif /* SIMGRID_S4U_MUTEX_HPP */
index 63a1c23..a4979d4 100644 (file)
@@ -18,8 +18,7 @@
 #include <utility>
 #include <vector>
 
-namespace simgrid {
-namespace s4u {
+namespace simgrid::s4u {
 
 /** @brief Networking Zones
  *
@@ -329,7 +328,6 @@ XBT_PUBLIC NetZone* create_dragonfly_zone(const std::string& name, const NetZone
                                           const DragonflyParams& parameters, const ClusterCallbacks& set_callbacks,
                                           double bandwidth, double latency, Link::SharingPolicy sharing_policy);
 
-} // namespace s4u
-} // namespace simgrid
+} // namespace simgrid::s4u
 
 #endif /* SIMGRID_S4U_NETZONE_HPP */
index 6dcb9a4..99089a7 100644 (file)
@@ -8,8 +8,7 @@
 
 #include <simgrid/forward.h>
 
-namespace simgrid {
-namespace s4u {
+namespace simgrid::s4u {
 
 /** @brief A classical semaphore, but blocking in the simulation world
  *
@@ -57,7 +56,6 @@ public:
   bool would_block() const;
 };
 
-} // namespace s4u
-} // namespace simgrid
+} // namespace simgrid::s4u
 
 #endif /* SIMGRID_S4U_SEMAPHORE_HPP */
index 748f264..6afde5b 100644 (file)
@@ -10,8 +10,7 @@
 #include <simgrid/s4u/Host.hpp>
 #include <xbt/utility.hpp>
 
-namespace simgrid {
-namespace s4u {
+namespace simgrid::s4u {
 
 /** @brief Host extension for the VMs */
 class VmHostExt {
@@ -105,7 +104,6 @@ public:
     on_migration_end.connect(cb);
   }
 };
-} // namespace s4u
-} // namespace simgrid
+} // namespace simgrid::s4u
 
 #endif
index 399d63f..338c337 100644 (file)
@@ -20,9 +20,7 @@ XBT_PUBLIC void simcall_run_blocking(std::function<void()> const& code,
 XBT_PUBLIC void simcall_run_object_access(std::function<void()> const& code,
                                           simgrid::kernel::actor::ObjectAccessSimcallItem* item);
 
-namespace simgrid {
-namespace kernel {
-namespace actor {
+namespace simgrid::kernel::actor {
 
 /** Execute some code in kernel context on behalf of the user code.
  *
@@ -115,8 +113,5 @@ auto simcall_blocking(F&& code, Observer* observer) -> decltype(observer->get_re
   simcall_blocking(std::forward<F>(code), static_cast<SimcallObserver*>(observer));
   return observer->get_result();
 }
-// compact namespaces are C++17 and this is a public header file so let's stick to C++14
-} // namespace actor
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::actor
 #endif
index 97071be..35938c4 100644 (file)
@@ -10,8 +10,7 @@
 #ifdef __cplusplus
 
 #include <boost/intrusive_ptr.hpp>
-namespace simgrid {
-namespace smpi {
+namespace simgrid::smpi {
 
 class Colls;
 class Comm;
@@ -31,8 +30,7 @@ class Topo_Graph;
 class Topo_Dist_Graph;
 class Win;
 
-}
-}
+} // namespace simgrid::smpi
 
 using SMPI_Comm                = simgrid::smpi::Comm;
 using SMPI_Datatype            = simgrid::smpi::Datatype;
index eb205de..e315219 100644 (file)
@@ -13,8 +13,7 @@
 #include <limits>
 #include <vector>
 
-namespace simgrid {
-namespace xbt {
+namespace simgrid::xbt {
 
 template<class T, class U> class Extension;
 template<class T>          class Extendable;
@@ -121,7 +120,6 @@ public:
 
 // Initialized with a first element, to save space for void* user data
 template <class T> std::vector<std::function<void(void*)>> Extendable<T>::deleters_{1};
-}
-}
+} // namespace simgrid::xbt
 
 #endif
index 90ffbea..623a35a 100644 (file)
@@ -10,8 +10,7 @@
 #include <string>
 #include <unordered_map>
 
-namespace simgrid {
-namespace xbt {
+namespace simgrid::xbt {
 
 /** @brief a PropertyHolder can be given a set of textual properties
  *
@@ -32,7 +31,6 @@ public:
   template <class Assoc> void set_properties(const Assoc& properties);
 };
 
-} // namespace xbt
-} // namespace simgrid
+} // namespace simgrid::xbt
 
 #endif
index 8e2e857..18a7d6b 100644 (file)
@@ -11,8 +11,7 @@
 
 #include <xbt/automaton.h>
 
-namespace simgrid {
-namespace xbt {
+namespace simgrid::xbt {
 
 /** Add a proposition to an automaton (the C++ way)
  *
@@ -26,6 +25,5 @@ template <class F> xbt_automaton_propositional_symbol_t add_proposition(const_xb
       a, id, [](auto* cb) -> int { return (*(F*)cb)(); }, callback, [](auto* cb) -> void { delete (F*)cb; });
 }
 
-}
-}
+} // namespace simgrid::xbt
 #endif
index cda0da7..c220965 100644 (file)
@@ -17,8 +17,7 @@ SG_BEGIN_DECL
 XBT_PUBLIC void xbt_backtrace_display_current();
 SG_END_DECL
 
-namespace simgrid {
-namespace xbt {
+namespace simgrid::xbt {
 
 class BacktraceImpl;
 /** A backtrace
@@ -38,6 +37,5 @@ public:
   void display() const;
 };
 
-}
-}
+} // namespace simgrid::xbt
 #endif
index 372ec9b..bb5ee91 100644 (file)
@@ -22,8 +22,7 @@
 #include <xbt/sysdep.h>
 #include <xbt/utility.hpp>
 
-namespace simgrid {
-namespace config {
+namespace simgrid::config {
 
 class Config;
 
@@ -140,7 +139,7 @@ void bind_flag(T& value, const char* name, std::initializer_list<const char*> al
  */
 // F is a checker, F : T& -> ()
 template <class T, class F>
-typename std::enable_if_t<std::is_same<void, decltype(std::declval<F>()(std::declval<const T&>()))>::value, void>
+typename std::enable_if_t<std::is_same_v<void, decltype(std::declval<F>()(std::declval<const T&>()))>, void>
 bind_flag(T& value, const char* name, const char* description, F callback)
 {
   declare_flag(name, description, value, std::function<void(const T&)>([&value, callback](const T& val) {
@@ -150,7 +149,7 @@ bind_flag(T& value, const char* name, const char* description, F callback)
 }
 
 template <class T, class F>
-typename std::enable_if_t<std::is_same<void, decltype(std::declval<F>()(std::declval<const T&>()))>::value, void>
+typename std::enable_if_t<std::is_same_v<void, decltype(std::declval<F>()(std::declval<const T&>()))>, void>
 bind_flag(T& value, const char* name, std::initializer_list<const char*> aliases, const char* description, F callback)
 {
   bind_flag(value, name, description, std::move(callback));
@@ -158,8 +157,7 @@ bind_flag(T& value, const char* name, std::initializer_list<const char*> aliases
 }
 
 template <class F>
-typename std::enable_if_t<std::is_same<void, decltype(std::declval<F>()(std::declval<const std::string&>()))>::value,
-                          void>
+typename std::enable_if_t<std::is_same_v<void, decltype(std::declval<F>()(std::declval<const std::string&>()))>, void>
 bind_flag(std::string& value, const char* name, const char* description,
           const std::map<std::string, std::string, std::less<>>& valid_values, F callback)
 {
@@ -175,14 +173,13 @@ bind_flag(std::string& value, const char* name, const char* description,
                    mesg += std::string("Possible values for option ") + name + ":\n";
                  else
                    mesg += "Invalid value '" + val + "' for option " + name + ". Possible values:\n";
-                 for (auto const& kv : valid_values)
-                   mesg += "  - '" + kv.first + "': " + kv.second + (kv.first == value ? "  <=== DEFAULT" : "") + "\n";
+                 for (auto const& [v, descr] : valid_values)
+                   mesg += "  - '" + v + "': " + descr + (v == value ? "  <=== DEFAULT" : "") + "\n";
                  xbt_die("%s", mesg.c_str());
                }));
 }
 template <class F>
-typename std::enable_if_t<std::is_same<void, decltype(std::declval<F>()(std::declval<const std::string&>()))>::value,
-                          void>
+typename std::enable_if_t<std::is_same_v<void, decltype(std::declval<F>()(std::declval<const std::string&>()))>, void>
 bind_flag(std::string& value, const char* name, std::initializer_list<const char*> aliases, const char* description,
           const std::map<std::string, std::string, std::less<>>& valid_values, F callback)
 {
@@ -199,7 +196,7 @@ bind_flag(std::string& value, const char* name, std::initializer_list<const char
  */
 // F is a predicate, F : T const& -> bool
 template <class T, class F>
-typename std::enable_if_t<std::is_same<bool, decltype(std::declval<F>()(std::declval<const T&>()))>::value, void>
+typename std::enable_if_t<std::is_same_v<bool, decltype(std::declval<F>()(std::declval<const T&>()))>, void>
 bind_flag(T& value, const char* name, const char* description, F callback)
 {
   declare_flag(name, description, value, std::function<void(const T&)>([&value, callback](const T& val) {
@@ -325,7 +322,6 @@ XBT_PUBLIC void finalize();
 XBT_PUBLIC void show_aliases();
 XBT_PUBLIC void help();
 
-} // namespace config
-} // namespace simgrid
+} // namespace simgrid::config
 
 #endif
index d0447d3..afb2622 100644 (file)
@@ -10,8 +10,7 @@
 #include <vector>
 #include <xbt/base.h>
 
-namespace simgrid {
-namespace xbt {
+namespace simgrid::xbt {
 
 void path_push(std::string const& str);
 void path_pop();
@@ -38,6 +37,6 @@ public:
 private:
   std::string path_;
 };
-}}
+} // namespace simgrid::xbt
 
 #endif                          /* XBT_FILE_HPP */
index eea2729..9d1b337 100644 (file)
@@ -23,8 +23,7 @@
 #include <utility>
 #include <vector>
 
-namespace simgrid {
-namespace xbt {
+namespace simgrid::xbt {
 
 template <class F> class MainFunction {
   F code_;
@@ -74,12 +73,12 @@ constexpr auto apply(F&& f, Tuple&& t, std::index_sequence<I...>)
  *  @endcode
  **/
 template <class F, class Tuple>
-constexpr auto apply(F&& f, Tuple&& t) -> decltype(
-    simgrid::xbt::bits::apply(std::forward<F>(f), std::forward<Tuple>(t),
-                              std::make_index_sequence<std::tuple_size<typename std::decay_t<Tuple>>::value>()))
+constexpr auto apply(F&& f, Tuple&& t)
+    -> decltype(simgrid::xbt::bits::apply(std::forward<F>(f), std::forward<Tuple>(t),
+                                          std::make_index_sequence<std::tuple_size_v<typename std::decay_t<Tuple>>>()))
 {
   return simgrid::xbt::bits::apply(std::forward<F>(f), std::forward<Tuple>(t),
-                                   std::make_index_sequence<std::tuple_size<typename std::decay_t<Tuple>>::value>());
+                                   std::make_index_sequence<std::tuple_size_v<typename std::decay_t<Tuple>>>());
 }
 
 template<class T> class Task;
@@ -179,7 +178,7 @@ private:
         return code(std::forward<Args>(args)...);
       },
       // Destroy:
-      std::is_trivially_destructible<F>::value ?
+      std::is_trivially_destructible_v<F> ?
       static_cast<destroy_function>(nullptr) :
       [](TaskUnion& buffer) {
         auto* code = reinterpret_cast<F*>(&buffer);
@@ -260,6 +259,5 @@ template <class F, class... Args> auto make_task(F code, Args... args) -> Task<d
   return Task<decltype(code(std::move(args)...))()>(std::move(task));
 }
 
-} // namespace xbt
-} // namespace simgrid
+} // namespace simgrid::xbt
 #endif
index dabdbbe..e2598ed 100644 (file)
@@ -9,8 +9,7 @@
 #include <simgrid/Exception.hpp>
 #include <xbt/log.h>
 
-namespace simgrid {
-namespace xbt {
+namespace simgrid::xbt {
 
 /** Display information about an exception
  *
@@ -23,7 +22,6 @@ XBT_PUBLIC void log_exception(e_xbt_log_priority_t priority, const char* context
 
 XBT_PUBLIC void install_exception_handler();
 
-} // namespace xbt
-} // namespace simgrid
+} // namespace simgrid::xbt
 
-#endif
\ No newline at end of file
+#endif
index 8926b20..dc19907 100644 (file)
@@ -17,8 +17,7 @@
 #include <utility>
 #include <xbt/ex.h>
 
-namespace simgrid {
-namespace xbt {
+namespace simgrid::xbt {
 
 /** A value or an exception (or nothing)
  *
@@ -126,7 +125,6 @@ template <class P, class F> inline void set_promise(P& promise, F&& future)
 {
   fulfill_promise(promise, [&future] { return std::forward<F>(future).get(); });
 }
-}
-}
+} // namespace simgrid::xbt
 
 #endif
index 00f42ea..a5c4c79 100644 (file)
@@ -12,9 +12,7 @@
 #include <random>
 #include <string>
 
-namespace simgrid {
-namespace xbt {
-namespace random {
+namespace simgrid::xbt::random {
 
 /** A random number generator.
  *
@@ -162,8 +160,6 @@ double exponential(double lambda);
  * @param sd Standard deviation of the normal distribution
  */
 double normal(double mean, double sd);
-} // namespace random
-} // namespace xbt
-} // namespace simgrid
+} // namespace simgrid::xbt::random
 
 #endif
index 99eb0b1..47f021e 100644 (file)
@@ -8,8 +8,7 @@
 
 #include <algorithm>
 
-namespace simgrid {
-namespace xbt {
+namespace simgrid::xbt {
 
 /** Describes a contiguous inclusive-exclusive [a,b) range of values */
 template<class T> class Range {
@@ -27,7 +26,6 @@ public:
   bool contain(T const& x) const { return begin_ <= x && end_ > x; }
 };
 
-}
-}
+} // namespace simgrid::xbt
 
 #endif
index 670d851..e6da188 100644 (file)
@@ -15,8 +15,7 @@
 #include <queue>
 #include <unordered_map>
 
-namespace simgrid {
-namespace xbt {
+namespace simgrid::xbt {
 /* To split the file if a unique one is given (specific variable for the other case live in runner()) */
 using ReplayAction = std::vector<std::string>;
 
@@ -26,8 +25,7 @@ using ReplayAction = std::vector<std::string>;
  * xbt_replay_set_tracefile(). If trace_filename is not nullptr, then it's not shared and this trace file is for this
  * actor only */
 XBT_PUBLIC int replay_runner(const char* actor_name, const char* trace_filename = nullptr);
-}
-}
+} // namespace simgrid::xbt
 
 using action_fun = std::function<void(simgrid::xbt::ReplayAction&)>;
 XBT_PUBLIC void xbt_replay_action_register(const char* action_name, const action_fun& function);
index 8b6cf91..70c477f 100644 (file)
@@ -10,8 +10,7 @@
 #include <map>
 #include <utility>
 
-namespace simgrid {
-namespace xbt {
+namespace simgrid::xbt {
 
 template <class S> class signal;
 
@@ -35,15 +34,14 @@ public:
   /** Fire that signal, invoking all callbacks */
   R operator()(P... args) const
   {
-    for (auto const& handler : handlers_)
-      handler.second(args...);
+    for (auto const& [_, callback] : handlers_)
+      callback(args...);
   }
   /** Remove a callback */
   void disconnect(unsigned int id) { handlers_.erase(id); }
   /** Remove all callbacks */
   void disconnect_slots() { handlers_.clear(); }
 };
-}
-}
+} // namespace simgrid::xbt
 
 #endif
index a58d27d..ff9d695 100644 (file)
@@ -12,8 +12,7 @@
 #include <cstdlib>
 #include <string>
 
-namespace simgrid {
-namespace xbt {
+namespace simgrid::xbt {
 
 /** Create a C++ string from a C-style format
  *
@@ -27,6 +26,5 @@ XBT_PUBLIC std::string string_printf(const char* fmt, ...) XBT_ATTRIB_PRINTF(1,
  */
 XBT_PUBLIC std::string string_vprintf(const char* fmt, va_list ap) XBT_ATTRIB_PRINTF(1, 0);
 
-} // namespace xbt
-}
-#endif
\ No newline at end of file
+} // namespace simgrid::xbt
+#endif
index d5620b4..c94eaff 100644 (file)
@@ -11,8 +11,7 @@
 #ifndef SIMGRID_MC_SYSTEM_ERROR_HPP
 #define SIMGRID_MC_SYSTEM_ERROR_HPP
 
-namespace simgrid {
-namespace xbt {
+namespace simgrid::xbt {
 
 /** A `error_category` suitable to be used with `errno`
  *
@@ -82,7 +81,6 @@ std::system_error errno_error(const char* what)
   return std::system_error(errno_code(), what);
 }
 
-}
-}
+} // namespace simgrid::xbt
 
 #endif
index bb599d6..c35be72 100644 (file)
@@ -31,8 +31,7 @@
   }                                                                                                                    \
   enum class EnumType { __VA_ARGS__ } /* defined here to handle trailing semicolon */
 
-namespace simgrid {
-namespace xbt {
+namespace simgrid::xbt {
 
 /** @brief Replacement for C++20's std::type_identity_t
  */
@@ -80,6 +79,5 @@ template <class List, class Elem> inline void intrusive_erase(List& list, Elem&
   list.erase(list.iterator_to(elem));
 }
 
-} // namespace xbt
-} // namespace simgrid
+} // namespace simgrid::xbt
 #endif
index 4207696..dc19f99 100644 (file)
@@ -14,7 +14,7 @@ sonar.sources=src,examples,include,teshsuite
 
 
 # Disable some rules on some files
-sonar.issue.ignore.multicriteria=c1,c2a,c2b,c3,c5a,c5b,c6a,c6b,c7,c8,c9,c10a,c10b,c10c,cex1a,cex1b,cex2a,cex2b,cex3,cex4,cxx17a,cxx17b,cxx17c,cxx17d,cxx17e,cxx17f,cxx17g,f1,p1,s1,s2,s3,s4,s5
+sonar.issue.ignore.multicriteria=c1,c2a,c2b,c3,c5a,c5b,c6a,c6b,c7,c8,c9,c10a,c10b,c10c,cex1a,cex1b,cex2a,cex2b,cex3,cex4,f1,p1,s1,s2,s3,s4,s5
 
 # Pointers should not be cast to integral types
 # But we need that for smpi and other places
@@ -95,30 +95,6 @@ sonar.issue.ignore.multicriteria.cex3.resourceKey=examples/**/*.c
 sonar.issue.ignore.multicriteria.cex4.ruleKey=c:S995
 sonar.issue.ignore.multicriteria.cex4.resourceKey=examples/**/*.c
 
-# Ignore these C++17 rules in public headers, where we still support C++14
-
-# C++17: Concise syntax should be used for concatenatable namespaces
-sonar.issue.ignore.multicriteria.cxx17a.ruleKey=cpp:S5812
-sonar.issue.ignore.multicriteria.cxx17a.resourceKey=include/**/*
-# C++17: "if","switch", and range-based for loop initializer should be used to reduce scope of variables
-sonar.issue.ignore.multicriteria.cxx17b.ruleKey=cpp:S6004
-sonar.issue.ignore.multicriteria.cxx17b.resourceKey=include/**/*.hpp
-# C++17: Structured binding should be used
-sonar.issue.ignore.multicriteria.cxx17c.ruleKey=cpp:S6005
-sonar.issue.ignore.multicriteria.cxx17c.resourceKey=include/**/*.hpp
-# C++17: "std::string_view" should be used to pass a read-only string to a function
-sonar.issue.ignore.multicriteria.cxx17d.ruleKey=cpp:S6009
-sonar.issue.ignore.multicriteria.cxx17d.resourceKey=include/**/*.hpp
-# C++17: Redundant class template arguments should not be used
-sonar.issue.ignore.multicriteria.cxx17e.ruleKey=cpp:S6012
-sonar.issue.ignore.multicriteria.cxx17e.resourceKey=include/**/*.hpp
-# C++17: The "_t" and "_v" version of type traits should be used instead of "::type" and "::value"
-sonar.issue.ignore.multicriteria.cxx17f.ruleKey=cpp:S6020
-sonar.issue.ignore.multicriteria.cxx17f.resourceKey=include/**/*.hpp
-# C++17: "std::scoped_lock" should be used instead of "std::lock_guard"
-sonar.issue.ignore.multicriteria.cxx17g.ruleKey=cpp:S5997
-sonar.issue.ignore.multicriteria.cxx17g.resourceKey=include/**/*.hpp
-
 # "reinterpret_cast" should not be used
 # But we need this to interface C and Fortran
 sonar.issue.ignore.multicriteria.f1.ruleKey=cpp:S3630
index 4a92977..ed817d3 100644 (file)
@@ -348,6 +348,15 @@ static void on_host_creation(s4u::Host const& host)
     root->get_type()->by_name_or_create("MIGRATE_LINK", mpi, mpi);
     mpi->by_name_or_create<StateType>("MIGRATE_STATE");
   }
+
+   if (TRACE_actor_is_enabled()) {
+    auto* host_type = container->get_type();
+    auto* state     = host_type->by_name_or_create<StateType>("HOST_STATE");
+    state->set_calling_container(container);
+    state->add_entity_value("receive", "1 0 0");
+    state->add_entity_value("send", "0 0 1");
+    state->add_entity_value("execute", "0 1 1");
+  }
 }
 
 static void on_action_state_change(kernel::resource::Action const& action,
@@ -490,17 +499,44 @@ void define_callbacks()
     });
     s4u::Actor::on_wake_up_cb(
         [](s4u::Actor const& actor) { Container::by_name(instr_pid(actor))->get_state("ACTOR_STATE")->pop_event(); });
-    s4u::Exec::on_start_cb([](s4u::Exec const&) {
-      Container::by_name(instr_pid(*s4u::Actor::self()))->get_state("ACTOR_STATE")->push_event("execute");
+
+    s4u::Exec::on_start_cb([](s4u::Exec const& e) {
+      std::string pid = instr_pid(*s4u::Actor::self());
+      if (pid == "-0") //Exec is launched directly by Maestro, use the host as container
+        Container::by_name(e.get_host()->get_name())->get_state("HOST_STATE")->push_event("execute");
+      else
+        Container::by_name(pid)->get_state("ACTOR_STATE")->push_event("execute");
     });
-    s4u::Activity::on_completion_cb([](const s4u::Activity&) {
-      Container::by_name(instr_pid(*s4u::Actor::self()))->get_state("ACTOR_STATE")->pop_event();
+
+    s4u::Exec::on_completion_cb([](const s4u::Exec& e) {
+      std::string pid = instr_pid(*s4u::Actor::self());
+      if (pid == "-0") //Exec is launched directly by Maestro, use the host as container
+        Container::by_name(e.get_host()->get_name())->get_state("HOST_STATE")->pop_event();
+      else
+        Container::by_name(pid)->get_state("ACTOR_STATE")->pop_event();
+    });
+
+    s4u::Comm::on_completion_cb([](const s4u::Comm& c) {
+      std::string pid = instr_pid(*s4u::Actor::self());
+      if (pid == "-0") { //Comm is launched directly by Maestro, use the host as container
+          Container::by_name(c.get_source()->get_name())->get_state("HOST_STATE")->pop_event();
+          Container::by_name(c.get_destination()->get_name())->get_state("HOST_STATE")->pop_event();
+      } else
+        Container::by_name(pid)->get_state("ACTOR_STATE")->pop_event();
     });
-    s4u::Comm::on_send_cb([](s4u::Comm const&) {
-      Container::by_name(instr_pid(*s4u::Actor::self()))->get_state("ACTOR_STATE")->push_event("send");
+    s4u::Comm::on_send_cb([](s4u::Comm const& c) {
+      std::string pid = instr_pid(*s4u::Actor::self());
+      if (pid == "-0") //Comm is launched directly by Maestro, use the host as container
+        Container::by_name(c.get_source()->get_name())->get_state("HOST_STATE")->push_event("send");
+      else
+        Container::by_name(pid)->get_state("ACTOR_STATE")->push_event("send");
     });
-    s4u::Comm::on_recv_cb([](s4u::Comm const&) {
-      Container::by_name(instr_pid(*s4u::Actor::self()))->get_state("ACTOR_STATE")->push_event("receive");
+    s4u::Comm::on_recv_cb([](s4u::Comm const& c) {
+      std::string pid = instr_pid(*s4u::Actor::self());
+      if (pid == "-0") //Comm is launched directly by Maestro, use the host as container
+        Container::by_name(c.get_destination()->get_name())->get_state("HOST_STATE")->push_event("receive");
+      else
+        Container::by_name(pid)->get_state("ACTOR_STATE")->push_event("receive");
     });
     s4u::Actor::on_host_change_cb(on_actor_host_change);
   }
@@ -511,7 +547,7 @@ void define_callbacks()
           ->get_state("MPI_STATE")
           ->push_event("computing", new CpuTIData("compute", exec.get_cost()));
     });
-    s4u::Activity::on_completion_cb([](const s4u::Activity&) {
+    s4u::Exec::on_completion_cb([](const s4u::Exec&) {
       Container::by_name("rank-" + std::to_string(s4u::Actor::self()->get_pid()))->get_state("MPI_STATE")->pop_event();
     });
   }
index a754fd5..d6950bf 100644 (file)
@@ -85,7 +85,7 @@ template <typename C> std::string BmfSolver::debug_vector(const C& container) co
 {
   std::stringstream debug;
   std::copy(container.begin(), container.end(),
-            std::ostream_iterator<typename std::remove_reference<decltype(container)>::type::value_type>(debug, " "));
+            std::ostream_iterator<typename std::remove_reference_t<decltype(container)>::value_type>(debug, " "));
   return debug.str();
 }
 
index ea2fa1c..dab4cad 100644 (file)
@@ -79,17 +79,14 @@ static void add_active_exec(s4u::Exec const& task)
   }
 }
 
-static void remove_active_exec(s4u::Activity const& task)
+static void remove_active_exec(s4u::Exec const& exec)
 {
-  const auto* exec = dynamic_cast<s4u::Exec const*>(&task);
-  if (exec == nullptr)
+  if (not exec.is_assigned())
     return;
-  if (not exec->is_assigned())
-    return;
-  const s4u::VirtualMachine* vm = dynamic_cast<s4u::VirtualMachine*>(exec->get_host());
+  const s4u::VirtualMachine* vm = dynamic_cast<s4u::VirtualMachine*>(exec.get_host());
   if (vm != nullptr) {
     VirtualMachineImpl* vm_impl = vm->get_vm_impl();
-    for (int i = 1; i <= exec->get_thread_count(); i++)
+    for (int i = 1; i <= exec.get_thread_count(); i++)
       vm_impl->remove_active_exec();
     vm_impl->update_action_weight();
   }
@@ -125,7 +122,7 @@ VMModel::VMModel(const std::string& name) : HostModel(name)
 {
   s4u::Host::on_state_change_cb(host_state_change);
   s4u::Exec::on_start_cb(add_active_exec);
-  s4u::Activity::on_completion_cb(remove_active_exec);
+  s4u::Exec::on_completion_cb(remove_active_exec);
   s4u::Activity::on_resume_cb(add_active_activity);
   s4u::Activity::on_suspend_cb(remove_active_activity);
 }
index d536282..f68c1f5 100644 (file)
@@ -12,7 +12,7 @@
 #include "src/kernel/resource/NetworkModel.hpp"
 #include "src/kernel/resource/StandardLinkImpl.hpp"
 
-namespace simgrid ::kernel::resource {
+namespace simgrid::kernel::resource {
 
 class NetworkNS3Model : public NetworkModel {
 public:
index 11fd3b4..8019943 100644 (file)
@@ -17,7 +17,7 @@
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ker_routing_torus, ker_platform, "Kernel Torus Routing");
 
 namespace simgrid {
-namespace kernel ::routing {
+namespace kernel::routing {
 
 void TorusZone::create_torus_links(unsigned long id, int rank, unsigned long position)
 {
index 2900710..16efc93 100644 (file)
@@ -37,7 +37,7 @@ public:
   std::size_t get_buffer_size() const { return sizeof(T); }
   operator T() const
   {
-    static_assert(std::is_trivial<T>::value, "Cannot convert non trivial type");
+    static_assert(std::is_trivial_v<T>, "Cannot convert non trivial type");
     return *get_buffer();
   }
   void clear() { std::memset(&buffer, 0, sizeof buffer); }
index 05e1d72..8de5bc9 100644 (file)
 
 #include "src/mc/sosp/PageStore.hpp"
 
-using simgrid::mc::PageStore;
-
 /***********************************/
 // a class to hold the variable used in the test cases
-class helper_tests {
-public:
-  static std::size_t pagesize;
-  static std::unique_ptr<PageStore> store;
-  static void* data;
-  static std::array<size_t, 4> pageno;
-  static int value;
+class pstore_test_helper {
+  const size_t pagesize = getpagesize();
+  simgrid::mc::PageStore store{50};
+  std::byte* data =
+      static_cast<std::byte*>(mmap(nullptr, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0));
+  std::array<size_t, 4> pageno = {0, 0, 0, 0};
+  int value                    = 0;
+
+  void new_content(std::byte* buf, size_t size);
 
+public:
   // member functions used by the test suite(s)
-  static void Init();
-  static void store_page_once();
-  static void store_same_page();
-  static void store_new_page();
-  static void unref_pages();
-  static void reallocate_page();
-
-  static void new_content(void* buf, std::size_t size);
+  void init();
+  void store_page_once();
+  void store_same_page();
+  void store_new_page();
+  void unref_pages();
+  void reallocate_page();
 };
 
-// static member data initialization
-std::size_t helper_tests::pagesize             = 0;
-std::unique_ptr<PageStore> helper_tests::store = nullptr;
-void* helper_tests::data                       = nullptr;
-std::array<size_t, 4> helper_tests::pageno     = {{0, 0, 0, 0}};
-int helper_tests::value                        = 0;
-
-void helper_tests::Init()
+void pstore_test_helper::init()
 {
-  pagesize = (size_t)getpagesize();
-  store    = std::make_unique<simgrid::mc::PageStore>(50);
-  data     = mmap(nullptr, getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-  REQUIRE(store->size() == 0);
+  REQUIRE(data != nullptr);
+  REQUIRE(store.size() == 0);
 }
 
-void helper_tests::store_page_once()
+void pstore_test_helper::store_page_once()
 {
   new_content(data, pagesize);
-  pageno[0] = store->store_page(data);
-  REQUIRE(store->get_ref(pageno[0]) == 1);
-  const void* copy = store->get_page(pageno[0]);
+  pageno[0] = store.store_page(data);
+  REQUIRE(store.get_ref(pageno[0]) == 1);
+  const auto* copy = store.get_page(pageno[0]);
   REQUIRE(::memcmp(data, copy, pagesize) == 0); // The page data should be the same
-  REQUIRE(store->size() == 1);
+  REQUIRE(store.size() == 1);
 }
 
-void helper_tests::store_same_page()
+void pstore_test_helper::store_same_page()
 {
-  pageno[1] = store->store_page(data);
+  pageno[1] = store.store_page(data);
   REQUIRE(pageno[0] == pageno[1]); // Page should be the same
-  REQUIRE(store->get_ref(pageno[0]) == 2);
-  REQUIRE(store->size() == 1);
+  REQUIRE(store.get_ref(pageno[0]) == 2);
+  REQUIRE(store.size() == 1);
 }
 
-void helper_tests::store_new_page()
+void pstore_test_helper::store_new_page()
 {
   new_content(data, pagesize);
-  pageno[2] = store->store_page(data);
+  pageno[2] = store.store_page(data);
   REQUIRE(pageno[0] != pageno[2]); // The new page should be different
-  REQUIRE(store->size() == 2);
+  REQUIRE(store.size() == 2);
 }
 
-void helper_tests::unref_pages()
+void pstore_test_helper::unref_pages()
 {
-  store->unref_page(pageno[0]);
-  REQUIRE(store->get_ref(pageno[0]) == 1);
-  REQUIRE(store->size() == 2);
+  store.unref_page(pageno[0]);
+  REQUIRE(store.get_ref(pageno[0]) == 1);
+  REQUIRE(store.size() == 2);
 
-  store->unref_page(pageno[1]);
-  REQUIRE(store->size() == 1);
+  store.unref_page(pageno[1]);
+  REQUIRE(store.size() == 1);
 }
 
-void helper_tests::reallocate_page()
+void pstore_test_helper::reallocate_page()
 {
   new_content(data, pagesize);
-  pageno[3] = store->store_page(data);
+  pageno[3] = store.store_page(data);
   REQUIRE(pageno[0] == pageno[3]); // The old page should be reused
-  REQUIRE(store->get_ref(pageno[3]) == 1);
-  REQUIRE(store->size() == 2);
+  REQUIRE(store.get_ref(pageno[3]) == 1);
+  REQUIRE(store.size() == 2);
 }
 
-void helper_tests::new_content(void* buf, std::size_t size)
+void pstore_test_helper::new_content(std::byte* buf, size_t size)
 {
   value++;
-  ::memset(buf, value, size);
+  std::fill_n(buf, size, static_cast<std::byte>(value));
 }
 
 TEST_CASE("MC page store, used during checkpoint", "MC::PageStore")
 {
-  helper_tests::Init();
+  pstore_test_helper pstore_test;
+  pstore_test.init();
+
   INFO("Store page once");
-  helper_tests::store_page_once();
+  pstore_test.store_page_once();
 
   INFO("Store the same page");
-  helper_tests::store_same_page();
+  pstore_test.store_same_page();
 
   INFO("Store a new page");
-  helper_tests::store_new_page();
+  pstore_test.store_new_page();
 
   INFO("Unref pages");
-  helper_tests::unref_pages();
+  pstore_test.unref_pages();
 
   INFO("Reallocate pages");
-  helper_tests::reallocate_page();
+  pstore_test.reallocate_page();
 }
index d16b6ca..abf1dd0 100644 (file)
@@ -12,8 +12,6 @@
 #include <sys/mman.h>
 #include <xbt/random.hpp>
 
-/**************** Class BOOST_tests *************************/
-using simgrid::mc::Region;
 class snap_test_helper {
   simgrid::mc::PageStore page_store_{500};
   simgrid::mc::RemoteProcessMemory memory_{getpid(), nullptr};
@@ -22,11 +20,13 @@ class snap_test_helper {
     size_t size;
     std::byte* src;
     std::byte* dstn;
-    std::unique_ptr<Region> region0;
-    std::unique_ptr<Region> region;
+    std::unique_ptr<simgrid::mc::Region> region0;
+    std::unique_ptr<simgrid::mc::Region> region;
   };
   prologue_return prologue(int n); // common to the below 5 fxs
 
+  static void init_memory(std::byte* mem, size_t size);
+
 public:
   void read_whole_region();
   void read_region_parts();
@@ -34,7 +34,6 @@ public:
   void compare_region_parts();
   void read_pointer();
 
-  static void init_memory(std::byte* mem, size_t size);
   static void basic_requirements();
 };
 
index 0a5ac58..5e15581 100644 (file)
@@ -289,14 +289,11 @@ public:
       if (activity.get_host() == get_host())
         pre_task();
     });
-    simgrid::s4u::Activity::on_completion_cb([this](simgrid::s4u::Activity const& activity) {
-      const auto* exec = dynamic_cast<simgrid::s4u::Exec const*>(&activity);
-      if (exec == nullptr) // Only Execs are concerned here
-        return;
+    simgrid::s4u::Exec::on_completion_cb([this](simgrid::s4u::Exec const& exec) {
       // For more than one host (not yet supported), we can access the host via
       // simcalls_.front()->issuer->get_iface()->get_host()
-      if (exec->get_host() == get_host() && iteration_running) {
-        comp_timer += exec->get_finish_time() - exec->get_start_time();
+      if (exec.get_host() == get_host() && iteration_running) {
+        comp_timer += exec.get_finish_time() - exec.get_start_time();
       }
     });
     // FIXME I think that this fires at the same time for all hosts, so when the src sends something,
index 6479b3a..9eb3d96 100644 (file)
@@ -247,12 +247,9 @@ void sg_host_load_plugin_init()
       XBT_WARN("HostLoad plugin currently does not support executions on several hosts");
     }
   });
-  simgrid::s4u::Activity::on_completion_cb([](simgrid::s4u::Activity const& activity) {
-    const auto* exec = dynamic_cast<simgrid::s4u::Exec const*>(&activity);
-    if (exec == nullptr) // Only Execs are concerned here
-      return;
-    if (exec->get_host_number() == 1) { // We only run on one host
-      simgrid::s4u::Host* host               = exec->get_host();
+  simgrid::s4u::Exec::on_completion_cb([](simgrid::s4u::Exec const& exec) {
+    if (exec.get_host_number() == 1) { // We only run on one host
+      simgrid::s4u::Host* host = exec.get_host();
       if (const auto* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host))
         host = vm->get_pm();
       xbt_assert(host != nullptr);
index 32ed866..9092fba 100644 (file)
@@ -2,6 +2,7 @@
 #include <simgrid/plugins/operation.hpp>
 #include <simgrid/s4u/Comm.hpp>
 #include <simgrid/s4u/Exec.hpp>
+#include <simgrid/s4u/Io.hpp>
 #include <simgrid/simix.hpp>
 
 #include "src/simgrid/module.hpp"
@@ -100,8 +101,8 @@ void Operation::complete()
     working_ = false;
     count_++;
   });
-  if (end_func_)
-    end_func_(this);
+  for (auto end_func : end_func_handlers_)
+    end_func(this);
   Operation::on_end(this);
   for (auto const& op : successors_)
     op->receive(this);
@@ -119,8 +120,14 @@ void Operation::init()
     return;
   Operation::inited_                      = true;
   ExtendedAttributeActivity::EXTENSION_ID = simgrid::s4u::Activity::extension_create<ExtendedAttributeActivity>();
-  simgrid::s4u::Activity::on_completion_cb([](simgrid::s4u::Activity const& activity) {
-    activity.extension<ExtendedAttributeActivity>()->operation_->complete();
+  simgrid::s4u::Exec::on_completion_cb([](simgrid::s4u::Exec const& exec) {
+    exec.extension<ExtendedAttributeActivity>()->operation_->complete();
+  });
+  simgrid::s4u::Comm::on_completion_cb([](simgrid::s4u::Comm const& comm) {
+    comm.extension<ExtendedAttributeActivity>()->operation_->complete();
+  });
+  simgrid::s4u::Io::on_completion_cb([](simgrid::s4u::Io const& io) {
+    io.extension<ExtendedAttributeActivity>()->operation_->complete();
   });
 }
 
@@ -188,7 +195,7 @@ void Operation::remove_all_successors()
  */
 void Operation::on_this_start(const std::function<void(Operation*)>& func)
 {
-  simgrid::kernel::actor::simcall_answered([this, &func] { start_func_ = func; });
+  simgrid::kernel::actor::simcall_answered([this, &func] { start_func_handlers_.push_back(func); });
 }
 
 /** @ingroup plugin_operation
@@ -198,7 +205,7 @@ void Operation::on_this_start(const std::function<void(Operation*)>& func)
  */
 void Operation::on_this_end(const std::function<void(Operation*)>& func)
 {
-  simgrid::kernel::actor::simcall_answered([this, &func] { end_func_ = func; });
+  simgrid::kernel::actor::simcall_answered([this, &func] { end_func_handlers_.push_back(func); });
 }
 
 /** @ingroup plugin_operation
@@ -237,8 +244,8 @@ ExecOpPtr ExecOp::init(const std::string& name, double flops, s4u::Host* host)
  */
 void ExecOp::execute()
 {
-  if (start_func_)
-    start_func_(this);
+  for (auto start_func : start_func_handlers_)
+    start_func(this);
   Operation::on_start(this);
   kernel::actor::simcall_answered([this] {
     working_      = true;
@@ -302,8 +309,8 @@ CommOpPtr CommOp::init(const std::string& name, double bytes, s4u::Host* source,
  */
 void CommOp::execute()
 {
-  if (start_func_)
-    start_func_(this);
+  for (auto start_func : start_func_handlers_)
+    start_func(this);
   Operation::on_start(this);
   kernel::actor::simcall_answered([this] {
     working_      = true;
@@ -347,6 +354,76 @@ CommOpPtr CommOp::set_bytes(double bytes)
   return this;
 }
 
+/**
+ *  @brief Default constructor.
+ */
+IoOp::IoOp(const std::string& name) : Operation(name) {}
+
+/** @ingroup plugin_operation
+ *  @brief Smart Constructor.
+ */
+IoOpPtr IoOp::init(const std::string& name)
+{
+  return IoOpPtr(new IoOp(name));
+}
+
+/** @ingroup plugin_operation
+ *  @brief Smart Constructor.
+ */
+IoOpPtr IoOp::init(const std::string& name, double bytes, s4u::Disk* disk, s4u::Io::OpType type)
+{
+  return init(name)->set_bytes(bytes)->set_disk(disk)->set_op_type(type);
+}
+
+/** @ingroup plugin_operation
+ *  @param disk The disk to set.
+ *  @brief Set a new disk.
+ */
+IoOpPtr IoOp::set_disk(s4u::Disk* disk)
+{
+  kernel::actor::simcall_answered([this, disk] { disk_ = disk; });
+  return this;
+}
+
+/** @ingroup plugin_operation
+ *  @param bytes The amount of bytes to set.
+ */
+IoOpPtr IoOp::set_bytes(double bytes)
+{
+  kernel::actor::simcall_answered([this, bytes] { amount_ = bytes; });
+  return this;
+}
+
+/** @ingroup plugin_operation
+ *  @param bytes The amount of bytes to set.
+ */
+IoOpPtr IoOp::set_op_type(s4u::Io::OpType type)
+{
+  kernel::actor::simcall_answered([this, type] { type_ = type; });
+  return this;
+}
+
+void IoOp::execute()
+{
+  for (auto start_func : start_func_handlers_)
+    start_func(this);
+  Operation::on_start(this);
+  kernel::actor::simcall_answered([this] {
+    working_      = true;
+    queued_execs_ = std::max(queued_execs_ - 1, 0);
+  });
+  s4u::IoPtr io = s4u::Io::init();
+  io->set_name(name_);
+  io->set_size(amount_);
+  io->set_disk(disk_);
+  io->set_op_type(type_);
+  io->start();
+  io->extension_set(new ExtendedAttributeActivity());
+  io->extension<ExtendedAttributeActivity>()->operation_ = this;
+  kernel::actor::simcall_answered([this, io] { current_activity_ = io; });
+}
+
+
 } // namespace simgrid::plugins
 
 simgrid::xbt::Extension<simgrid::s4u::Activity, simgrid::plugins::ExtendedAttributeActivity>
index 0f90d30..8160068 100644 (file)
@@ -88,7 +88,7 @@ static void on_exec_creation(simgrid::s4u::Exec const& e)
   }
 }
 
-static void on_exec_completion(const simgrid::s4u::Activity& e)
+static void on_exec_completion(const simgrid::s4u::Exec& e)
 {
   const auto* exec = dynamic_cast<simgrid::kernel::activity::ExecImpl*>(e.get_impl());
   if (exec == nullptr)
@@ -113,7 +113,7 @@ void sg_vm_dirty_page_tracking_init()
         simgrid::kernel::resource::VirtualMachineImpl::extension_create<DirtyPageTrackingExt>();
     simgrid::s4u::VirtualMachine::on_creation_cb(&on_virtual_machine_creation);
     simgrid::s4u::Exec::on_start_cb(&on_exec_creation);
-    simgrid::s4u::Activity::on_completion_cb(&on_exec_completion);
+    simgrid::s4u::Exec::on_completion_cb(&on_exec_completion);
   }
 }
 
index 90ddcf7..78768d3 100644 (file)
@@ -25,7 +25,6 @@ template class xbt::Extendable<s4u::Activity>;
 namespace s4u {
 
 xbt::signal<void(Activity&)> Activity::on_veto;
-xbt::signal<void(Activity const&)> Activity::on_completion;
 xbt::signal<void(Activity const&)> Activity::on_suspend;
 xbt::signal<void(Activity const&)> Activity::on_resume;
 
index 6ec1ecd..408d1a3 100644 (file)
@@ -304,6 +304,8 @@ Comm* Comm::do_start()
     xbt_assert(src_buff_ == nullptr && dst_buff_ == nullptr,
                "Direct host-to-host communications cannot carry any data.");
     XBT_DEBUG("host-to-host Comm. Pimpl already created and set, just start it.");
+    on_send(*this);
+    on_recv(*this);
     kernel::actor::simcall_answered([this] {
       pimpl_->set_state(kernel::activity::State::READY);
       boost::static_pointer_cast<kernel::activity::CommImpl>(pimpl_)->start();
index 93ca639..c743864 100644 (file)
@@ -39,7 +39,7 @@ template <class T> inline void hash_combine(std::size_t& seed, T const& v)
 }
 
 // Recursive template code derived from Matthieu M.
-template <class Tuple, size_t Index = std::tuple_size<Tuple>::value - 1> class HashValueImpl {
+template <class Tuple, size_t Index = std::tuple_size_v<Tuple> - 1> class HashValueImpl {
 public:
   static void apply(size_t& seed, Tuple const& tuple)
   {
index b229d70..fa1e49d 100644 (file)
@@ -13,12 +13,9 @@ int main(int argc, char** argv)
   xbt_assert(argc > 1, "Usage: %s platform_file\n\nExample: %s two_clusters.xml", argv[0], argv[0]);
   engine.load_platform(argv[1]);
 
-  simgrid::s4u::Activity::on_completion_cb([](simgrid::s4u::Activity const& activity) {
-    const auto* exec = dynamic_cast<simgrid::s4u::Exec const*>(&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 */