Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge pull request #200 from Takishipp/clear_fct
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Mon, 17 Jul 2017 23:41:10 +0000 (01:41 +0200)
committerGitHub <noreply@github.com>
Mon, 17 Jul 2017 23:41:10 +0000 (01:41 +0200)
Replace a function by its contents

122 files changed:
.gitignore
examples/java/dht/chord/Node.java
examples/msg/CMakeLists.txt
examples/msg/README.doc
examples/msg/app-pingpong/app-pingpong.c
examples/msg/energy-consumption/energy-consumption.c
examples/msg/energy-onoff/energy-onoff.c
examples/msg/energy-pstate/energy-pstate.c
examples/msg/io-file/io-file.c
examples/msg/io-file/io-file.tesh
examples/msg/plugin-hostload/plugin-hostload.c
examples/s4u/CMakeLists.txt
examples/s4u/README.doc
examples/s4u/app-pingpong/s4u_app-pingpong.cpp [new file with mode: 0644]
examples/s4u/app-pingpong/s4u_app-pingpong.tesh [new file with mode: 0644]
examples/s4u/plugin-hostload/s4u_plugin-hostload.cpp [new file with mode: 0644]
examples/s4u/plugin-hostload/s4u_plugin-hostload.tesh [new file with mode: 0644]
include/simgrid/modelchecker.h
include/simgrid/msg.h
include/simgrid/s4u/Actor.hpp
include/simgrid/s4u/Comm.hpp
include/simgrid/s4u/ConditionVariable.hpp
include/simgrid/s4u/File.hpp
include/simgrid/simix.h
include/xbt/base.h
include/xbt/function_types.h
include/xbt/functional.hpp
src/bindings/java/jmsg_host.cpp
src/bindings/java/jmsg_process.cpp
src/bindings/java/org/simgrid/msg/Process.java
src/include/surf/surf.h
src/mc/AddressSpace.hpp
src/mc/ChunkedData.hpp
src/mc/DwarfExpression.hpp
src/mc/ModelChecker.cpp
src/mc/ModelChecker.hpp
src/mc/ObjectInformation.hpp
src/mc/RegionSnapshot.cpp
src/mc/Session.cpp
src/mc/VisitedState.cpp
src/mc/checker/CommunicationDeterminismChecker.hpp
src/mc/checker/LivenessChecker.cpp
src/mc/checker/simgrid_mc.cpp
src/mc/compare.cpp
src/mc/mc_base.cpp
src/mc/mc_base.h
src/mc/mc_checkpoint.cpp
src/mc/mc_client_api.cpp
src/mc/mc_comm_pattern.cpp
src/mc/mc_comm_pattern.hpp [moved from src/mc/mc_comm_pattern.h with 78% similarity]
src/mc/mc_dwarf.cpp
src/mc/mc_forward.hpp
src/mc/mc_global.cpp
src/mc/mc_page_snapshot.cpp
src/mc/mc_record.cpp
src/mc/mc_request.cpp
src/mc/mc_request.h
src/mc/mc_smx.cpp
src/mc/mc_smx.h
src/mc/mc_snapshot.cpp
src/mc/mc_snapshot.h
src/mc/mc_state.cpp
src/mc/mc_unw.cpp
src/mc/mc_unw.h
src/mc/mc_unw_vmread.cpp
src/mc/remote/Client.cpp
src/mc/remote/Client.hpp
src/mc/remote/RemoteClient.cpp [moved from src/mc/Process.cpp with 72% similarity]
src/mc/remote/RemoteClient.hpp [moved from src/mc/Process.hpp with 75% similarity]
src/mc/remote/mc_protocol.h
src/msg/msg_host.cpp
src/msg/msg_io.cpp
src/msg/msg_vm.cpp
src/plugins/vm/VirtualMachineImpl.cpp
src/plugins/vm/VirtualMachineImpl.hpp
src/s4u/s4u_file.cpp
src/s4u/s4u_storage.cpp
src/simix/libsmx.cpp
src/simix/popping_accessors.h
src/simix/popping_bodies.cpp
src/simix/popping_generated.cpp
src/simix/simcalls.in
src/simix/smx_global.cpp
src/simix/smx_io.cpp
src/simix/smx_io_private.h
src/smpi/smpi_comm.cpp
src/surf/HostImpl.hpp
src/surf/StorageImpl.cpp
src/surf/StorageImpl.hpp
src/surf/maxmin.cpp
src/surf/storage_n11.cpp
src/surf/storage_n11.hpp
src/surf/surf_c_bindings.cpp
src/surf/surf_interface.cpp
src/surf/xml/platf.hpp
src/surf/xml/surfxml_sax_cb.cpp
src/xbt/cunit.cpp
src/xbt/dynar.cpp
src/xbt/memory_map.cpp
src/xbt/mmalloc/mfree.c
src/xbt/mmalloc/mm_module.c
src/xbt/xbt_str.cpp
teshsuite/mc/dwarf-expression/dwarf-expression.cpp
teshsuite/mc/dwarf/dwarf.cpp
teshsuite/msg/CMakeLists.txt
teshsuite/msg/actions-comm/actions-comm.c [moved from examples/msg/actions-comm/actions-comm.c with 59% similarity]
teshsuite/msg/actions-comm/actions-comm.tesh [moved from examples/msg/actions-comm/actions-comm.tesh with 100% similarity]
teshsuite/msg/actions-comm/actions-comm.txt [moved from examples/msg/actions-comm/actions-comm.txt with 100% similarity]
teshsuite/msg/actions-comm/actions-comm_d.xml [moved from examples/msg/actions-comm/actions-comm_d.xml with 100% similarity]
teshsuite/msg/actions-comm/actions-comm_split_d.xml [moved from examples/msg/actions-comm/actions-comm_split_d.xml with 100% similarity]
teshsuite/msg/actions-comm/actions-comm_split_p0.txt [moved from examples/msg/actions-comm/actions-comm_split_p0.txt with 100% similarity]
teshsuite/msg/actions-comm/actions-comm_split_p1.txt [moved from examples/msg/actions-comm/actions-comm_split_p1.txt with 100% similarity]
teshsuite/msg/actions-storage/actions-storage.c [moved from examples/msg/actions-storage/actions-storage.c with 62% similarity]
teshsuite/msg/actions-storage/actions-storage.tesh [moved from examples/msg/actions-storage/actions-storage.tesh with 100% similarity]
teshsuite/msg/actions-storage/actions-storage.txt [moved from examples/msg/actions-storage/actions-storage.txt with 100% similarity]
teshsuite/msg/actions-storage/actions-storage_d.xml [moved from examples/msg/actions-storage/actions-storage_d.xml with 100% similarity]
teshsuite/surf/lmm_usage/lmm_usage.cpp
teshsuite/surf/maxmin_bench/maxmin_bench.cpp
teshsuite/surf/surf_usage2/surf_usage2.cpp
teshsuite/xbt/heap_bench/heap_bench.c
teshsuite/xbt/log_large/log_large.c
tools/cmake/DefinePackages.cmake

index 60839f9..c054e5b 100644 (file)
@@ -189,10 +189,12 @@ examples/msg/trace-process-migration/trace-process-migration
 examples/msg/trace-platform/trace-platform
 examples/msg/trace-host-user-variables/trace-host-user-variables
 examples/s4u/app-masterworker/s4u_app-masterworker
+examples/s4u/app-pingpong/s4u_app-pingpong
 examples/s4u/app-token-ring/s4u_app-token-ring
 examples/s4u/actions-comm/s4u_actions-comm
 examples/s4u/actions-storage/s4u_actions-storage
 examples/s4u/actor-create/s4u_actor-create
+examples/s4u/actor-daemon/s4u_actor-daemon
 examples/s4u/actor-kill/s4u_actor-kill
 examples/s4u/actor-migration/s4u_actor-migration
 examples/s4u/actor-suspend/s4u_actor-suspend
@@ -1052,6 +1054,7 @@ teshsuite/smpi/type-struct/type-struct
 teshsuite/smpi/type-vector/type-vector
 teshsuite/s4u/actor/actor
 teshsuite/s4u/comm-pt2pt/comm-pt2pt
+teshsuite/s4u/comm-waitany/comm-waitany
 teshsuite/s4u/concurrent_rw/concurrent_rw
 teshsuite/s4u/host_on_off_wait/host_on_off_wait
 teshsuite/s4u/listen_async/listen_async
index 87c4e50..f29ead5 100644 (file)
@@ -58,8 +58,8 @@ public class Node extends Process {
       create();
       joinSuccess = true;
     } else {
-      int knownId = Integer.valueOf(args[1]);
-      deadline = Integer.valueOf(args[3]);
+      int knownId = Integer.parseInt(args[1]);
+      deadline = Integer.parseInt(args[3]);
       Msg.debug("Hey! Let's join the system with the id " + id + ".");
 
       joinSuccess = join(knownId);
@@ -202,7 +202,6 @@ public class Node extends Process {
       }
       catch (MsgException e) {
         commReceive = null;
-        stop = true;
       }
     }
     catch (MsgException e) {
index bde4dc9..ca06ab3 100644 (file)
@@ -1,5 +1,5 @@
 # C examples
-foreach(x actions-comm actions-storage app-masterworker app-pingpong app-token-ring async-wait async-waitall 
+foreach(x app-masterworker app-pingpong app-token-ring async-wait async-waitall 
           async-waitany cloud-capping cloud-masterworker cloud-migration cloud-simple cloud-two-tasks
           dht-pastry energy-consumption energy-onoff energy-pstate energy-ptask energy-vm platform-failures 
           io-file io-remote io-storage task-priority 
@@ -51,17 +51,13 @@ foreach (file answer dht-kademlia node routing_table task)
   set(examples_src  ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/${file}.c  ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/${file}.h)
 endforeach()
 
-foreach (file actions-comm actions-storage app-bittorrent app-chainsend app-masterworker app-pingpong async-wait
+foreach (file app-bittorrent app-chainsend app-masterworker app-pingpong async-wait
          async-waitall async-waitany dht-kademlia dht-pastry io-remote platform-properties process-yield 
          task-priority)
   set(xml_files    ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/${file}/${file}_d.xml)
 endforeach()
 
-set(txt_files    ${txt_files}     ${CMAKE_CURRENT_SOURCE_DIR}/README.doc
-                                  ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/actions-comm.txt
-                                  ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/actions-comm_split_p0.txt
-                                  ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/actions-comm_split_p1.txt
-                                  ${CMAKE_CURRENT_SOURCE_DIR}/actions-storage/actions-storage.txt          PARENT_SCOPE)
+set(txt_files    ${txt_files}     ${CMAKE_CURRENT_SOURCE_DIR}/README.doc          PARENT_SCOPE)
 set(bin_files    ${bin_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/generate.py
                                   ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/generate.py
                                   ${CMAKE_CURRENT_SOURCE_DIR}/dht-pastry/generate.py                       PARENT_SCOPE)
@@ -74,8 +70,7 @@ set(tesh_files   ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/app
                                   ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/app-masterworker-multicore.tesh
                                   ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/app-masterworker-vivaldi.tesh
                                   ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/network-ns3.tesh                 PARENT_SCOPE)
-set(xml_files    ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/actions-comm_split_d.xml
-                                  ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/app-masterworker-multicore_d.xml
+set(xml_files    ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/app-masterworker-multicore_d.xml
                                   ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/app-masterworker-vivaldi_d.xml
                                   ${CMAKE_CURRENT_SOURCE_DIR}/async-wait/async-wait2_d.xml
                                   ${CMAKE_CURRENT_SOURCE_DIR}/async-wait/async-wait3_d.xml
@@ -94,7 +89,7 @@ set(xml_files    ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/actio
                                   ${CMAKE_CURRENT_SOURCE_DIR}/process-startkilltime/start_d.xml
                                   ${CMAKE_CURRENT_SOURCE_DIR}/process-startkilltime/start_kill_d.xml       PARENT_SCOPE)
 
-foreach(x actions-comm actions-storage app-bittorrent app-chainsend app-masterworker app-pingpong app-token-ring
+foreach(x app-bittorrent app-chainsend app-masterworker app-pingpong app-token-ring
           async-wait async-waitall async-waitany cloud-capping cloud-masterworker cloud-migration cloud-simple 
           cloud-two-tasks dht-pastry dht-kademlia platform-failures io-file io-remote io-storage task-priority 
           process-create process-daemon process-join process-kill process-migration process-startkilltime process-suspend process-yield
index 56533bc..0e5654a 100644 (file)
@@ -14,17 +14,16 @@ documentation, but it should remain readable directly.
   - @ref msg_ex_models
     - @ref msg_ex_ns3
     - @ref msg_ex_io
-  - @ref msg_ex_actions
   - @ref msg_ex_apps
   - @ref msg_ex_misc
-                   
+
 @section msg_ex_basics Basic examples and features
 
  - <b>Ping Pong</b>: @ref examples/msg/app-pingpong/app-pingpong.c\n
    It's hard to think of a simpler example: it is just sending one
    message back and forth.  
    The tesh file laying in the directory show how to start the
-   simulator binary, enlighting how to pass options to the simulators
+   simulator binary, highlighting how to pass options to the simulators
    (as detailed in Section \ref options). 
 
  - <b>Token Ring</b>.
@@ -202,36 +201,6 @@ simulated storages.
     I/O operations can also be done in a remote, i.e. when the
     accessed disk is not mounted on the caller's host.
 
-@section msg_ex_actions Following Workload Traces
-
-This section details how to run trace-driven simulations. It is very
-handy when you want to test an algorithm or protocol that only react
-to external events. For example, many P2P protocols react to user
-requests, but do nothing if there is no such event.
-
-In such situations, you should write your protocol in C, and separate
-the workload that you want to play onto your protocol in a separate
-text file. Declare a function handling each type of the events in your
-trace, register them using @ref xbt_replay_action_register in your
-main, and then use @ref MSG_action_trace_run to launch the simulation.
-
-Then, you can either have one trace file containing all your events,
-or a file per simulated process: the former may be easier to work
-with, but the second is more efficient on very large traces. Check
-also the tesh files in the example directories for details.
-
-  - <b>Communication replay</b>.
-    @ref examples/msg/actions-comm/actions-comm.c \n
-    Presents a set of event handlers reproducing classical communication
-    primitives (synchronous and asynchronous send/receive, broadcast,
-    barrier, etc).
-
-  - <b>I/O replay</b>.
-    @ref examples/msg/actions-storage/actions-storage.c \n
-    Presents a set of event handlers reproducing classical I/O
-    primitives (open, read, write, close, etc).
-
-
 @section msg_ex_misc Miscellaneous
 
  - <b>Task priorities</b>.
@@ -259,8 +228,8 @@ top of the example file).
 
 
 /**
-@example examples/msg/app-pingpong/app-pingpong.c        
-@example examples/msg/app-token-ring/app-token-ring.c    
+@example examples/msg/app-pingpong/app-pingpong.c
+@example examples/msg/app-token-ring/app-token-ring.c
 @example examples/msg/app-masterworker/app-masterworker.c
 
 @example examples/msg/async-wait/async-wait.c
@@ -288,11 +257,8 @@ top of the example file).
 @example examples/msg/io-file/io-file.c
 @example examples/msg/io-remote/io-remote.c
 
-@example examples/msg/actions-comm/actions-comm.c
-@example examples/msg/actions-storage/actions-storage.c
-
 @example examples/msg/task-priority/task-priority.c
 @example examples/msg/platform-properties/platform-properties.c
-                        
+
 */
 
index 91a5b0f..3e12e81 100644 (file)
@@ -5,7 +5,7 @@
 
 #include "simgrid/msg.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(mag_app_pingpong,"Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_app_pingpong, "Messages specific for this msg example");
 
 static int pinger(int argc, char *argv[])
 {
index 00231b6..cf5c638 100644 (file)
@@ -14,14 +14,14 @@ static int dvfs(int argc, char *argv[])
   msg_host_t host = MSG_host_by_name("MyHost1");
 
   XBT_INFO("Energetic profile: %s",MSG_host_get_property_value(host,"watt_per_state"));
-  XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J", MSG_host_get_current_power_peak(host),
+  XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J", MSG_host_get_speed(host),
            sg_host_get_consumed_energy(host));
 
   double start = MSG_get_clock();
   XBT_INFO("Sleep for 10 seconds");
   MSG_process_sleep(10);
-  XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E; Energy dissipated=%.2f J", MSG_get_clock()-start,
-      MSG_host_get_current_power_peak(host), sg_host_get_consumed_energy(host));
+  XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E; Energy dissipated=%.2f J",
+           MSG_get_clock() - start, MSG_host_get_speed(host), sg_host_get_consumed_energy(host));
 
   // Run a task
   start = MSG_get_clock();
@@ -30,15 +30,15 @@ static int dvfs(int argc, char *argv[])
   MSG_task_execute (task1);
   MSG_task_destroy(task1);
   XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Current consumption: from %.0fW to %.0fW"
-           " depending on load; Energy dissipated=%.0f J", MSG_get_clock()-start,
-           MSG_host_get_current_power_peak(host), sg_host_get_wattmin_at(host,MSG_host_get_pstate(host)),
-           sg_host_get_wattmax_at(host,MSG_host_get_pstate(host)), sg_host_get_consumed_energy(host));
+           " depending on load; Energy dissipated=%.0f J",
+           MSG_get_clock() - start, MSG_host_get_speed(host), sg_host_get_wattmin_at(host, MSG_host_get_pstate(host)),
+           sg_host_get_wattmax_at(host, MSG_host_get_pstate(host)), sg_host_get_consumed_energy(host));
 
   // ========= Change power peak =========
   int pstate=2;
   MSG_host_set_pstate(host, pstate);
-  XBT_INFO("========= Requesting pstate %d (speed should be of %.0E flop/s and is of %.0E flop/s)",
-      pstate, MSG_host_get_power_peak_at(host, pstate), MSG_host_get_current_power_peak(host));
+  XBT_INFO("========= Requesting pstate %d (speed should be of %.0E flop/s and is of %.0E flop/s)", pstate,
+           MSG_host_get_power_peak_at(host, pstate), MSG_host_get_speed(host));
 
   // Run a second task
   start = MSG_get_clock();
@@ -47,13 +47,13 @@ static int dvfs(int argc, char *argv[])
   MSG_task_execute (task1);
   MSG_task_destroy(task1);
   XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
-      MSG_get_clock()-start, MSG_host_get_current_power_peak(host), sg_host_get_consumed_energy(host));
+           MSG_get_clock() - start, MSG_host_get_speed(host), sg_host_get_consumed_energy(host));
 
   start = MSG_get_clock();
   XBT_INFO("Sleep for 4 seconds");
   MSG_process_sleep(4);
   XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
-      MSG_get_clock()-start, MSG_host_get_current_power_peak(host), sg_host_get_consumed_energy(host));
+           MSG_get_clock() - start, MSG_host_get_speed(host), sg_host_get_consumed_energy(host));
 
   // =========== Turn the other host off ==========
   XBT_INFO("Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 dissipated %.0f J so far.",
@@ -62,7 +62,7 @@ static int dvfs(int argc, char *argv[])
   start = MSG_get_clock();
   MSG_process_sleep(10);
   XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
-      MSG_get_clock()-start, MSG_host_get_current_power_peak(host), sg_host_get_consumed_energy(host));
+           MSG_get_clock() - start, MSG_host_get_speed(host), sg_host_get_consumed_energy(host));
   return 0;
 }
 
index 17ae54a..cd82406 100644 (file)
@@ -58,26 +58,26 @@ static int onoff(int argc, char *argv[]) {
   msg_host_t host1 = MSG_host_by_name("MyHost1");
 
   XBT_INFO("Energetic profile: %s", MSG_host_get_property_value(host1,"watt_per_state"));
-  XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J",
-     MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
+  XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J", MSG_host_get_speed(host1),
+           sg_host_get_consumed_energy(host1));
 
   XBT_INFO("Sleep for 10 seconds");
   MSG_process_sleep(10);
-  XBT_INFO("Done sleeping. Current peak speed=%.0E; Energy dissipated=%.2f J",
-     MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
+  XBT_INFO("Done sleeping. Current peak speed=%.0E; Energy dissipated=%.2f J", MSG_host_get_speed(host1),
+           sg_host_get_consumed_energy(host1));
 
   simulate_shutdown(host1);
-  XBT_INFO("Host1 is now OFF. Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
-     MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
+  XBT_INFO("Host1 is now OFF. Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", MSG_host_get_speed(host1),
+           sg_host_get_consumed_energy(host1));
 
   XBT_INFO("Sleep for 10 seconds");
   MSG_process_sleep(10);
-  XBT_INFO("Done sleeping. Current peak speed=%.0E; Energy dissipated=%.2f J",
-     MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
+  XBT_INFO("Done sleeping. Current peak speed=%.0E; Energy dissipated=%.2f J", MSG_host_get_speed(host1),
+           sg_host_get_consumed_energy(host1));
 
   simulate_bootup(host1);
-  XBT_INFO("Host1 is now ON again. Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
-     MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
+  XBT_INFO("Host1 is now ON again. Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", MSG_host_get_speed(host1),
+           sg_host_get_consumed_energy(host1));
 
   return 0;
 }
index 227c1da..de0d0d1 100644 (file)
@@ -24,7 +24,7 @@ static int dvfs(int argc, char *argv[])
   int nb = MSG_host_get_nb_pstates(host);
   XBT_INFO("Count of Processor states=%d", nb);
 
-  double current_peak = MSG_host_get_current_power_peak(host);
+  double current_peak = MSG_host_get_speed(host);
   XBT_INFO("Current power peak=%f", current_peak);
 
   // Run a task
@@ -45,7 +45,7 @@ static int dvfs(int argc, char *argv[])
 
   MSG_host_set_pstate(host, new_pstate);
 
-  current_peak = MSG_host_get_current_power_peak(host);
+  current_peak = MSG_host_get_speed(host);
   XBT_INFO("Current power peak=%f", current_peak);
 
   // Run a second task
@@ -61,7 +61,7 @@ static int dvfs(int argc, char *argv[])
   int nb2 = MSG_host_get_nb_pstates(host);
   XBT_INFO("Count of Processor states=%d", nb2);
 
-  double current_peak2 = MSG_host_get_current_power_peak(host);
+  double current_peak2 = MSG_host_get_speed(host);
   XBT_INFO("Current power peak=%f", current_peak2);
   return 0;
 }
index 4f7f079..c0ad633 100644 (file)
@@ -99,6 +99,6 @@ int main(int argc, char **argv)
   xbt_dynar_free(&hosts);
 
   int res = MSG_main();
-  XBT_INFO("Simulation time %g", MSG_get_clock());
+  XBT_INFO("Simulation time %.6f", MSG_get_clock());
   return res != MSG_OK;
 }
index c6915ff..e0483eb 100644 (file)
@@ -53,4 +53,4 @@ $ ${bindir:=.}/io-file ${srcdir:=.}/storage/storage.xml "--log=root.fmt:[%10.6r]
 > [  0.008326] (3:host@carl)   Have written 110000 in '/home/doc/simgrid/examples/platforms/g5k_cabinets.xml'. Size now is: 110000
 > [  0.008326] (3:host@carl)   Capacity of the storage element '/home/doc/simgrid/examples/platforms/g5k_cabinets.xml' is stored on: 37020686 / 536870912000
 > [  0.008326] (3:host@carl)   Close file '/home/doc/simgrid/examples/platforms/g5k_cabinets.xml'
-> [  0.008326] (0:maestro@) Simulation time 0.00832645
+> [  0.008326] (0:maestro@) Simulation time 0.008326
index a76fcc7..717c54b 100644 (file)
@@ -14,7 +14,7 @@ static int execute_load_test(int argc, char* argv[])
   msg_host_t host = MSG_host_by_name("MyHost1");
 
   XBT_INFO("Initial peak speed: %.0E flop/s; number of flops computed so far: %.0E (should be 0)",
-           MSG_host_get_current_power_peak(host), MSG_host_get_computed_flops(host));
+           MSG_host_get_speed(host), sg_host_get_computed_flops(host));
 
   double start = MSG_get_clock();
   XBT_INFO("Sleep for 10 seconds");
@@ -22,7 +22,7 @@ static int execute_load_test(int argc, char* argv[])
 
   XBT_INFO("Done sleeping %.2fs; peak speed: %.0E flop/s; number of flops computed so far: %.0E (nothing should have "
            "changed)",
-           MSG_get_clock() - start, MSG_host_get_current_power_peak(host), MSG_host_get_computed_flops(host));
+           MSG_get_clock() - start, MSG_host_get_speed(host), sg_host_get_computed_flops(host));
 
   // Run a task
   start            = MSG_get_clock();
@@ -33,13 +33,13 @@ static int execute_load_test(int argc, char* argv[])
 
   XBT_INFO("Done working on my task; this took %.2fs; current peak speed: %.0E flop/s; number of flops computed so "
            "far: %.0E",
-           MSG_get_clock() - start, MSG_host_get_current_power_peak(host), MSG_host_get_computed_flops(host));
+           MSG_get_clock() - start, MSG_host_get_speed(host), sg_host_get_computed_flops(host));
 
   // ========= Change power peak =========
   int pstate = 2;
-  MSG_host_set_pstate(host, pstate);
+  sg_host_set_pstate(host, pstate);
   XBT_INFO("========= Requesting pstate %d (speed should be of %.0E flop/s and is of %.0E flop/s)", pstate,
-           MSG_host_get_power_peak_at(host, pstate), MSG_host_get_current_power_peak(host));
+           MSG_host_get_power_peak_at(host, pstate), MSG_host_get_speed(host));
 
   // Run a second task
   start = MSG_get_clock();
@@ -49,7 +49,7 @@ static int execute_load_test(int argc, char* argv[])
   MSG_task_destroy(task1);
   XBT_INFO("Done working on my task; this took %.2fs; current peak speed: %.0E flop/s; number of flops computed so "
            "far: %.0E",
-           MSG_get_clock() - start, MSG_host_get_current_power_peak(host), MSG_host_get_computed_flops(host));
+           MSG_get_clock() - start, MSG_host_get_speed(host), sg_host_get_computed_flops(host));
 
   start = MSG_get_clock();
   XBT_INFO("========= Requesting a reset of the computation counter");
@@ -57,7 +57,7 @@ static int execute_load_test(int argc, char* argv[])
   XBT_INFO("Sleep for 4 seconds");
   MSG_process_sleep(4);
   XBT_INFO("Done sleeping %.2f s; peak speed: %.0E flop/s; number of flops computed so far: %.0E",
-           MSG_get_clock() - start, MSG_host_get_current_power_peak(host), MSG_host_get_computed_flops(host));
+           MSG_get_clock() - start, MSG_host_get_speed(host), sg_host_get_computed_flops(host));
 
   // =========== Turn the other host off ==========
   XBT_INFO("Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 computed %.0f flops so far.",
@@ -66,7 +66,7 @@ static int execute_load_test(int argc, char* argv[])
   start = MSG_get_clock();
   MSG_process_sleep(10);
   XBT_INFO("Done sleeping %.2f s; peak speed: %.0E flop/s; number of flops computed so far: %.0E",
-           MSG_get_clock() - start, MSG_host_get_current_power_peak(host), MSG_host_get_computed_flops(host));
+           MSG_get_clock() - start, MSG_host_get_speed(host), sg_host_get_computed_flops(host));
   return 0;
 }
 
index dfdc634..72a43da 100644 (file)
@@ -1,5 +1,5 @@
 foreach (example actions-comm actions-storage actor-create actor-daemon actor-kill actor-migration actor-suspend 
-                 app-masterworker app-token-ring io  mutex )
+                 app-masterworker app-pingpong app-token-ring plugin-hostload io mutex )
   add_executable       (s4u_${example}  ${example}/s4u_${example}.cpp)
   target_link_libraries(s4u_${example}  simgrid)
   set_target_properties(s4u_${example}  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${example})
@@ -32,6 +32,6 @@ set(txt_files     ${txt_files}    ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/s4u_a
                                   ${CMAKE_CURRENT_SOURCE_DIR}/README.doc                                   PARENT_SCOPE)
 
 foreach(example actions-comm actions-storage actor-create actor-daemon actor-kill actor-migration actor-suspend 
-                 app-masterworker app-token-ring dht-chord io mutex )
+                 app-masterworker app-pingpong app-token-ring dht-chord plugin-hostload io mutex )
   ADD_TESH_FACTORIES(s4u-${example} "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --cd ${CMAKE_HOME_DIRECTORY}/examples/s4u/${example} s4u_${example}.tesh)
 endforeach()
index fea2ad7..c875b41 100644 (file)
@@ -24,6 +24,11 @@ documentation, but it should remain readable directly.
     @ref examples/s4u/actor-create/s4u_actor-create_d.xml \n
     Shows how to start your actors to populate your simulation.
 
+  - <b>Ping Pong</b>: @ref examples/s4u/app-pingpong/s4u_app-pingpong.c\n
+   It's hard to think of a simpler example: it is just sending one message back and forth.
+   The tesh file laying in the directory show how to start the simulator binary, highlighting how to pass options to 
+   the simulators (as detailed in Section \ref options). 
+
   - <b>Token ring:</b> @ref examples/s4u/app-token-ring/s4u_app-token-ring.cpp \n
     Shows how to implement a classical communication pattern, where a token is exchanged along a ring to reach every
     participant.
@@ -38,6 +43,11 @@ documentation, but it should remain readable directly.
     @ref examples/s4u/actor-create/s4u_actor-create.cpp \n
     Most actors are started from the deployment XML file, but they exist other methods.
 
+  - <b>Daemonize actors</b>
+    @ref examples/s4u/actor-daemon/s4u_actor-daemon.cpp \n
+    Some actors may be intended to simulate daemons that run in background. This example show how to transform a regular
+    actor into a daemon that will be automatically killed once the simulation is over. 
+
   - <b>Suspend and Resume actors</b>.
     @ref examples/s4u/actor-suspend/s4u_actor-suspend.cpp \n
     Actors can be suspended and resumed during their executions
@@ -91,11 +101,13 @@ also the tesh files in the example directories for details.
 @example examples/s4u/actions-storage/s4u_actions-storage.cpp
 @example examples/s4u/actor-create/s4u_actor-create.cpp
 @example examples/s4u/actor-create/s4u_actor-create_d.xml
+@example examples/s4u/actor-daemon/s4u_actor-daemon.cpp
 @example examples/s4u/actor-kill/s4u_actor-kill.cpp
 @example examples/s4u/actor-migration/s4u_actor-migration.cpp
 @example examples/s4u/actor-suspend/s4u_actor-suspend.cpp
 @example examples/s4u/app-token-ring/s4u_app-token-ring.cpp
 @example examples/s4u/app-masterworker/s4u_app-masterworker.cpp
+@example examples/s4u/app-pingpong/s4u_app-pingpong.cpp
 
 @example examples/s4u/mutex/s4u_mutex.cpp
 
diff --git a/examples/s4u/app-pingpong/s4u_app-pingpong.cpp b/examples/s4u/app-pingpong/s4u_app-pingpong.cpp
new file mode 100644 (file)
index 0000000..d47ff48
--- /dev/null
@@ -0,0 +1,75 @@
+/* Copyright (c) 2007-2017. 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. */
+
+#include "simgrid/s4u.hpp"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_app_pingpong, "Messages specific for this s4u example");
+
+static void pinger(std::vector<std::string> args)
+{
+  xbt_assert(args.size() == 1, "The pinger function one argument from the XML deployment file");
+  XBT_INFO("Ping -> %s", args[0].c_str());
+  xbt_assert(simgrid::s4u::Host::by_name_or_null(args[0]) != nullptr, "Unknown host %s. Stopping Now! ",
+             args[0].c_str());
+
+  /* - Do the ping with a 1-Byte task (latency bound) ... */
+  double* payload = new double();
+  *payload        = simgrid::s4u::Engine::getClock();
+
+  simgrid::s4u::Mailbox::byName(args[0])->put(payload, 1);
+  /* - ... then wait for the (large) pong */
+  double* sender_time =
+      static_cast<double*>(simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::getHost()->getName())->get());
+
+  double communication_time = simgrid::s4u::Engine::getClock() - *sender_time;
+  XBT_INFO("Task received : large communication (bandwidth bound)");
+  XBT_INFO("Pong time (bandwidth bound): %.3f", communication_time);
+  delete sender_time;
+}
+
+static void ponger(std::vector<std::string> args)
+{
+  xbt_assert(args.size() == 1, "The ponger function one argument from the XML deployment file");
+  XBT_INFO("Pong -> %s", args[0].c_str());
+  xbt_assert(simgrid::s4u::Host::by_name_or_null(args[0]) != nullptr, "Unknown host %s. Stopping Now! ",
+             args[0].c_str());
+
+  /* - Receive the (small) ping first ....*/
+  double* sender_time =
+      static_cast<double*>(simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::getHost()->getName())->get());
+  double communication_time = simgrid::s4u::Engine::getClock() - *sender_time;
+  XBT_INFO("Task received : small communication (latency bound)");
+  XBT_INFO(" Ping time (latency bound) %f", communication_time);
+  delete sender_time;
+
+  /*  - ... Then send a 1GB pong back (bandwidth bound) */
+  double* payload = new double();
+  *payload        = simgrid::s4u::Engine::getClock();
+  XBT_INFO("task_bw->data = %.3f", *payload);
+
+  simgrid::s4u::Mailbox::byName(args[0])->put(payload, 1e9);
+}
+
+int main(int argc, char* argv[])
+{
+  simgrid::s4u::Engine* e = new simgrid::s4u::Engine(&argc, argv);
+
+  e->loadPlatform(argv[1]);
+  std::vector<std::string> args;
+  args.push_back("Jupiter");
+  simgrid::s4u::Actor::createActor("pinger", simgrid::s4u::Host::by_name("Tremblay"), pinger, args);
+
+  args.pop_back();
+  args.push_back("Tremblay");
+
+  simgrid::s4u::Actor::createActor("ponger", simgrid::s4u::Host::by_name("Jupiter"), ponger, args);
+
+  e->run();
+
+  XBT_INFO("Total simulation time: %.3f", e->getClock());
+  delete e;
+
+  return 0;
+}
diff --git a/examples/s4u/app-pingpong/s4u_app-pingpong.tesh b/examples/s4u/app-pingpong/s4u_app-pingpong.tesh
new file mode 100644 (file)
index 0000000..22a6bb3
--- /dev/null
@@ -0,0 +1,57 @@
+#! ./tesh
+
+p Testing with default compound
+
+$ $SG_TEST_EXENV ${bindir:=.}/s4u_app-pingpong$EXEEXT ${srcdir:=.}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [  0.000000] (1:pinger@Tremblay) Ping -> Jupiter
+> [  0.000000] (2:ponger@Jupiter) Pong -> Tremblay
+> [  0.019014] (2:ponger@Jupiter) Task received : small communication (latency bound)
+> [  0.019014] (2:ponger@Jupiter)  Ping time (latency bound) 0.019014
+> [  0.019014] (2:ponger@Jupiter) task_bw->data = 0.019
+> [150.178356] (1:pinger@Tremblay) Task received : large communication (bandwidth bound)
+> [150.178356] (1:pinger@Tremblay) Pong time (bandwidth bound): 150.159
+> [150.178356] (0:maestro@) Total simulation time: 150.178
+
+p Testing the deprecated CM02 network model
+
+$ $SG_TEST_EXENV ${bindir:=.}/s4u_app-pingpong$EXEEXT ${srcdir:=.}/small_platform.xml --cfg=cpu/model:Cas01 --cfg=network/model:CM02 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [  0.000000] (0:maestro@) Configuration change: Set 'cpu/model' to 'Cas01'
+> [  0.000000] (0:maestro@) Configuration change: Set 'network/model' to 'CM02'
+> [  0.000000] (1:pinger@Tremblay) Ping -> Jupiter
+> [  0.000000] (2:ponger@Jupiter) Pong -> Tremblay
+> [  0.001462] (2:ponger@Jupiter) Task received : small communication (latency bound)
+> [  0.001462] (2:ponger@Jupiter)  Ping time (latency bound) 0.001462
+> [  0.001462] (2:ponger@Jupiter) task_bw->data = 0.001
+> [145.639041] (1:pinger@Tremblay) Task received : large communication (bandwidth bound)
+> [145.639041] (1:pinger@Tremblay) Pong time (bandwidth bound): 145.638
+> [145.639041] (0:maestro@) Total simulation time: 145.639
+
+p Testing the surf network Reno fairness model using lagrangian approach
+
+$ $SG_TEST_EXENV ${bindir:=.}/s4u_app-pingpong$EXEEXT ${srcdir:=.}/small_platform.xml "--cfg=host/model:compound cpu/model:Cas01 network/model:Reno" --log=surf_lagrange.thres=critical "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [  0.000000] (0:maestro@) Configuration change: Set 'host/model' to 'compound'
+> [  0.000000] (0:maestro@) Configuration change: Set 'cpu/model' to 'Cas01'
+> [  0.000000] (0:maestro@) Configuration change: Set 'network/model' to 'Reno'
+> [  0.000000] (1:pinger@Tremblay) Ping -> Jupiter
+> [  0.000000] (2:ponger@Jupiter) Pong -> Tremblay
+> [  0.019014] (2:ponger@Jupiter) Task received : small communication (latency bound)
+> [  0.019014] (2:ponger@Jupiter)  Ping time (latency bound) 0.019014
+> [  0.019014] (2:ponger@Jupiter) task_bw->data = 0.019
+> [150.178356] (1:pinger@Tremblay) Task received : large communication (bandwidth bound)
+> [150.178356] (1:pinger@Tremblay) Pong time (bandwidth bound): 150.159
+> [150.178356] (0:maestro@) Total simulation time: 150.178
+
+p Testing the surf network Vegas fairness model using lagrangian approach
+
+$ $SG_TEST_EXENV ${bindir:=.}/s4u_app-pingpong$EXEEXT ${srcdir:=.}/small_platform.xml "--cfg=host/model:compound cpu/model:Cas01 network/model:Vegas" "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [  0.000000] (0:maestro@) Configuration change: Set 'host/model' to 'compound'
+> [  0.000000] (0:maestro@) Configuration change: Set 'cpu/model' to 'Cas01'
+> [  0.000000] (0:maestro@) Configuration change: Set 'network/model' to 'Vegas'
+> [  0.000000] (1:pinger@Tremblay) Ping -> Jupiter
+> [  0.000000] (2:ponger@Jupiter) Pong -> Tremblay
+> [  0.019014] (2:ponger@Jupiter) Task received : small communication (latency bound)
+> [  0.019014] (2:ponger@Jupiter)  Ping time (latency bound) 0.019014
+> [  0.019014] (2:ponger@Jupiter) task_bw->data = 0.019
+> [150.178356] (1:pinger@Tremblay) Task received : large communication (bandwidth bound)
+> [150.178356] (1:pinger@Tremblay) Pong time (bandwidth bound): 150.159
+> [150.178356] (0:maestro@) Total simulation time: 150.178
diff --git a/examples/s4u/plugin-hostload/s4u_plugin-hostload.cpp b/examples/s4u/plugin-hostload/s4u_plugin-hostload.cpp
new file mode 100644 (file)
index 0000000..3f6efc4
--- /dev/null
@@ -0,0 +1,85 @@
+/* Copyright (c) 2007-2010, 2013-2015. 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. */
+
+#include "simgrid/s4u.hpp"
+#include "simgrid/plugins/load.h"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example");
+
+static void execute_load_test()
+{
+  s4u_Host* host = simgrid::s4u::Host::by_name("MyHost1");
+
+  XBT_INFO("Initial peak speed: %.0E flop/s; number of flops computed so far: %.0E (should be 0)", host->getSpeed(),
+           sg_host_get_computed_flops(host));
+
+  double start = simgrid::s4u::Engine::getClock();
+  XBT_INFO("Sleep for 10 seconds");
+  simgrid::s4u::this_actor::sleep_for(10);
+
+  XBT_INFO("Done sleeping %.2fs; peak speed: %.0E flop/s; number of flops computed so far: %.0E (nothing should have "
+           "changed)",
+           simgrid::s4u::Engine::getClock() - start, host->getSpeed(), sg_host_get_computed_flops(host));
+
+  // Run a task
+  start = simgrid::s4u::Engine::getClock();
+  XBT_INFO("Run a task of %.0E flops", 100E6);
+  simgrid::s4u::this_actor::execute(100E6);
+
+  XBT_INFO("Done working on my task; this took %.2fs; current peak speed: %.0E flop/s; number of flops computed so "
+           "far: %.0E",
+           simgrid::s4u::Engine::getClock() - start, host->getSpeed(), sg_host_get_computed_flops(host));
+
+  // ========= Change power peak =========
+  int pstate = 2;
+  host->setPstate(pstate);
+  XBT_INFO("========= Requesting pstate %d (speed should be of %.0E flop/s and is of %.0E flop/s)", pstate,
+           host->getPstateSpeed(pstate), host->getSpeed());
+
+  // Run a second task
+  start = simgrid::s4u::Engine::getClock();
+  XBT_INFO("Run a task of %.0E flops", 100E6);
+  simgrid::s4u::this_actor::execute(100E6);
+  XBT_INFO("Done working on my task; this took %.2fs; current peak speed: %.0E flop/s; number of flops computed so "
+           "far: %.0E",
+           simgrid::s4u::Engine::getClock() - start, host->getSpeed(), sg_host_get_computed_flops(host));
+
+  start = simgrid::s4u::Engine::getClock();
+  XBT_INFO("========= Requesting a reset of the computation counter");
+  sg_host_load_reset(host);
+  XBT_INFO("Sleep for 4 seconds");
+  simgrid::s4u::this_actor::sleep_for(4);
+  XBT_INFO("Done sleeping %.2f s; peak speed: %.0E flop/s; number of flops computed so far: %.0E",
+           simgrid::s4u::Engine::getClock() - start, host->getSpeed(), sg_host_get_computed_flops(host));
+
+  // =========== Turn the other host off ==========
+  s4u_Host* host2 = simgrid::s4u::Host::by_name("MyHost2");
+  XBT_INFO("Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 computed %.0f flops so far.",
+           sg_host_get_computed_flops(host2));
+  host2->turnOff();
+  start = simgrid::s4u::Engine::getClock();
+  simgrid::s4u::this_actor::sleep_for(10);
+  XBT_INFO("Done sleeping %.2f s; peak speed: %.0E flop/s; number of flops computed so far: %.0E",
+           simgrid::s4u::Engine::getClock() - start, host->getSpeed(), sg_host_get_computed_flops(host));
+}
+
+int main(int argc, char* argv[])
+{
+  sg_host_load_plugin_init();
+  simgrid::s4u::Engine* e = new simgrid::s4u::Engine(&argc, argv);
+
+  xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
+  e->loadPlatform(argv[1]);
+
+  simgrid::s4u::Actor::createActor("load_test", simgrid::s4u::Host::by_name("MyHost1"), execute_load_test);
+
+  e->run();
+
+  XBT_INFO("Total simulation time: %.2f", simgrid::s4u::Engine::getClock());
+
+  delete e;
+  return 0;
+}
diff --git a/examples/s4u/plugin-hostload/s4u_plugin-hostload.tesh b/examples/s4u/plugin-hostload/s4u_plugin-hostload.tesh
new file mode 100644 (file)
index 0000000..5e9b67e
--- /dev/null
@@ -0,0 +1,19 @@
+#! ./tesh
+
+p This tests the HostLoad plugin (this allows the user to get the current load of a host and the computed flops)
+
+$ ${bindir:=.}/s4u_plugin-hostload$EXEEXT ${srcdir:=.}/../platforms/energy_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [  0.000000] (1:load_test@MyHost1) Initial peak speed: 1E+08 flop/s; number of flops computed so far: 0E+00 (should be 0)
+> [  0.000000] (1:load_test@MyHost1) Sleep for 10 seconds
+> [ 10.000000] (1:load_test@MyHost1) Done sleeping 10.00s; peak speed: 1E+08 flop/s; number of flops computed so far: 0E+00 (nothing should have changed)
+> [ 10.000000] (1:load_test@MyHost1) Run a task of 1E+08 flops
+> [ 11.000000] (1:load_test@MyHost1) Done working on my task; this took 1.00s; current peak speed: 1E+08 flop/s; number of flops computed so far: 1E+08
+> [ 11.000000] (1:load_test@MyHost1) ========= Requesting pstate 2 (speed should be of 2E+07 flop/s and is of 2E+07 flop/s)
+> [ 11.000000] (1:load_test@MyHost1) Run a task of 1E+08 flops
+> [ 16.000000] (1:load_test@MyHost1) Done working on my task; this took 5.00s; current peak speed: 2E+07 flop/s; number of flops computed so far: 2E+08
+> [ 16.000000] (1:load_test@MyHost1) ========= Requesting a reset of the computation counter
+> [ 16.000000] (1:load_test@MyHost1) Sleep for 4 seconds
+> [ 20.000000] (1:load_test@MyHost1) Done sleeping 4.00 s; peak speed: 2E+07 flop/s; number of flops computed so far: 0E+00
+> [ 20.000000] (1:load_test@MyHost1) Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 computed 0 flops so far.
+> [ 30.000000] (1:load_test@MyHost1) Done sleeping 10.00 s; peak speed: 2E+07 flop/s; number of flops computed so far: 0E+00
+> [ 30.000000] (0:maestro@) Total simulation time: 30.00
index c362f99..c5f59c3 100644 (file)
@@ -48,7 +48,7 @@ XBT_PUBLIC(void) MC_cut(void);
 XBT_PUBLIC(void) MC_ignore(void *addr, size_t size);
 
 XBT_PUBLIC(void) MC_ignore_heap(void* address, size_t size);
-XBT_PUBLIC(void) MC_remove_ignore_heap(void* address, size_t size);
+XBT_PUBLIC(void) MC_unignore_heap(void* address, size_t size);
 XBT_PUBLIC(void) MC_ignore_local_variable(const char* var_name, const char* frame);
 XBT_PUBLIC(void) MC_ignore_global_variable(const char* var_name);
 
index 3991f2b..345b584 100644 (file)
@@ -169,35 +169,48 @@ XBT_PUBLIC(const char*) MSG_zone_get_property_value(msg_netzone_t as, const char
 XBT_PUBLIC(void) MSG_zone_set_property_value(msg_netzone_t netzone, const char* name, char* value);
 XBT_PUBLIC(void) MSG_zone_get_hosts(msg_netzone_t zone, xbt_dynar_t whereto);
 
-/* Deprecated forms of the previous functions */
-static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_get_root since v3.16")
-    msg_netzone_t MSG_environment_get_routing_root() {
+static inline XBT_ATTRIB_DEPRECATED_v319(
+    "Use MSG_zone_get_root() instead: v3.19 will remove MSG_environment_get_routing_root() completely.") msg_netzone_t
+    MSG_environment_get_routing_root()
+{
   return MSG_zone_get_root();
 }
-static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_get_name since v3.16")
-    const char* MSG_environment_as_get_name(msg_netzone_t zone) {
+static inline XBT_ATTRIB_DEPRECATED_v319(
+    "Use MSG_zone_get_name() instead: v3.19 will remove MSG_environment_as_get_name() completely.") const
+    char* MSG_environment_as_get_name(msg_netzone_t zone)
+{
   return MSG_zone_get_name(zone);
 }
-static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_get_by_name since v3.16")
-    msg_netzone_t MSG_environment_as_get_by_name(const char* name) {
+static inline XBT_ATTRIB_DEPRECATED_v319(
+    "Use MSG_zone_get_by_name() instead: v3.19 will remove MSG_environment_as_get_by_name() completely.") msg_netzone_t
+    MSG_environment_as_get_by_name(const char* name)
+{
   return MSG_zone_get_by_name(name);
 }
-static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_get_sons since v3.16")
-    xbt_dict_t MSG_environment_as_get_routing_sons(msg_netzone_t zone) {
+static inline XBT_ATTRIB_DEPRECATED_v319(
+    "Use MSG_zone_get_sons() instead: v3.19 will remove MSG_environment_as_get_routing_sons() completely.") xbt_dict_t
+    MSG_environment_as_get_routing_sons(msg_netzone_t zone)
+{
   xbt_dict_t res = xbt_dict_new_homogeneous(NULL);
   MSG_zone_get_sons(zone, res);
   return res;
 }
-static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_get_property_value since v3.16")
-    const char* MSG_environment_as_get_property_value(msg_netzone_t zone, const char* name) {
+static inline XBT_ATTRIB_DEPRECATED_v319(
+    "Use MSG_zone_get_property_value() instead: v3.19 will remove MSG_environment_as_get_property_value() completely.")
+    const char* MSG_environment_as_get_property_value(msg_netzone_t zone, const char* name)
+{
   return MSG_zone_get_property_value(zone, name);
 }
-static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_set_property_value since v3.16")
-    void MSG_environment_as_set_property_value(msg_netzone_t zone, const char* name, char* value) {
+static inline XBT_ATTRIB_DEPRECATED_v319(
+    "Use MSG_zone_set_property_value() instead: v3.19 will remove MSG_environment_as_set_property_value() "
+    "completely.") void MSG_environment_as_set_property_value(msg_netzone_t zone, const char* name, char* value)
+{
   MSG_zone_set_property_value(zone, name, value);
 }
-static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_get_hosts since v3.16")
-    xbt_dynar_t MSG_environment_as_get_hosts(msg_netzone_t zone) {
+static inline XBT_ATTRIB_DEPRECATED_v319(
+    "Use MSG_zone_get_hosts() instead: v3.19 will remove MSG_environment_as_get_hosts() completely.") xbt_dynar_t
+    MSG_environment_as_get_hosts(msg_netzone_t zone)
+{
   xbt_dynar_t res = xbt_dynar_new(sizeof(sg_host_t), NULL);
   MSG_zone_get_hosts(zone, res);
   return res;
@@ -252,13 +265,23 @@ XBT_PUBLIC(void) MSG_host_get_process_list(msg_host_t h, xbt_dynar_t whereto);
 XBT_PUBLIC(int) MSG_host_is_on(msg_host_t h);
 XBT_PUBLIC(int) MSG_host_is_off(msg_host_t h);
 
-XBT_PUBLIC(double) MSG_get_host_speed(msg_host_t h); /* deprecated */
+static inline double
+    XBT_ATTRIB_DEPRECATED_v319("Use MSG_host_get_speed(): v3.19 will drop MSG_get_host_speed() completely.")
+        MSG_get_host_speed(msg_host_t host)
+{
+  return MSG_host_get_speed(host);
+}
+static inline double XBT_ATTRIB_DEPRECATED_v320(
+    "Use MSG_host_get_speed(): v3.20 will drop MSG_host_get_current_power_peak() completely.")
+    MSG_host_get_current_power_peak(msg_host_t host)
+{
+  return MSG_host_get_speed(host);
+}
 
 XBT_PUBLIC(double) MSG_host_get_power_peak_at(msg_host_t h, int pstate);
-#define MSG_host_get_current_power_peak(h) MSG_host_get_speed(h) /* deprecated */
 XBT_PUBLIC(int)    MSG_host_get_nb_pstates(msg_host_t h);
-#define MSG_host_get_pstate(h)         sg_host_get_pstate(h)         /* deprecated */
-#define MSG_host_set_pstate(h, pstate) sg_host_set_pstate(h, pstate) /* deprecated */
+#define MSG_host_get_pstate(h) sg_host_get_pstate(h) /* users don't know that MSG is the C version of SimGrid */
+#define MSG_host_set_pstate(h, pstate) sg_host_set_pstate(h, pstate) /* (same here) */
 XBT_PUBLIC(xbt_dynar_t) MSG_hosts_as_dynar();
 XBT_PUBLIC(int) MSG_get_host_number();
 XBT_PUBLIC(xbt_dict_t) MSG_host_get_mounted_storage_list(msg_host_t host);
index 4d94896..99ede18 100644 (file)
@@ -293,8 +293,7 @@ template <class Rep, class Period> inline void sleep_for(std::chrono::duration<R
     this_actor::sleep_until(timeout_native.time_since_epoch().count());
   }
 
-  XBT_ATTRIB_DEPRECATED("Use sleep_for()")
-  inline void sleep(double duration)
+  XBT_ATTRIB_DEPRECATED_v320("Use sleep_for(): v3.20 will drop sleep() completely.") inline void sleep(double duration)
   {
     return sleep_for(duration);
   }
@@ -306,23 +305,29 @@ template <class Rep, class Period> inline void sleep_for(std::chrono::duration<R
    *
    * See \ref Comm for the full communication API (including non blocking communications).
    */
-  XBT_PUBLIC(void*) XBT_ATTRIB_DEPRECATED("Please use Mailbox::get") recv(MailboxPtr chan);                 // 3.17
-  XBT_PUBLIC(void*) XBT_ATTRIB_DEPRECATED("Please use Mailbox::get") recv(MailboxPtr chan, double timeout); // 3.17
+  XBT_PUBLIC(void*)
+  XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::get(): v3.20 will remove Actor::recv() completely.") recv(MailboxPtr chan);
+  XBT_PUBLIC(void*)
+  XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::get(): v3.20 will remove Actor::recv() completely.")
+      recv(MailboxPtr chan, double timeout);
   XBT_PUBLIC(CommPtr)
-  XBT_ATTRIB_DEPRECATED("Please use Mailbox::recv_async") irecv(MailboxPtr chan, void** data); // 3.17
+  XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::recv_async(): v3.20 will remove Actor::irecv() completely.")
+      irecv(MailboxPtr chan, void** data);
 
   /** Block the actor until it delivers a message of the given simulated size to the given mailbox
    *
    * See \ref Comm for the full communication API (including non blocking communications).
   */
   XBT_PUBLIC(void)
-  XBT_ATTRIB_DEPRECATED("Please use Mailbox::put") send(MailboxPtr chan, void* payload, double simulatedSize); // 3.17
+  XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put(): v3.20 will remove Actor::send() completely.")
+      send(MailboxPtr chan, void* payload, double simulatedSize); // 3.17
   XBT_PUBLIC(void)
-  XBT_ATTRIB_DEPRECATED("Please use Mailbox::put")
-  send(MailboxPtr chan, void* payload, double simulatedSize, double timeout); // 3.17
+  XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put(): v3.20 will remove Actor::send() completely.")
+      send(MailboxPtr chan, void* payload, double simulatedSize, double timeout); // 3.17
 
   XBT_PUBLIC(CommPtr)
-  XBT_ATTRIB_DEPRECATED("Please use Mailbox::put_async") isend(MailboxPtr chan, void* payload, double simulatedSize);
+  XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put_async(): v3.20 will remove Actor::isend() completely.")
+      isend(MailboxPtr chan, void* payload, double simulatedSize);
 
   /** @brief Returns the actor ID of the current actor (same as pid). */
   XBT_PUBLIC(aid_t) getPid();
index 369b718..c1b27c9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2017. 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. */
@@ -10,7 +10,7 @@
 
 #include <simgrid/forward.h>
 #include <simgrid/s4u/Activity.hpp>
-#include <simgrid/s4u/Mailbox.hpp> // DEPRECATED 3.17
+#include <simgrid/s4u/Mailbox.hpp> // DEPRECATED 3.20
 #include <simgrid/s4u/forward.hpp>
 
 #include <vector>
@@ -55,31 +55,33 @@ public:
     return idx;
   }
   /** Creates (but don't start) an async send to the mailbox @p dest */
-  static CommPtr XBT_ATTRIB_DEPRECATED("please use Mailbox::put_init") // 3.17
+  static CommPtr XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put_init(): v3.20 will remove Comm::send_init() completely.")
       send_init(MailboxPtr dest)
   {
     return dest->put_init();
   }
   /** Creates (but don't start) an async send to the mailbox @p dest */
-  static CommPtr XBT_ATTRIB_DEPRECATED("please use Mailbox::put_init") // 3.17
+  static CommPtr XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put_init(): v3.20 will remove Comm::send_init() completely.")
       send_init(MailboxPtr dest, void* data, int simulatedByteAmount)
   {
     return dest->put_init(data, simulatedByteAmount);
   }
   /** Creates and start an async send to the mailbox @p dest */
-  static CommPtr XBT_ATTRIB_DEPRECATED("please use Mailbox::put_async") // 3.17
+  static CommPtr XBT_ATTRIB_DEPRECATED_v320(
+      "Use Mailbox::put_async(): v3.20 will remove Comm::send_async() completely.")
       send_async(MailboxPtr dest, void* data, int simulatedByteAmount)
   {
     return dest->put_async(data, simulatedByteAmount);
   }
   /** Creates (but don't start) an async recv onto the mailbox @p from */
-  static CommPtr XBT_ATTRIB_DEPRECATED("please use Mailbox::get_init") // 3.17
+  static CommPtr XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::get_init(): v3.20 will remove Comm::recv_init() completely.")
       recv_init(MailboxPtr from)
   {
     return from->get_init();
   }
   /** Creates and start an async recv to the mailbox @p from */
-  static CommPtr XBT_ATTRIB_DEPRECATED("please use Mailbox::get_async") // 3.17
+  static CommPtr XBT_ATTRIB_DEPRECATED_v320(
+      "Use Mailbox::get_async(): v3.20 will remove Comm::recv_async() completely.")
       recv_async(MailboxPtr from, void** data)
   {
     return from->get_async(data);
index b1e2be3..c40482f 100644 (file)
@@ -104,8 +104,7 @@ public:
   void notify_one();
   void notify_all();
 
-  XBT_ATTRIB_DEPRECATED("Use notify_one() instead")
-  void notify() { notify_one(); }
+  XBT_ATTRIB_DEPRECATED_v319("Use notify_one(): v3.19 will remove notify() completely.") void notify() { notify_one(); }
 };
 
 using ConditionVariablePtr = ConditionVariable::Ptr;
index 9fbc6f2..18d2926 100644 (file)
@@ -37,7 +37,6 @@ public:
 
   /** Simulates a write action. Returns the size of data actually written. */
   sg_size_t write(sg_size_t size);
-  sg_size_t write(sg_size_t size, sg_host_t host);
 
   /** Allows to store user data on that host */
   void setUserdata(void* data) { userdata_ = data; }
index 6a117c1..6921451 100644 (file)
@@ -289,8 +289,8 @@ XBT_PUBLIC(void) simcall_sem_acquire_timeout(smx_sem_t sem, double max_duration)
 XBT_PUBLIC(int) simcall_sem_get_capacity(smx_sem_t sem);
 
 /*****************************   File   **********************************/
-XBT_PUBLIC(sg_size_t) simcall_file_read(surf_file_t fd, sg_size_t size, sg_host_t host);
-XBT_PUBLIC(sg_size_t) simcall_file_write(surf_file_t fd, sg_size_t size, sg_host_t host);
+XBT_PUBLIC(sg_size_t) simcall_file_read(surf_file_t fd, sg_size_t size);
+XBT_PUBLIC(sg_size_t) simcall_file_write(surf_file_t fd, sg_size_t size);
 /************************** MC simcalls   **********************************/
 XBT_PUBLIC(int) simcall_mc_random(int min, int max);
 
index ba5e76f..e2d740c 100644 (file)
@@ -1,6 +1,6 @@
 /* xbt.h - Public interface to the xbt (simgrid's toolbox)                  */
 
-/* Copyright (c) 2004-2015. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2017. 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. */
@@ -47,7 +47,8 @@
 
 #define XBT_ATTRIB_NORETURN __attribute__((noreturn))
 #define XBT_ATTRIB_UNUSED  __attribute__((unused))
-#define XBT_ATTRIB_DEPRECATED(m)  __attribute__((deprecated(m)))
+#define XBT_ATTRIB_DEPRECATED_v319(msg) __attribute__((deprecated(msg))) /* Will be dropped in v3.19 */
+#define XBT_ATTRIB_DEPRECATED_v320(msg) __attribute__((deprecated(msg))) /* Will be dropped in v3.20 */
 
 /* Constructor priorities exist since gcc 4.3.  Apparently, they are however not
  * supported on Macs. */
index 2f67456..03aec81 100644 (file)
@@ -18,7 +18,6 @@ typedef void *(*pvoid_f_void_t) (void);
 typedef void *(*pvoid_f_pvoid_t) (void *);
 typedef void (*void_f_void_t) (void);
 
-typedef int (*int_f_void_t) (void);
 typedef int (*int_f_pvoid_t) (void*);
 
 typedef int (*int_f_pvoid_pvoid_t) (void *, void *);
index ca034ba..4f475b8 100644 (file)
@@ -42,11 +42,14 @@ public:
     char noarg[] = {'\0'};
     const int argc = args_->size();
     std::vector<std::string> args = *args_;
-    std::unique_ptr<char*[]> argv(new char*[argc + 1]);
-    for (int i = 0; i != argc; ++i)
-      argv[i] = args[i].empty() ? noarg : &args[i].front();
-    argv[argc] = nullptr;
-    code_(argc, argv.get());
+    if (not args.empty()) {
+      std::unique_ptr<char* []> argv(new char*[argc + 1]);
+      for (int i = 0; i != argc; ++i)
+        argv[i]  = args[i].empty() ? noarg : &args[i].front();
+      argv[argc] = nullptr;
+      code_(argc, argv.get());
+    } else
+      code_(argc, nullptr);
   }
 };
 
index fc8db65..e2208b3 100644 (file)
@@ -371,7 +371,7 @@ JNIEXPORT jint JNICALL Java_org_simgrid_msg_Host_getPstatesCount(JNIEnv* env, jo
 JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getCurrentPowerPeak(JNIEnv* env, jobject jhost)
 {
   msg_host_t host = jhost_get_native(env, jhost);
-  return MSG_host_get_current_power_peak(host);
+  return MSG_host_get_speed(host);
 }
 JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getPowerPeakAt(JNIEnv* env, jobject jhost, jint pstate)
 {
index 8fcbe02..2676857 100644 (file)
@@ -74,9 +74,9 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_create(JNIEnv* env, jobject
   /* Actually build the MSG process */
   jstring jname         = (jstring)env->GetObjectField(jprocess, jprocess_field_Process_name);
   const char* name      = env->GetStringUTFChars(jname, 0);
-  msg_process_t process = MSG_process_create_from_stdfunc(
-      name, [jprocess]() -> void { simgrid::kernel::context::java_main_jprocess(jprocess); },
-      /*data*/ nullptr, jhost_get_native(env, jhost), /* properties*/ nullptr);
+  msg_process_t process =
+      MSG_process_create_from_stdfunc(name, [jprocess]() { simgrid::kernel::context::java_main_jprocess(jprocess); },
+                                      /*data*/ nullptr, jhost_get_native(env, jhost), /* properties*/ nullptr);
   env->ReleaseStringUTFChars(jname, name);
 
   /* bind the java process instance to the native process */
index 355856d..43dc342 100644 (file)
@@ -313,7 +313,7 @@ public abstract class Process implements Runnable {
        }
 
        /**
-        * The main function of the process (to implement).
+        * The main function of the process (to implement by the user).
         *
         * @param args
         * @throws MsgException
index 0c183af..4a43c92 100644 (file)
 #include "simgrid/datatypes.h"
 #include "simgrid/forward.h"
 
-SG_BEGIN_DECL()
-/* Actions and models are highly connected structures... */
-
-/* user-visible parameters */
-extern XBT_PRIVATE double sg_tcp_gamma;
-extern XBT_PRIVATE double sg_sender_gap;
-extern XBT_PRIVATE double sg_latency_factor;
-extern XBT_PRIVATE double sg_bandwidth_factor;
-extern XBT_PRIVATE double sg_weight_S_parameter;
-extern XBT_PRIVATE int sg_network_crosstraffic;
 
 #ifdef __cplusplus
 
 namespace simgrid {
 namespace surf {
-
 class Model;
 class CpuModel;
 class HostModel;
@@ -52,7 +41,6 @@ typedef simgrid::surf::NetworkModel surf_NetworkModel;
 typedef simgrid::surf::StorageModel surf_StorageModel;
 typedef simgrid::surf::Resource surf_Resource;
 typedef simgrid::surf::Action surf_Action;
-typedef simgrid::surf::FileImpl surf_File;
 
 #else
 
@@ -65,10 +53,20 @@ typedef struct surf_StorageModel surf_StorageModel;
 typedef struct surf_Resource surf_Resource;
 typedef struct surf_Host surf_Host;
 typedef struct surf_Action surf_Action;
-typedef struct surf_File surf_File;
 
 #endif
 
+SG_BEGIN_DECL()
+/* Actions and models are highly connected structures... */
+
+/* user-visible parameters */
+extern XBT_PRIVATE double sg_tcp_gamma;
+extern XBT_PRIVATE double sg_sender_gap;
+extern XBT_PRIVATE double sg_latency_factor;
+extern XBT_PRIVATE double sg_bandwidth_factor;
+extern XBT_PRIVATE double sg_weight_S_parameter;
+extern XBT_PRIVATE int sg_network_crosstraffic;
+
 /** @ingroup SURF_c_bindings
  *  \brief Model datatype
  *
@@ -80,7 +78,6 @@ typedef surf_CpuModel *surf_cpu_model_t;
 typedef surf_HostModel *surf_host_model_t;
 typedef surf_NetworkModel *surf_network_model_t;
 typedef surf_StorageModel *surf_storage_model_t;
-typedef surf_File* surf_file_t;
 
 /** @ingroup SURF_c_bindings
  *  \brief Action structure
index c4985e2..758d12c 100644 (file)
@@ -109,16 +109,17 @@ public:
  */
 class AddressSpace {
 private:
-  Process* process_;
+  RemoteClient* process_;
+
 public:
-  explicit AddressSpace(Process* process) : process_(process) {}
+  explicit AddressSpace(RemoteClient* process) : process_(process) {}
   virtual ~AddressSpace() = default;
 
-  /** The process of this addres space
+  /** The process of this address space
    *
    *  This is where we can get debug informations, memory layout, etc.
    */
-  simgrid::mc::Process* process() const { return process_; }
+  simgrid::mc::RemoteClient* process() const { return process_; }
 
   /** Read data from the address space
    *
index 330f2c9..9652ea1 100644 (file)
@@ -51,7 +51,7 @@ public:
   ChunkedData(ChunkedData const& that)
      : store_ (that.store_)
      , pagenos_(that.pagenos_)
-            
+
   {
     for (std::size_t pageno : pagenos_)
       store_->ref_page(pageno);
index 4b1f202..1bf89d8 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2015-2017. 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. */
@@ -72,7 +71,7 @@ public:
   static const std::size_t max_size = 64;
 private:
   // Values of the stack (the top is stack_[size_ - 1]):
-  uintptr_t stack_[max_size];
+  uintptr_t stack_[max_size] {0};
   size_t size_;
 public:
   ExpressionStack() : size_(0) {}
index 2f44304..d5a8195 100644 (file)
@@ -46,13 +46,13 @@ using simgrid::mc::remote;
 namespace simgrid {
 namespace mc {
 
-ModelChecker::ModelChecker(std::unique_ptr<Process> process) :
-  base_(nullptr),
-  socket_event_(nullptr),
-  signal_event_(nullptr),
-  page_store_(500),
-  process_(std::move(process)),
-  parent_snapshot_(nullptr)
+ModelChecker::ModelChecker(std::unique_ptr<RemoteClient> process)
+    : base_(nullptr)
+    , socket_event_(nullptr)
+    , signal_event_(nullptr)
+    , page_store_(500)
+    , process_(std::move(process))
+    , parent_snapshot_(nullptr)
 {
 
 }
@@ -131,7 +131,7 @@ static const std::pair<const char*, const char*> ignored_local_variables[] = {
 
 void ModelChecker::setup_ignore()
 {
-  Process& process = this->process();
+  RemoteClient& process = this->process();
   for (std::pair<const char*, const char*> const& var :
       ignored_local_variables)
     process.ignore_local_variable(var.first, var.second);
@@ -144,7 +144,7 @@ void ModelChecker::shutdown()
 {
   XBT_DEBUG("Shuting down model-checker");
 
-  simgrid::mc::Process* process = &this->process();
+  simgrid::mc::RemoteClient* process = &this->process();
   if (process->running()) {
     XBT_DEBUG("Killing process");
     kill(process->pid(), SIGTERM);
@@ -152,7 +152,7 @@ void ModelChecker::shutdown()
   }
 }
 
-void ModelChecker::resume(simgrid::mc::Process& process)
+void ModelChecker::resume(simgrid::mc::RemoteClient& process)
 {
   int res = process.getChannel().send(MC_MESSAGE_CONTINUE);
   if (res)
@@ -196,7 +196,7 @@ static void MC_report_assertion_error()
 
 bool ModelChecker::handle_message(char* buffer, ssize_t size)
 {
-  s_mc_message_t base_message;
+  mc_message_t base_message;
   if (size < (ssize_t) sizeof(base_message))
     xbt_die("Broken message");
   memcpy(&base_message, buffer, sizeof(base_message));
@@ -205,73 +205,69 @@ bool ModelChecker::handle_message(char* buffer, ssize_t size)
 
   case MC_MESSAGE_IGNORE_HEAP:
     {
-      s_mc_ignore_heap_message_t message;
-      if (size != sizeof(message))
-        xbt_die("Broken messsage");
-      memcpy(&message, buffer, sizeof(message));
-
-      IgnoredHeapRegion region;
-      region.block = message.block;
-      region.fragment = message.fragment;
-      region.address = message.address;
-      region.size = message.size;
-      process().ignore_heap(region);
-      break;
+    s_mc_message_ignore_heap_t message;
+    if (size != sizeof(message))
+      xbt_die("Broken messsage");
+    memcpy(&message, buffer, sizeof(message));
+
+    IgnoredHeapRegion region;
+    region.block    = message.block;
+    region.fragment = message.fragment;
+    region.address  = message.address;
+    region.size     = message.size;
+    process().ignore_heap(region);
+    break;
     }
 
   case MC_MESSAGE_UNIGNORE_HEAP:
     {
-      s_mc_ignore_memory_message_t message;
-      if (size != sizeof(message))
-        xbt_die("Broken messsage");
-      memcpy(&message, buffer, sizeof(message));
-      process().unignore_heap(
-        (void *)(std::uintptr_t) message.addr, message.size);
-      break;
+    s_mc_message_ignore_memory_t message;
+    if (size != sizeof(message))
+      xbt_die("Broken messsage");
+    memcpy(&message, buffer, sizeof(message));
+    process().unignore_heap((void*)(std::uintptr_t)message.addr, message.size);
+    break;
     }
 
   case MC_MESSAGE_IGNORE_MEMORY:
     {
-      s_mc_ignore_memory_message_t message;
-      if (size != sizeof(message))
-        xbt_die("Broken messsage");
-      memcpy(&message, buffer, sizeof(message));
-      this->process().ignore_region(message.addr, message.size);
-      break;
+    s_mc_message_ignore_memory_t message;
+    if (size != sizeof(message))
+      xbt_die("Broken messsage");
+    memcpy(&message, buffer, sizeof(message));
+    this->process().ignore_region(message.addr, message.size);
+    break;
     }
 
   case MC_MESSAGE_STACK_REGION:
     {
-      s_mc_stack_region_message_t message;
-      if (size != sizeof(message))
-        xbt_die("Broken messsage");
-      memcpy(&message, buffer, sizeof(message));
-      this->process().stack_areas().push_back(message.stack_region);
+    s_mc_message_stack_region_t message;
+    if (size != sizeof(message))
+      xbt_die("Broken messsage");
+    memcpy(&message, buffer, sizeof(message));
+    this->process().stack_areas().push_back(message.stack_region);
     }
     break;
 
   case MC_MESSAGE_REGISTER_SYMBOL:
     {
-      s_mc_register_symbol_message_t message;
-      if (size != sizeof(message))
-        xbt_die("Broken message");
-      memcpy(&message, buffer, sizeof(message));
-      if (message.callback)
-        xbt_die("Support for client-side function proposition is not implemented.");
-      XBT_DEBUG("Received symbol: %s", message.name);
-
-      if (simgrid::mc::property_automaton == nullptr)
-        simgrid::mc::property_automaton = xbt_automaton_new();
-
-      simgrid::mc::Process* process = &this->process();
-      simgrid::mc::RemotePtr<int> address
-        = simgrid::mc::remote((int*) message.data);
-      simgrid::xbt::add_proposition(simgrid::mc::property_automaton,
-        message.name,
-        [process, address]() { return process->read(address); }
-        );
-
-      break;
+    s_mc_message_register_symbol_t message;
+    if (size != sizeof(message))
+      xbt_die("Broken message");
+    memcpy(&message, buffer, sizeof(message));
+    if (message.callback)
+      xbt_die("Support for client-side function proposition is not implemented.");
+    XBT_DEBUG("Received symbol: %s", message.name);
+
+    if (simgrid::mc::property_automaton == nullptr)
+      simgrid::mc::property_automaton = xbt_automaton_new();
+
+    simgrid::mc::RemoteClient* process  = &this->process();
+    simgrid::mc::RemotePtr<int> address = simgrid::mc::remote((int*)message.data);
+    simgrid::xbt::add_proposition(simgrid::mc::property_automaton, message.name,
+                                  [process, address]() { return process->read(address); });
+
+    break;
     }
 
   case MC_MESSAGE_WAITING:
@@ -388,16 +384,16 @@ void ModelChecker::on_signal(int signo)
   }
 }
 
-void ModelChecker::wait_client(simgrid::mc::Process& process)
+void ModelChecker::wait_for_requests()
 {
-  this->resume(process);
+  this->resume(process());
   if (this->process().running())
     event_base_dispatch(base_);
 }
 
 void ModelChecker::handle_simcall(Transition const& transition)
 {
-  s_mc_simcall_handle_message m;
+  s_mc_message_simcall_handle m;
   memset(&m, 0, sizeof(m));
   m.type  = MC_MESSAGE_SIMCALL_HANDLE;
   m.pid   = transition.pid;
@@ -413,7 +409,7 @@ bool ModelChecker::checkDeadlock()
   int res;
   if ((res = this->process().getChannel().send(MC_MESSAGE_DEADLOCK_CHECK)))
     xbt_die("Could not check deadlock state");
-  s_mc_int_message_t message;
+  mc_message_int_t message;
   ssize_t s = mc_model_checker->process().getChannel().receive(message);
   if (s == -1)
     xbt_die("Could not receive message");
index c238d12..bb733e3 100644 (file)
@@ -19,9 +19,9 @@
 #include <sys/types.h>
 
 #include "src/mc/PageStore.hpp"
-#include "src/mc/Process.hpp"
 #include "src/mc/Transition.hpp"
 #include "src/mc/mc_forward.hpp"
+#include "src/mc/remote/RemoteClient.hpp"
 #include "src/mc/remote/mc_protocol.h"
 
 namespace simgrid {
@@ -38,7 +38,7 @@ class ModelChecker {
   std::set<std::string> hostnames_;
   // This is the parent snapshot of the current state:
   PageStore page_store_;
-  std::unique_ptr<Process> process_;
+  std::unique_ptr<RemoteClient> process_;
   Checker* checker_ = nullptr;
 public:
   std::shared_ptr<simgrid::mc::Snapshot> parent_snapshot_;
@@ -46,13 +46,10 @@ public:
 public:
   ModelChecker(ModelChecker const&) = delete;
   ModelChecker& operator=(ModelChecker const&) = delete;
-  explicit ModelChecker(std::unique_ptr<Process> process);
+  explicit ModelChecker(std::unique_ptr<RemoteClient> process);
   ~ModelChecker();
 
-  Process& process()
-  {
-    return *process_;
-  }
+  RemoteClient& process() { return *process_; }
   PageStore& page_store()
   {
     return page_store_;
@@ -69,15 +66,11 @@ public:
 
   void start();
   void shutdown();
-  void resume(simgrid::mc::Process& process);
+  void resume(simgrid::mc::RemoteClient& process);
   void loop();
   void handle_events(int fd, short events);
-  void wait_client(simgrid::mc::Process& process);
+  void wait_for_requests();
   void handle_simcall(Transition const& transition);
-  void wait_for_requests()
-  {
-    mc_model_checker->wait_client(mc_model_checker->process());
-  }
   void exit(int status);
 
   bool checkDeadlock();
index bfebc40..21ed471 100644 (file)
@@ -165,9 +165,7 @@ XBT_PRIVATE std::shared_ptr<ObjectInformation> createObjectInformation(
   std::vector<simgrid::xbt::VmMap> const& maps, const char* name);
 
 /** Augment the current module with informations about the other ones */
-XBT_PRIVATE void postProcessObjectInformation(
-  simgrid::mc::Process* process, simgrid::mc::ObjectInformation* info);
-
+XBT_PRIVATE void postProcessObjectInformation(simgrid::mc::RemoteClient* process, simgrid::mc::ObjectInformation* info);
 }
 }
 
index 3fbfe3e..104e8ff 100644 (file)
@@ -128,7 +128,7 @@ RegionSnapshot region(
 RegionSnapshot sparse_region(RegionType region_type,
   void *start_addr, void* permanent_addr, size_t size)
 {
-  simgrid::mc::Process* process = &mc_model_checker->process();
+  simgrid::mc::RemoteClient* process = &mc_model_checker->process();
   assert(process != nullptr);
 
   xbt_assert((((uintptr_t)start_addr) & (xbt_pagesize-1)) == 0,
index 7dc4a66..566858b 100644 (file)
@@ -85,7 +85,7 @@ pid_t do_fork(F code)
 
 Session::Session(pid_t pid, int socket)
 {
-  std::unique_ptr<simgrid::mc::Process> process(new simgrid::mc::Process(pid, socket));
+  std::unique_ptr<simgrid::mc::RemoteClient> process(new simgrid::mc::RemoteClient(pid, socket));
   // TODO, automatic detection of the config from the process
   process->privatized(smpi_privatize_global_variables != SMPI_PRIVATIZE_NONE);
   modelChecker_ = std::unique_ptr<ModelChecker>(
@@ -136,7 +136,7 @@ void Session::logState()
 Session* Session::fork(std::function<void()> code)
 {
   // Create a AF_LOCAL socketpair used for exchanging messages
-  // bewteen the model-checker process (ourselves) and the model-checked
+  // between the model-checker process (ourselves) and the model-checked
   // process:
   int res;
   int sockets[2];
index a59df31..308a584 100644 (file)
 #include "xbt/log.h"
 #include "xbt/sysdep.h"
 
-#include "src/mc/mc_comm_pattern.h"
+#include "src/mc/VisitedState.hpp"
+#include "src/mc/mc_comm_pattern.hpp"
 #include "src/mc/mc_private.h"
-#include "src/mc/Process.hpp"
 #include "src/mc/mc_smx.h"
-#include "src/mc/VisitedState.hpp"
+#include "src/mc/remote/RemoteClient.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_VisitedState, mc, "Logging specific to state equality detection mechanisms");
 
@@ -36,7 +36,7 @@ static int snapshot_compare(simgrid::mc::VisitedState* state1, simgrid::mc::Visi
 /** @brief Save the current state */
 VisitedState::VisitedState(unsigned long state_number)
 {
-  simgrid::mc::Process* process = &(mc_model_checker->process());
+  simgrid::mc::RemoteClient* process = &(mc_model_checker->process());
   this->heap_bytes_used = mmalloc_get_bytes_used_remote(
     process->get_heap()->heaplimit,
     process->get_malloc_info());
index aa07b43..951ceb4 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2016. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2016-2017. 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. */
@@ -11,7 +10,7 @@
 
 #include "src/mc/VisitedState.hpp"
 #include "src/mc/checker/Checker.hpp"
-#include "src/mc/mc_comm_pattern.h"
+#include "src/mc/mc_comm_pattern.hpp"
 #include "src/mc/mc_forward.hpp"
 
 #ifndef SIMGRID_MC_COMMUNICATION_DETERMINISM_CHECKER_HPP
index f65fff1..01ab0ac 100644 (file)
@@ -44,7 +44,7 @@ VisitedPair::VisitedPair(
   std::shared_ptr<const std::vector<int>> atomic_propositions,
   std::shared_ptr<simgrid::mc::State> graph_state)
 {
-  simgrid::mc::Process* process = &(mc_model_checker->process());
+  simgrid::mc::RemoteClient* process = &(mc_model_checker->process());
 
   this->graph_state = std::move(graph_state);
   if(this->graph_state->system_state == nullptr)
index e9af0b5..ffcff71 100644 (file)
@@ -22,7 +22,7 @@
 #include "src/mc/Session.hpp"
 #include "src/mc/checker/Checker.hpp"
 #include "src/mc/mc_base.h"
-#include "src/mc/mc_comm_pattern.h"
+#include "src/mc/mc_comm_pattern.hpp"
 #include "src/mc/mc_exit.h"
 #include "src/mc/mc_private.h"
 #include "src/mc/mc_safety.h"
index e5a873b..1fe48f4 100644 (file)
@@ -316,7 +316,7 @@ static
 int mmalloc_compare_heap(
   simgrid::mc::StateComparator& state, simgrid::mc::Snapshot* snapshot1, simgrid::mc::Snapshot* snapshot2)
 {
-  simgrid::mc::Process* process = &mc_model_checker->process();
+  simgrid::mc::RemoteClient* process = &mc_model_checker->process();
 
   /* Start comparison */
   size_t i1;
@@ -609,7 +609,7 @@ static int compare_heap_area_without_type(
   HeapLocationPairs* previous, int size,
   int check_ignore)
 {
-  simgrid::mc::Process* process = &mc_model_checker->process();
+  simgrid::mc::RemoteClient* process = &mc_model_checker->process();
   mc_mem_region_t heap_region1 = MC_get_heap_region(snapshot1);
   mc_mem_region_t heap_region2 = MC_get_heap_region(snapshot2);
 
@@ -965,7 +965,7 @@ int compare_heap_area(simgrid::mc::StateComparator& state, int process_index,
                       HeapLocationPairs* previous,
                       simgrid::mc::Type* type, int pointer_level)
 {
-  simgrid::mc::Process* process = &mc_model_checker->process();
+  simgrid::mc::RemoteClient* process = &mc_model_checker->process();
 
   int res_compare;
   ssize_t block1;
@@ -1276,7 +1276,7 @@ static int compare_areas_with_type(simgrid::mc::StateComparator& state,
                                    void* real_area2, simgrid::mc::Snapshot* snapshot2, mc_mem_region_t region2,
                                    simgrid::mc::Type* type, int pointer_level)
 {
-  simgrid::mc::Process* process = &mc_model_checker->process();
+  simgrid::mc::RemoteClient* process = &mc_model_checker->process();
 
   simgrid::mc::Type* subtype;
   simgrid::mc::Type* subsubtype;
@@ -1479,11 +1479,9 @@ static int compare_global_variables(
                (char *) current_var.address);
       return 1;
     }
-
   }
 
   return 0;
-
 }
 
 static int compare_local_variables(simgrid::mc::StateComparator& state,
@@ -1500,7 +1498,6 @@ static int compare_local_variables(simgrid::mc::StateComparator& state,
 
     unsigned int cursor = 0;
     local_variable_t current_var1, current_var2;
-    int res;
     while (cursor < stack1->local_variables.size()) {
       current_var1 = &stack1->local_variables[cursor];
       current_var2 = &stack1->local_variables[cursor];
@@ -1521,22 +1518,18 @@ static int compare_local_variables(simgrid::mc::StateComparator& state,
       // TODO, fix current_varX->subprogram->name to include name if DW_TAG_inlined_subprogram
 
         simgrid::mc::Type* subtype = current_var1->type;
-        res =
-            compare_areas_with_type(state, process_index,
-                                    current_var1->address, snapshot1, mc_get_snapshot_region(current_var1->address, snapshot1, process_index),
-                                    current_var2->address, snapshot2, mc_get_snapshot_region(current_var2->address, snapshot2, process_index),
-                                    subtype, 0);
-
-      if (res == 1) {
-        // TODO, fix current_varX->subprogram->name to include name if DW_TAG_inlined_subprogram
-        XBT_VERB
-            ("Local variable %s (%p - %p) in frame %s "
-             "is different between snapshots",
-             current_var1->name.c_str(),
-             current_var1->address,
-             current_var2->address,
-             current_var1->subprogram->name.c_str());
-        return res;
+        int res                    = compare_areas_with_type(
+            state, process_index, current_var1->address, snapshot1,
+            mc_get_snapshot_region(current_var1->address, snapshot1, process_index), current_var2->address, snapshot2,
+            mc_get_snapshot_region(current_var2->address, snapshot2, process_index), subtype, 0);
+
+        if (res == 1) {
+          // TODO, fix current_varX->subprogram->name to include name if DW_TAG_inlined_subprogram
+          XBT_VERB("Local variable %s (%p - %p) in frame %s "
+                   "is different between snapshots",
+                   current_var1->name.c_str(), current_var1->address, current_var2->address,
+                   current_var1->subprogram->name.c_str());
+          return res;
       }
       cursor++;
     }
@@ -1557,7 +1550,7 @@ int snapshot_compare(int num1, simgrid::mc::Snapshot* s1, int num2, simgrid::mc:
   else
     state_comparator->clear();
 
-  simgrid::mc::Process* process = &mc_model_checker->process();
+  simgrid::mc::RemoteClient* process = &mc_model_checker->process();
 
   int errors = 0;
 
index f367c99..e567c57 100644 (file)
@@ -63,115 +63,112 @@ void wait_for_requests()
  * Only WAIT operations (on comm, on mutex, etc) can ever return false because they could lock the MC exploration.
  * Wait operations are OK and return true in only two situations:
  *  - if the wait will succeed immediately (if both peer of the comm are there already or if the mutex is available)
- *  - if a timeout is provided, because we can fire the timeout if the transition is not ready without blocking in this transition for ever.
+ *  - if a timeout is provided, because we can fire the timeout if the transition is not ready without blocking in this
+ * transition for ever.
  *
  */
 // Called from both MCer and MCed:
-bool request_is_enabled(smx_simcall_t req)
+bool actor_is_enabled(smx_actor_t actor)
 {
+  smx_simcall_t req = &actor->simcall;
   // TODO, add support for the subtypes?
 
   switch (req->call) {
-  case SIMCALL_NONE:
-    return false;
+    case SIMCALL_NONE:
+      return false;
 
-  case SIMCALL_COMM_WAIT:
-  {
-    /* FIXME: check also that src and dst processes are not suspended */
-    simgrid::kernel::activity::CommImpl* act =
-        static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__getraw__comm(req));
+    case SIMCALL_COMM_WAIT: {
+      /* FIXME: check also that src and dst processes are not suspended */
+      simgrid::kernel::activity::CommImpl* act =
+          static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__getraw__comm(req));
 
 #if SIMGRID_HAVE_MC
-    // Fetch from MCed memory:
-    // HACK, type puning
-    if (mc_model_checker != nullptr) {
-      simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
-      mc_model_checker->process().read(temp_comm, remote(act));
-      act = static_cast<simgrid::kernel::activity::CommImpl*>(temp_comm.getBuffer());
-    }
+      // Fetch from MCed memory:
+      // HACK, type puning
+      if (mc_model_checker != nullptr) {
+        simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
+        mc_model_checker->process().read(temp_comm, remote(act));
+        act = static_cast<simgrid::kernel::activity::CommImpl*>(temp_comm.getBuffer());
+      }
 #endif
 
-    if (act->src_timeout || act->dst_timeout) {
-      /* If it has a timeout it will be always be enabled (regardless of who declared the timeout),
-       * because even if the communication is not ready, it can timeout and won't block. */
-      if (_sg_mc_timeout == 1)
-        return true;
-    }
-    /* On the other hand if it hasn't a timeout, check if the comm is ready.*/
-    else if (act->detached && act->src_proc == nullptr
-          && act->type == SIMIX_COMM_READY)
+      if (act->src_timeout || act->dst_timeout) {
+        /* If it has a timeout it will be always be enabled (regardless of who declared the timeout),
+         * because even if the communication is not ready, it can timeout and won't block. */
+        if (_sg_mc_timeout == 1)
+          return true;
+      }
+      /* On the other hand if it hasn't a timeout, check if the comm is ready.*/
+      else if (act->detached && act->src_proc == nullptr && act->type == SIMIX_COMM_READY)
         return (act->dst_proc != nullptr);
-    return (act->src_proc && act->dst_proc);
-  }
+      return (act->src_proc && act->dst_proc);
+    }
 
-  case SIMCALL_COMM_WAITANY: {
-    xbt_dynar_t comms;
-    simgrid::kernel::activity::CommImpl* act =
-        static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__getraw__comm(req));
+    case SIMCALL_COMM_WAITANY: {
+      xbt_dynar_t comms;
+      simgrid::kernel::activity::CommImpl* act =
+          static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__getraw__comm(req));
 
 #if SIMGRID_HAVE_MC
-    s_xbt_dynar_t comms_buffer;
-    size_t buffer_size = 0;
-    if (mc_model_checker != nullptr) {
-      // Read dynar:
-      mc_model_checker->process().read(
-        &comms_buffer, remote(simcall_comm_waitany__get__comms(req)));
-      assert(comms_buffer.elmsize == sizeof(act));
-      buffer_size = comms_buffer.elmsize * comms_buffer.used;
-      comms = &comms_buffer;
-    } else
-      comms = simcall_comm_waitany__get__comms(req);
-
-    // Read all the dynar buffer:
-    char buffer[buffer_size];
-    if (mc_model_checker != nullptr)
-      mc_model_checker->process().read_bytes(buffer, sizeof(buffer),
-        remote(comms->data));
+      s_xbt_dynar_t comms_buffer;
+      size_t buffer_size = 0;
+      if (mc_model_checker != nullptr) {
+        // Read dynar:
+        mc_model_checker->process().read(&comms_buffer, remote(simcall_comm_waitany__get__comms(req)));
+        assert(comms_buffer.elmsize == sizeof(act));
+        buffer_size = comms_buffer.elmsize * comms_buffer.used;
+        comms       = &comms_buffer;
+      } else
+        comms = simcall_comm_waitany__get__comms(req);
+
+      // Read all the dynar buffer:
+      char buffer[buffer_size];
+      if (mc_model_checker != nullptr)
+        mc_model_checker->process().read_bytes(buffer, sizeof(buffer), remote(comms->data));
 #else
-    comms = simcall_comm_waitany__get__comms(req);
+      comms = simcall_comm_waitany__get__comms(req);
 #endif
 
-    for (unsigned int index = 0; index < comms->used; ++index) {
+      for (unsigned int index = 0; index < comms->used; ++index) {
 #if SIMGRID_HAVE_MC
-      // Fetch act from MCed memory:
-      // HACK, type puning
-      simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
-      if (mc_model_checker != nullptr) {
-        memcpy(&act, buffer + comms->elmsize * index, sizeof(act));
-        mc_model_checker->process().read(temp_comm, remote(act));
-        act = static_cast<simgrid::kernel::activity::CommImpl*>(temp_comm.getBuffer());
-      }
-      else
+        // Fetch act from MCed memory:
+        // HACK, type puning
+        simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
+        if (mc_model_checker != nullptr) {
+          memcpy(&act, buffer + comms->elmsize * index, sizeof(act));
+          mc_model_checker->process().read(temp_comm, remote(act));
+          act = static_cast<simgrid::kernel::activity::CommImpl*>(temp_comm.getBuffer());
+        } else
 #endif
-        act = xbt_dynar_get_as(comms, index, simgrid::kernel::activity::CommImpl*);
-      if (act->src_proc && act->dst_proc)
-        return true;
+          act = xbt_dynar_get_as(comms, index, simgrid::kernel::activity::CommImpl*);
+        if (act->src_proc && act->dst_proc)
+          return true;
+      }
+      return false;
     }
-    return false;
-  }
 
-  case SIMCALL_MUTEX_LOCK: {
-    smx_mutex_t mutex = simcall_mutex_lock__get__mutex(req);
+    case SIMCALL_MUTEX_LOCK: {
+      smx_mutex_t mutex = simcall_mutex_lock__get__mutex(req);
 #if SIMGRID_HAVE_MC
-    simgrid::mc::Remote<simgrid::simix::MutexImpl> temp_mutex;
-    if (mc_model_checker != nullptr) {
-      mc_model_checker->process().read(temp_mutex.getBuffer(), remote(mutex));
-      mutex = temp_mutex.getBuffer();
-    }
+      simgrid::mc::Remote<simgrid::simix::MutexImpl> temp_mutex;
+      if (mc_model_checker != nullptr) {
+        mc_model_checker->process().read(temp_mutex.getBuffer(), remote(mutex));
+        mutex = temp_mutex.getBuffer();
+      }
 #endif
 
-    if(mutex->owner == nullptr)
-      return true;
+      if (mutex->owner == nullptr)
+        return true;
 #if SIMGRID_HAVE_MC
-    else if (mc_model_checker != nullptr) {
-      simgrid::mc::Process& modelchecked = mc_model_checker->process();
-      // TODO, *(mutex->owner) :/
-      return modelchecked.resolveActor(simgrid::mc::remote(mutex->owner))->pid ==
-             modelchecked.resolveActor(simgrid::mc::remote(req->issuer))->pid;
-    }
+      else if (mc_model_checker != nullptr) {
+        simgrid::mc::RemoteClient& modelchecked = mc_model_checker->process();
+        // TODO, *(mutex->owner) :/
+        return modelchecked.resolveActor(simgrid::mc::remote(mutex->owner))->pid ==
+               modelchecked.resolveActor(simgrid::mc::remote(req->issuer))->pid;
+      }
 #endif
-    else
-      return mutex->owner->pid == req->issuer->pid;
+      else
+        return mutex->owner->pid == req->issuer->pid;
     }
 
     case SIMCALL_SEM_ACQUIRE: {
index 1f94f1b..54a209b 100644 (file)
 namespace simgrid {
 namespace mc {
 
-/** Can this requests can be executed?
- *
- *  Most requests are always enabled but WAIT and WAITANY
- *  are not always enabled: a WAIT where the communication does not
- *  have both a source and a destination yet is not enabled
- *  (unless timeout is enabled in the wait and enabeld in SimGridMC).
- */
-XBT_PRIVATE bool request_is_enabled(smx_simcall_t req);
-
 /** Execute everything which is invisible
  *
  *  Execute all the processes that are ready to run and all invisible simcalls
@@ -37,6 +28,17 @@ XBT_PRIVATE extern std::vector<double> processes_time;
 /** Execute a given simcall */
 XBT_PRIVATE void handle_simcall(smx_simcall_t req, int req_num);
 
+/** Is the process ready to execute its simcall?
+ *
+ *  This is true if the request associated with the process is ready.
+ *
+ *  Most requests are always enabled but WAIT and WAITANY
+ *  are not always enabled: a WAIT where the communication does not
+ *  have both a source and a destination yet is not enabled
+ *  (unless timeout is enabled in the wait and enabeld in SimGridMC).
+ */
+XBT_PRIVATE bool actor_is_enabled(smx_actor_t process);
+
 /** Check if the given simcall is visible
  *
  *  \return `TRUE` or `FALSE`
index a91ef29..be90588 100644 (file)
@@ -142,7 +142,7 @@ void add_region(int index, simgrid::mc::Snapshot* snapshot,
   return;
 }
 
-static void get_memory_regions(simgrid::mc::Process* process, simgrid::mc::Snapshot* snapshot)
+static void get_memory_regions(simgrid::mc::RemoteClient* process, simgrid::mc::Snapshot* snapshot)
 {
   const size_t n = process->object_infos.size();
   snapshot->snapshot_regions.resize(n + 1);
@@ -283,7 +283,7 @@ static void fill_local_variables_values(mc_stack_frame_t stack_frame,
                                            int process_index,
                                            std::vector<s_local_variable>& result)
 {
-  simgrid::mc::Process* process = &mc_model_checker->process();
+  simgrid::mc::RemoteClient* process = &mc_model_checker->process();
 
   if (not scope || not scope->range.contain(stack_frame->ip))
     return;
@@ -347,7 +347,7 @@ static std::vector<s_local_variable> get_local_variables_values(
 
 static std::vector<s_mc_stack_frame_t> unwind_stack_frames(simgrid::mc::UnwindContext* stack_context)
 {
-  simgrid::mc::Process* process = &mc_model_checker->process();
+  simgrid::mc::RemoteClient* process = &mc_model_checker->process();
   std::vector<s_mc_stack_frame_t> result;
 
   unw_cursor_t c = stack_context->cursor();
@@ -555,7 +555,7 @@ std::shared_ptr<simgrid::mc::Snapshot> take_snapshot(int num_state)
 {
   XBT_DEBUG("Taking snapshot %i", num_state);
 
-  simgrid::mc::Process* mc_process = &mc_model_checker->process();
+  simgrid::mc::RemoteClient* mc_process = &mc_model_checker->process();
 
   std::shared_ptr<simgrid::mc::Snapshot> snapshot = std::make_shared<simgrid::mc::Snapshot>(mc_process, num_state);
 
@@ -595,12 +595,9 @@ void restore_snapshot_regions(simgrid::mc::Snapshot* snapshot)
   }
 
 #if HAVE_SMPI
-  // TODO, send a message to implement this in the MCed process
   if(snapshot->privatization_index >= 0) {
     // Fix the privatization mmap:
-    s_mc_restore_message message;
-    message.type = MC_MESSAGE_RESTORE;
-    message.index = snapshot->privatization_index;
+    s_mc_message_restore message{MC_MESSAGE_RESTORE, snapshot->privatization_index};
     mc_model_checker->process().getChannel().send(message);
   }
 #endif
index 3cf1ff7..fee19b6 100644 (file)
@@ -69,21 +69,21 @@ void MC_automaton_new_propositional_symbol_pointer(const char *name, int* value)
 
 /** @brief Register a stack in the model checker
  *
- *  The stacks are allocated in the heap. The MC handle them especially
+ *  The stacks are allocated in the heap. The MC handle them specifically
  *  when we analyze/compare the content of the heap so it must be told where
  *  they are with this function.
  *
- *  @param stack
- *  @param process Process owning the stack
- *  @param context
+ *  @param stack Where the stack is
+ *  @param actor Actor owning the stack
+ *  @param context The context associated to that stack
  *  @param size    Size of the stack
  */
-void MC_register_stack_area(void *stack, smx_actor_t process, ucontext_t* context, size_t size)
+void MC_register_stack_area(void* stack, smx_actor_t actor, ucontext_t* context, size_t size)
 {
   xbt_assert(mc_model_checker == nullptr);
   if (not MC_is_active())
     return;
-  simgrid::mc::Client::get()->declareStack(stack, size, process, context);
+  simgrid::mc::Client::get()->declareStack(stack, size, actor, context);
 }
 
 void MC_ignore_global_variable(const char *name)
@@ -103,7 +103,7 @@ void MC_ignore_heap(void *address, size_t size)
   simgrid::mc::Client::get()->ignoreHeap(address, size);
 }
 
-void MC_remove_ignore_heap(void *address, size_t size)
+void MC_unignore_heap(void* address, size_t size)
 {
   xbt_assert(mc_model_checker == nullptr);
   if (not MC_is_active())
index 25021c4..3f3d1bd 100644 (file)
@@ -9,10 +9,10 @@
 #include "xbt/sysdep.h"
 #include <xbt/dynar.hpp>
 
-#include "src/mc/mc_comm_pattern.h"
+#include "src/mc/checker/CommunicationDeterminismChecker.hpp"
+#include "src/mc/mc_comm_pattern.hpp"
 #include "src/mc/mc_smx.h"
 #include "src/mc/mc_xbt.hpp"
-#include "src/mc/checker/CommunicationDeterminismChecker.hpp"
 
 using simgrid::mc::remote;
 
similarity index 78%
rename from src/mc/mc_comm_pattern.h
rename to src/mc/mc_comm_pattern.hpp
index b5ac841..0d99b67 100644 (file)
@@ -20,7 +20,6 @@ struct PatternCommunicationList {
   unsigned int index_comm = 0;
   std::vector<std::unique_ptr<simgrid::mc::PatternCommunication>> list;
 };
-
 }
 }
 
@@ -57,21 +56,22 @@ typedef enum {
 
 static inline e_mc_call_type_t MC_get_call_type(smx_simcall_t req)
 {
-  switch(req->call) {
-  case SIMCALL_COMM_ISEND:
-    return MC_CALL_TYPE_SEND;
-  case SIMCALL_COMM_IRECV:
-    return MC_CALL_TYPE_RECV;
-  case SIMCALL_COMM_WAIT:
-    return MC_CALL_TYPE_WAIT;
-  case SIMCALL_COMM_WAITANY:
-    return MC_CALL_TYPE_WAITANY;
-  default:
-    return MC_CALL_TYPE_NONE;
+  switch (req->call) {
+    case SIMCALL_COMM_ISEND:
+      return MC_CALL_TYPE_SEND;
+    case SIMCALL_COMM_IRECV:
+      return MC_CALL_TYPE_RECV;
+    case SIMCALL_COMM_WAIT:
+      return MC_CALL_TYPE_WAIT;
+    case SIMCALL_COMM_WAITANY:
+      return MC_CALL_TYPE_WAITANY;
+    default:
+      return MC_CALL_TYPE_NONE;
   }
 }
 
-XBT_PRIVATE void MC_handle_comm_pattern(e_mc_call_type_t call_type, smx_simcall_t request, int value, xbt_dynar_t current_pattern, int backtracking);
+XBT_PRIVATE void MC_handle_comm_pattern(e_mc_call_type_t call_type, smx_simcall_t request, int value,
+                                        xbt_dynar_t current_pattern, int backtracking);
 
 XBT_PRIVATE void MC_restore_communications_pattern(simgrid::mc::State* state);
 
index 8cc387c..47b5771 100644 (file)
@@ -28,9 +28,9 @@
 #include "src/mc/mc_private.h"
 #include "src/mc/mc_dwarf.hpp"
 
-#include "src/mc/Process.hpp"
 #include "src/mc/ObjectInformation.hpp"
 #include "src/mc/Variable.hpp"
+#include "src/mc/remote/RemoteClient.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_dwarf, mc, "DWARF processing");
 
@@ -1371,7 +1371,7 @@ std::shared_ptr<simgrid::mc::ObjectInformation> createObjectInformation(
 
 /*************************************************************************/
 
-void postProcessObjectInformation(simgrid::mc::Process* process, simgrid::mc::ObjectInformation* info)
+void postProcessObjectInformation(simgrid::mc::RemoteClient* process, simgrid::mc::ObjectInformation* info)
 {
   for (auto& i : info->types) {
 
index 8bc8105..6471c6f 100644 (file)
@@ -19,7 +19,7 @@ class PageStore;
 class ChunkedData;
 class ModelChecker;
 class AddressSpace;
-class Process;
+class RemoteClient;
 class Snapshot;
 class ObjectInformation;
 class Member;
index 8713d54..07eeace 100644 (file)
 #include "src/simix/ActorImpl.hpp"
 
 #if SIMGRID_HAVE_MC
-#include <libunwind.h>
-#include "src/mc/mc_comm_pattern.h"
+#include "src/mc/checker/Checker.hpp"
+#include "src/mc/mc_comm_pattern.hpp"
+#include "src/mc/mc_private.h"
 #include "src/mc/mc_request.h"
 #include "src/mc/mc_safety.h"
+#include "src/mc/mc_smx.h"
 #include "src/mc/mc_snapshot.h"
-#include "src/mc/mc_private.h"
 #include "src/mc/mc_unw.h"
-#include "src/mc/mc_smx.h"
-#include "src/mc/checker/Checker.hpp"
+#include <libunwind.h>
 #endif
 
 #include "src/mc/Transition.hpp"
index 7677ad1..5c6f2bf 100644 (file)
@@ -30,8 +30,8 @@ extern "C" {
  *  @param page_count       Number of pages of the region
  *  @param pagenos
  */
-void mc_restore_page_snapshot_region(simgrid::mc::Process* process,
-  void* start_addr, simgrid::mc::ChunkedData const& pages_copy)
+void mc_restore_page_snapshot_region(simgrid::mc::RemoteClient* process, void* start_addr,
+                                     simgrid::mc::ChunkedData const& pages_copy)
 {
   for (size_t i = 0; i != pages_copy.page_count(); ++i) {
     // Otherwise, copy the page:
@@ -43,7 +43,7 @@ void mc_restore_page_snapshot_region(simgrid::mc::Process* process,
 
 // ***** High level API
 
-void mc_region_restore_sparse(simgrid::mc::Process* process, mc_mem_region_t reg)
+void mc_region_restore_sparse(simgrid::mc::RemoteClient* process, mc_mem_region_t reg)
 {
   xbt_assert(((reg->permanent_address().address()) & (xbt_pagesize-1)) == 0,
     "Not at the beginning of a page");
index 62a4fa8..ce2bfa2 100644 (file)
@@ -54,11 +54,11 @@ void replay(RecordTrace const& trace)
     // Choose a request:
     smx_actor_t process = SIMIX_process_from_PID(transition.pid);
     if (not process)
-      xbt_die("Unexpected process.");
+      xbt_die("Unexpected process (pid:%d).", transition.pid);
     smx_simcall_t simcall = &(process->simcall);
     if (not simcall || simcall->call == SIMCALL_NONE)
-      xbt_die("No simcall for this process.");
-    if (not simgrid::mc::request_is_visible(simcall) || not simgrid::mc::request_is_enabled(simcall))
+      xbt_die("No simcall for process %d.", transition.pid);
+    if (not simgrid::mc::request_is_visible(simcall) || not simgrid::mc::actor_is_enabled(process))
       xbt_die("Unexpected simcall.");
 
     // Execute the request:
index efa8aa7..8879e90 100644 (file)
@@ -1,11 +1,11 @@
-/* Copyright (c) 2008-2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2008-2017. 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. */
 
 #include <cassert>
 
+#include "src/include/mc/mc.h"
 #include "src/mc/ModelChecker.hpp"
 #include "src/mc/mc_request.h"
 #include "src/mc/mc_smx.h"
@@ -199,7 +199,7 @@ static char *buff_size_to_string(size_t buff_size)
 
 std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid::mc::RequestType request_type)
 {
-  xbt_assert(mc_model_checker != nullptr);
+  xbt_assert(mc_model_checker != nullptr, "Must be called from MCer");
 
   bool use_remote_comm = true;
   switch(request_type) {
@@ -432,10 +432,6 @@ bool request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx)
   return comm->src_proc && comm->dst_proc;
 }
 
-bool actor_is_enabled(smx_actor_t actor)
-{
-  return simgrid::mc::request_is_enabled(&actor->simcall);
-}
 
 static const char* colors[] = {
   "blue",
index 2672208..f7085c6 100644 (file)
@@ -23,12 +23,6 @@ XBT_PRIVATE std::string request_to_string(smx_simcall_t req, int value, simgrid:
 
 XBT_PRIVATE bool request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx);
 
-/** Is the process ready to execute its simcall?
- *
- *  This is true if the request associated with the process is ready.
- */
-XBT_PRIVATE bool actor_is_enabled(smx_actor_t process);
-
 XBT_PRIVATE std::string request_get_dot_output(smx_simcall_t req, int value);
 
 }
index 0bcc7ea..cd22b6b 100644 (file)
@@ -31,7 +31,7 @@ static inline simgrid::mc::ActorInformation* actor_info_cast(smx_actor_t actor)
  *  @param target      Local vector (to be filled with copies of `s_smx_actor_t`)
  *  @param remote_swag Address of the process SWAG in the remote list
  */
-static void MC_process_refresh_simix_process_list(simgrid::mc::Process* process,
+static void MC_process_refresh_simix_process_list(simgrid::mc::RemoteClient* process,
                                                   std::vector<simgrid::mc::ActorInformation>& target,
                                                   simgrid::mc::RemotePtr<s_xbt_swag_t> remote_swag)
 {
@@ -57,7 +57,7 @@ static void MC_process_refresh_simix_process_list(simgrid::mc::Process* process,
   assert(i == swag.count);
 }
 
-static void MC_process_refresh_simix_actor_dynar(simgrid::mc::Process* process,
+static void MC_process_refresh_simix_actor_dynar(simgrid::mc::RemoteClient* process,
                                                  std::vector<simgrid::mc::ActorInformation>& target,
                                                  simgrid::mc::RemotePtr<s_xbt_dynar_t> remote_dynar)
 {
@@ -83,9 +83,9 @@ static void MC_process_refresh_simix_actor_dynar(simgrid::mc::Process* process,
 namespace simgrid {
 namespace mc {
 
-void Process::refresh_simix()
+void RemoteClient::refresh_simix()
 {
-  if (this->cache_flags_ & Process::cache_simix_processes)
+  if (this->cache_flags_ & RemoteClient::cache_simix_processes)
     return;
 
   // TODO, avoid to reload `&simix_global`, `simix_global`, `*simix_global`
@@ -109,7 +109,7 @@ void Process::refresh_simix()
   MC_process_refresh_simix_process_list(this, this->smx_dead_actors_infos,
                                         remote(simix_global.getBuffer()->process_to_destroy));
 
-  this->cache_flags_ |= Process::cache_simix_processes;
+  this->cache_flags_ |= RemoteClient::cache_simix_processes;
 }
 
 }
@@ -147,7 +147,7 @@ const char* MC_smx_actor_get_host_name(smx_actor_t actor)
   if (mc_model_checker == nullptr)
     return actor->host->getCname();
 
-  simgrid::mc::Process* process = &mc_model_checker->process();
+  simgrid::mc::RemoteClient* process = &mc_model_checker->process();
 
   /* HACK, Horrible hack to find the offset of the id in the simgrid::s4u::Host.
 
@@ -179,7 +179,7 @@ const char* MC_smx_actor_get_host_name(smx_actor_t actor)
 
 const char* MC_smx_actor_get_name(smx_actor_t actor)
 {
-  simgrid::mc::Process* process = &mc_model_checker->process();
+  simgrid::mc::RemoteClient* process = &mc_model_checker->process();
   if (mc_model_checker == nullptr)
     return actor->name.c_str();
 
index 28d20b7..be72eaa 100644 (file)
@@ -6,7 +6,7 @@
 #ifndef SIMGRID_MC_SMX_H
 #define SIMGRID_MC_SMX_H
 
-#include "src/mc/Process.hpp"
+#include "src/mc/remote/RemoteClient.hpp"
 
 /** @file
  *  @brief (Cross-process, MCer/MCed) Access to SMX structures
index 80c0817..a79de0e 100644 (file)
@@ -159,7 +159,7 @@ int MC_snapshot_memcmp(
 namespace simgrid {
 namespace mc {
 
-Snapshot::Snapshot(Process* process, int _num_state)
+Snapshot::Snapshot(RemoteClient* process, int _num_state)
     : AddressSpace(process)
     , num_state(_num_state)
     , heap_bytes_used(0)
@@ -234,7 +234,7 @@ static void test_snapshot(bool sparse_checkpoint) {
   xbt_assert(xbt_pagesize == getpagesize());
   xbt_assert(1 << xbt_pagebits == xbt_pagesize);
 
-  std::unique_ptr<simgrid::mc::Process> process(new simgrid::mc::Process(getpid(), -1));
+  std::unique_ptr<simgrid::mc::RemoteClient> process(new simgrid::mc::RemoteClient(getpid(), -1));
   process->init();
   mc_model_checker = new ::simgrid::mc::ModelChecker(std::move(process));
 
index a5c7c17..03a47e5 100644 (file)
@@ -20,7 +20,7 @@ SG_BEGIN_DECL()
 
 // ***** Snapshot region
 
-XBT_PRIVATE void mc_region_restore_sparse(simgrid::mc::Process* process, mc_mem_region_t reg);
+XBT_PRIVATE void mc_region_restore_sparse(simgrid::mc::RemoteClient* process, mc_mem_region_t reg);
 
 static XBT_ALWAYS_INLINE void* mc_translate_address_region_chunked(uintptr_t addr, mc_mem_region_t region)
 {
@@ -118,7 +118,7 @@ namespace mc {
 
 class XBT_PRIVATE Snapshot final : public AddressSpace {
 public:
-  Snapshot(Process* process, int num_state);
+  Snapshot(RemoteClient* process, int num_state);
   ~Snapshot() = default;
   const void* read_bytes(void* buffer, std::size_t size,
     RemotePtr<void> address, int process_index = ProcessIndexAny,
@@ -170,9 +170,8 @@ XBT_PRIVATE void restore_snapshot(std::shared_ptr<simgrid::mc::Snapshot> snapsho
 
 extern "C" {
 
-XBT_PRIVATE void mc_restore_page_snapshot_region(
-  simgrid::mc::Process* process,
-  void* start_addr, simgrid::mc::ChunkedData const& pagenos);
+XBT_PRIVATE void mc_restore_page_snapshot_region(simgrid::mc::RemoteClient* process, void* start_addr,
+                                                 simgrid::mc::ChunkedData const& pagenos);
 
 const void* MC_region_read_fragmented(
   mc_mem_region_t region, void* target, const void* addr, std::size_t size);
index f606492..94ef188 100644 (file)
 #include "xbt/log.h"
 #include "xbt/sysdep.h"
 
-#include "src/simix/smx_private.h"
-#include "src/mc/mc_state.h"
-#include "src/mc/mc_request.h"
+#include "src/mc/Transition.hpp"
+#include "src/mc/mc_comm_pattern.hpp"
 #include "src/mc/mc_private.h"
-#include "src/mc/mc_comm_pattern.h"
+#include "src/mc/mc_request.h"
 #include "src/mc/mc_smx.h"
+#include "src/mc/mc_state.h"
 #include "src/mc/mc_xbt.hpp"
-#include "src/mc/Transition.hpp"
+#include "src/simix/smx_private.h"
 
 using simgrid::mc::remote;
 
@@ -80,8 +80,6 @@ static inline smx_simcall_t MC_state_get_request_for_process(
   state->transition.argument           = -1;
   state->executed_req.call             = SIMCALL_NONE;
 
-  if (not procstate->isTodo())
-    return nullptr; // Not considered by the checker algorithm
   if (not simgrid::mc::actor_is_enabled(actor))
     return nullptr; // Not executable in the application
 
@@ -225,6 +223,10 @@ static inline smx_simcall_t MC_state_get_request_for_process(
 smx_simcall_t MC_state_get_request(simgrid::mc::State* state)
 {
   for (auto& actor : mc_model_checker->process().actors()) {
+    /* Only consider the actors that were marked as interleaving by the checker algorithm */
+    if (not state->actorStates[actor.copy.getBuffer()->pid].isTodo())
+      continue;
+
     smx_simcall_t res = MC_state_get_request_for_process(state, actor.copy.getBuffer());
     if (res)
       return res;
index f172da7..6b2d206 100644 (file)
@@ -22,9 +22,9 @@ typedef register_t greg_t;
 
 #include <libunwind.h>
 
-#include "src/mc/Process.hpp"
-#include "src/mc/mc_unw.h"
 #include "src/mc/Frame.hpp"
+#include "src/mc/mc_unw.h"
+#include "src/mc/remote/RemoteClient.hpp"
 
 using simgrid::mc::remote;
 
@@ -236,7 +236,7 @@ void UnwindContext::clear()
   process_ = nullptr;
 }
 
-void UnwindContext::initialize(simgrid::mc::Process* process, unw_context_t* c)
+void UnwindContext::initialize(simgrid::mc::RemoteClient* process, unw_context_t* c)
 {
   clear();
 
index 2200b5f..6a6b861 100644 (file)
  */
 
 #include "src/mc/mc_forward.hpp"
+#include "xbt/base.h"
 
 #include <libunwind.h>
+#include <stdio.h>
 #include <sys/types.h>
 
 namespace simgrid {
@@ -44,13 +46,13 @@ namespace mc {
 
 class UnwindContext {
   simgrid::mc::AddressSpace* addressSpace_ = nullptr;
-  simgrid::mc::Process* process_           = nullptr;
+  simgrid::mc::RemoteClient* process_      = nullptr;
   unw_context_t unwindContext_;
 
 public:
   UnwindContext() = default;
   ~UnwindContext() { clear(); }
-  void initialize(simgrid::mc::Process* process, unw_context_t* c);
+  void initialize(simgrid::mc::RemoteClient* process, unw_context_t* c);
   void clear();
   unw_cursor_t cursor();
 
index 148a2f5..f9115be 100644 (file)
@@ -11,8 +11,8 @@
 #include <libunwind.h>
 #include <libunwind-ptrace.h>
 
-#include "src/mc/Process.hpp"
 #include "src/mc/mc_unw.h"
+#include "src/mc/remote/RemoteClient.hpp"
 
 /** \file
  *  Libunwind namespace implementation using process_vm_readv.
index 51b37af..dae03e7 100644 (file)
@@ -33,7 +33,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_client, mc, "MC client logic");
 namespace simgrid {
 namespace mc {
 
-std::unique_ptr<Client> Client::client_;
+std::unique_ptr<Client> Client::instance_;
 
 Client* Client::initialize()
 {
@@ -43,8 +43,8 @@ Client* Client::initialize()
     return nullptr;
 
   // Do not break if we are called multiple times:
-  if (client_)
-    return client_.get();
+  if (instance_)
+    return instance_.get();
 
   _sg_do_model_check = 1;
 
@@ -65,7 +65,7 @@ Client* Client::initialize()
     xbt_die("Unexpected socket type %i", type);
   XBT_DEBUG("Model-checked application found expected socket type");
 
-  client_ = std::unique_ptr<Client>(new simgrid::mc::Client(fd));
+  instance_ = std::unique_ptr<Client>(new simgrid::mc::Client(fd));
 
   // Wait for the model-checker:
   errno = 0;
@@ -79,8 +79,44 @@ Client* Client::initialize()
   if (errno != 0 || raise(SIGSTOP) != 0)
     xbt_die("Could not wait for the model-checker");
 
-  client_->handleMessages();
-  return client_.get();
+  instance_->handleMessages();
+  return instance_.get();
+}
+
+void Client::handleDeadlockCheck(mc_message_t* msg)
+{
+  bool deadlock = false;
+  if (not simix_global->process_list.empty()) {
+    deadlock = true;
+    for (auto kv : simix_global->process_list)
+      if (simgrid::mc::actor_is_enabled(kv.second)) {
+        deadlock = false;
+        break;
+      }
+  }
+
+  // Send result:
+  mc_message_int_t answer{MC_MESSAGE_DEADLOCK_CHECK_REPLY, deadlock};
+  xbt_assert(channel_.send(answer) == 0, "Could not send response");
+}
+void Client::handleContinue(mc_message_t* msg)
+{
+  /* Nothing to do */
+}
+void Client::handleSimcall(s_mc_message_simcall_handle_t* message)
+{
+  smx_actor_t process = SIMIX_process_from_PID(message->pid);
+  if (not process)
+    xbt_die("Invalid pid %lu", (unsigned long)message->pid);
+  SIMIX_simcall_handle(&process->simcall, message->value);
+  if (channel_.send(MC_MESSAGE_WAITING))
+    xbt_die("Could not send MESSAGE_WAITING to model-checker");
+}
+void Client::handleRestore(s_mc_message_restore_t* message)
+{
+#if HAVE_SMPI
+  smpi_really_switch_data_segment(message->index);
+#endif
 }
 
 void Client::handleMessages()
@@ -89,64 +125,42 @@ void Client::handleMessages()
     XBT_DEBUG("Waiting messages from model-checker");
 
     char message_buffer[MC_MESSAGE_LENGTH];
-    ssize_t received_size;
+    ssize_t received_size = channel_.receive(&message_buffer, sizeof(message_buffer));
 
-    if ((received_size = channel_.receive(&message_buffer, sizeof(message_buffer))) < 0)
+    if (received_size < 0)
       xbt_die("Could not receive commands from the model-checker");
 
-    s_mc_message_t message;
-    if ((size_t)received_size < sizeof(message))
-      xbt_die("Received message is too small");
-    memcpy(&message, message_buffer, sizeof(message));
-    switch (message.type) {
-
-      case MC_MESSAGE_DEADLOCK_CHECK: {
-        // Check deadlock:
-        bool deadlock = false;
-        if (not simix_global->process_list.empty()) {
-          deadlock = true;
-          for (auto kv : simix_global->process_list)
-            if (simgrid::mc::actor_is_enabled(kv.second)) {
-              deadlock = false;
-              break;
-            }
-        }
-
-        // Send result:
-        s_mc_int_message_t answer;
-        answer.type  = MC_MESSAGE_DEADLOCK_CHECK_REPLY;
-        answer.value = deadlock;
-        xbt_assert(channel_.send(answer) == 0, "Could not send response");
-      } break;
+    mc_message_t* message = (mc_message_t*)message_buffer;
+    switch (message->type) {
+
+      case MC_MESSAGE_DEADLOCK_CHECK:
+        xbt_assert(received_size == sizeof(mc_message_t), "Unexpected size for DEADLOCK_CHECK (%zu != %zu)",
+                   received_size, sizeof(mc_message_t));
+        handleDeadlockCheck(message);
+        break;
 
       case MC_MESSAGE_CONTINUE:
+        xbt_assert(received_size == sizeof(mc_message_t), "Unexpected size for MESSAGE_CONTINUE (%zu != %zu)",
+                   received_size, sizeof(mc_message_t));
+        handleContinue(message);
         return;
 
-      case MC_MESSAGE_SIMCALL_HANDLE: {
-        s_mc_simcall_handle_message_t message;
-        if (received_size != sizeof(message))
-          xbt_die("Unexpected size for SIMCALL_HANDLE");
-        memcpy(&message, message_buffer, sizeof(message));
-        smx_actor_t process = SIMIX_process_from_PID(message.pid);
-        if (not process)
-          xbt_die("Invalid pid %lu", (unsigned long)message.pid);
-        SIMIX_simcall_handle(&process->simcall, message.value);
-        if (channel_.send(MC_MESSAGE_WAITING))
-          xbt_die("Could not send MESSAGE_WAITING to model-checker");
-      } break;
-
-      case MC_MESSAGE_RESTORE: {
-        s_mc_restore_message_t message;
-        if (received_size != sizeof(message))
-          xbt_die("Unexpected size for SIMCALL_HANDLE");
-        memcpy(&message, message_buffer, sizeof(message));
-#if HAVE_SMPI
-        smpi_really_switch_data_segment(message.index);
-#endif
-      } break;
+      case MC_MESSAGE_SIMCALL_HANDLE:
+        xbt_assert(received_size == sizeof(s_mc_message_simcall_handle_t),
+                   "Unexpected size for SIMCALL_HANDLE (%zu != %zu)", received_size,
+                   sizeof(s_mc_message_simcall_handle_t));
+        handleSimcall((s_mc_message_simcall_handle_t*)message_buffer);
+        break;
+
+      case MC_MESSAGE_RESTORE:
+        xbt_assert(received_size == sizeof(mc_message_t), "Unexpected size for MESSAGE_RESTORE (%zu != %zu)",
+                   received_size, sizeof(mc_message_t));
+        handleRestore((s_mc_message_restore_t*)message_buffer);
+        break;
 
       default:
-        xbt_die("Received unexpected message %s (%i)", MC_message_type_name(message.type), message.type);
+        xbt_die("Received unexpected message %s (%i)", MC_message_type_name(message->type), message->type);
+        break;
     }
   }
 }
@@ -169,7 +183,7 @@ void Client::reportAssertionFailure(const char* description)
 
 void Client::ignoreMemory(void* addr, std::size_t size)
 {
-  s_mc_ignore_memory_message_t message;
+  s_mc_message_ignore_memory_t message;
   message.type = MC_MESSAGE_IGNORE_MEMORY;
   message.addr = (std::uintptr_t)addr;
   message.size = size;
@@ -181,7 +195,7 @@ void Client::ignoreHeap(void* address, std::size_t size)
 {
   xbt_mheap_t heap = mmalloc_get_current_heap();
 
-  s_mc_ignore_heap_message_t message;
+  s_mc_message_ignore_heap_t message;
   message.type    = MC_MESSAGE_IGNORE_HEAP;
   message.address = address;
   message.size    = size;
@@ -200,7 +214,7 @@ void Client::ignoreHeap(void* address, std::size_t size)
 
 void Client::unignoreHeap(void* address, std::size_t size)
 {
-  s_mc_ignore_memory_message_t message;
+  s_mc_message_ignore_memory_t message;
   message.type = MC_MESSAGE_UNIGNORE_HEAP;
   message.addr = (std::uintptr_t)address;
   message.size = size;
@@ -210,7 +224,7 @@ void Client::unignoreHeap(void* address, std::size_t size)
 
 void Client::declareSymbol(const char* name, int* value)
 {
-  s_mc_register_symbol_message_t message;
+  s_mc_message_register_symbol_t message;
   message.type = MC_MESSAGE_REGISTER_SYMBOL;
   if (strlen(name) + 1 > sizeof(message.name))
     xbt_die("Symbol is too long");
@@ -238,7 +252,7 @@ void Client::declareStack(void* stack, size_t size, smx_actor_t process, ucontex
 #endif
     region.process_index = -1;
 
-  s_mc_stack_region_message_t message;
+  s_mc_message_stack_region_t message;
   message.type         = MC_MESSAGE_STACK_REGION;
   message.stack_region = region;
   if (channel_.send(message))
index 6d2dadc..b9059a3 100644 (file)
@@ -30,12 +30,20 @@ class XBT_PUBLIC() Client {
 private:
   bool active_ = false;
   Channel channel_;
-  static std::unique_ptr<Client> client_;
+  static std::unique_ptr<Client> instance_;
 
 public:
   Client();
   explicit Client(int fd) : active_(true), channel_(fd) {}
   void handleMessages();
+
+private:
+  void handleDeadlockCheck(mc_message_t* msg);
+  void handleContinue(mc_message_t* msg);
+  void handleSimcall(s_mc_message_simcall_handle_t* message);
+  void handleRestore(s_mc_message_restore_t* msg);
+
+public:
   Channel const& getChannel() const { return channel_; }
   Channel& getChannel() { return channel_; }
   void mainLoop();
@@ -51,7 +59,7 @@ public:
   // Singleton :/
   // TODO, remove the singleton antipattern.
   static Client* initialize();
-  static Client* get() { return client_.get(); }
+  static Client* get() { return instance_.get(); }
 };
 }
 }
similarity index 72%
rename from src/mc/Process.cpp
rename to src/mc/remote/RemoteClient.cpp
index d4d71ea..6046e09 100644 (file)
@@ -6,44 +6,43 @@
 #define _FILE_OFFSET_BITS 64 /* needed for pread_whole to work as expected on 32bits */
 
 #include <assert.h>
+#include <errno.h>
 #include <stddef.h>
 #include <stdint.h>
-#include <errno.h>
 
 #include <sys/ptrace.h>
 
 #include <cstdio>
 
-#include <sys/types.h>
 #include <fcntl.h>
-#include <unistd.h>
 #include <regex.h>
 #include <sys/mman.h> // PROT_*
+#include <sys/types.h>
+#include <unistd.h>
 
 #include <pthread.h>
 
 #include <libgen.h>
 
-#include <libunwind.h>
 #include <libunwind-ptrace.h>
+#include <libunwind.h>
 
 #include "xbt/base.h"
 #include "xbt/log.h"
 #include <xbt/mmalloc.h>
 
-#include "src/mc/mc_unw.h"
-#include "src/mc/mc_snapshot.h"
 #include "src/mc/mc_smx.h"
+#include "src/mc/mc_snapshot.h"
+#include "src/mc/mc_unw.h"
 
-#include "src/mc/Process.hpp"
 #include "src/mc/AddressSpace.hpp"
 #include "src/mc/ObjectInformation.hpp"
 #include "src/mc/Variable.hpp"
+#include "src/mc/remote/RemoteClient.hpp"
 
 using simgrid::mc::remote;
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_process, mc,
-                                "MC process information");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_process, mc, "MC process information");
 
 // ***** Helper stuff
 
@@ -107,7 +106,7 @@ static bool is_simgrid_lib(const char* libname)
 static bool is_filtered_lib(const char* libname)
 {
   for (const char* filtered_lib : filtered_libraries)
-    if (strcmp(libname, filtered_lib)==0)
+    if (strcmp(libname, filtered_lib) == 0)
       return true;
   return false;
 }
@@ -122,7 +121,7 @@ static char* get_lib_name(const char* pathname, struct s_mc_memory_map_re* res)
   char* map_basename = xbt_basename(pathname);
 
   regmatch_t match;
-  if(regexec(&res->so_re, map_basename, 1, &match, 0)) {
+  if (regexec(&res->so_re, map_basename, 1, &match, 0)) {
     free(map_basename);
     return nullptr;
   }
@@ -134,24 +133,24 @@ static char* get_lib_name(const char* pathname, struct s_mc_memory_map_re* res)
   // Strip the version suffix:
   if (libname && not regexec(&res->version_re, libname, 1, &match, 0)) {
     char* temp = libname;
-    libname = strndup(temp, match.rm_so);
+    libname    = strndup(temp, match.rm_so);
     free(temp);
   }
 
   return libname;
 }
 
-static ssize_t pread_whole(int fd, void *buf, size_t count, off_t offset)
+static ssize_t pread_whole(int fd, voidbuf, size_t count, off_t offset)
 {
-  char* buffer = (char*) buf;
+  char* buffer       = (char*)buf;
   ssize_t real_count = count;
   while (count) {
     ssize_t res = pread(fd, buffer, count, offset);
     if (res > 0) {
-      count  -= res;
+      count -= res;
       buffer += res;
       offset += res;
-    } else if (res==0)
+    } else if (res == 0)
       return -1;
     else if (errno != EINTR) {
       perror("pread_whole");
@@ -161,17 +160,17 @@ static ssize_t pread_whole(int fd, void *buf, size_t count, off_t offset)
   return real_count;
 }
 
-static ssize_t pwrite_whole(int fd, const void *buf, size_t count, off_t offset)
+static ssize_t pwrite_whole(int fd, const voidbuf, size_t count, off_t offset)
 {
-  const char* buffer = (const char*) buf;
+  const char* buffer = (const char*)buf;
   ssize_t real_count = count;
   while (count) {
     ssize_t res = pwrite(fd, buffer, count, offset);
     if (res > 0) {
-      count  -= res;
+      count -= res;
       buffer += res;
       offset += res;
-    } else if (res==0)
+    } else if (res == 0)
       return -1;
     else if (errno != EINTR)
       return -1;
@@ -186,7 +185,7 @@ static const size_t zero_buffer_size = 10 * 4096;
 static void zero_buffer_init()
 {
   int fd = open("/dev/zero", O_RDONLY);
-  if (fd<0)
+  if (fd < 0)
     xbt_die("Could not open /dev/zero");
   zero_buffer = mmap(nullptr, zero_buffer_size, PROT_READ, MAP_SHARED, fd, 0);
   if (zero_buffer == MAP_FAILED)
@@ -198,8 +197,8 @@ int open_vm(pid_t pid, int flags)
 {
   const size_t buffer_size = 30;
   char buffer[buffer_size];
-  int res = snprintf(buffer, buffer_size, "/proc/%lli/mem", (long long) pid);
-  if (res < 0 || (size_t) res >= buffer_size) {
+  int res = snprintf(buffer, buffer_size, "/proc/%lli/mem", (long long)pid);
+  if (res < 0 || (size_t)res >= buffer_size) {
     errno = ENAMETOOLONG;
     return -1;
   }
@@ -208,17 +207,17 @@ int open_vm(pid_t pid, int flags)
 
 // ***** Process
 
-Process::Process(pid_t pid, int sockfd) :
-   AddressSpace(this), pid_(pid), channel_(sockfd), running_(true)
-{}
+RemoteClient::RemoteClient(pid_t pid, int sockfd) : AddressSpace(this), pid_(pid), channel_(sockfd), running_(true)
+{
+}
 
-void Process::init()
+void RemoteClient::init()
 {
   this->memory_map_ = simgrid::xbt::get_memory_map(this->pid_);
   this->init_memory_map_info();
 
   int fd = open_vm(this->pid_, O_RDWR);
-  if (fd<0)
+  if (fd < 0)
     xbt_die("Could not open file for process virtual address space");
   this->memory_file = fd;
 
@@ -228,19 +227,17 @@ void Process::init()
     xbt_die("No heap information in the target process");
   if (not std_heap_var->address)
     xbt_die("No constant address for this variable");
-  this->read_bytes(&this->heap_address, sizeof(struct mdesc*),
-    remote(std_heap_var->address),
-    simgrid::mc::ProcessIndexDisabled);
+  this->read_bytes(&this->heap_address, sizeof(struct mdesc*), remote(std_heap_var->address),
+                   simgrid::mc::ProcessIndexDisabled);
 
   this->smx_actors_infos.clear();
   this->smx_dead_actors_infos.clear();
-  this->unw_addr_space = simgrid::mc::UnwindContext::createUnwindAddressSpace();
+  this->unw_addr_space            = simgrid::mc::UnwindContext::createUnwindAddressSpace();
   this->unw_underlying_addr_space = simgrid::unw::create_addr_space();
-  this->unw_underlying_context = simgrid::unw::create_context(
-    this->unw_underlying_addr_space, this->pid_);
+  this->unw_underlying_context    = simgrid::unw::create_context(this->unw_underlying_addr_space, this->pid_);
 }
 
-Process::~Process()
+RemoteClient::~RemoteClient()
 {
   if (this->memory_file >= 0)
     close(this->memory_file);
@@ -260,14 +257,14 @@ Process::~Process()
  *  Do not use directly, this is used by the getters when appropriate
  *  in order to have fresh data.
  */
-void Process::refresh_heap()
+void RemoteClient::refresh_heap()
 {
   // Read/dereference/refresh the std_heap pointer:
   if (not this->heap)
     this->heap = std::unique_ptr<s_xbt_mheap_t>(new s_xbt_mheap_t());
-  this->read_bytes(this->heap.get(), sizeof(struct mdesc),
-    remote(this->heap_address), simgrid::mc::ProcessIndexDisabled);
-  this->cache_flags_ |= Process::cache_heap;
+  this->read_bytes(this->heap.get(), sizeof(struct mdesc), remote(this->heap_address),
+                   simgrid::mc::ProcessIndexDisabled);
+  this->cache_flags_ |= RemoteClient::cache_heap;
 }
 
 /** Refresh the information about the process
@@ -275,32 +272,32 @@ void Process::refresh_heap()
  *  Do not use direclty, this is used by the getters when appropriate
  *  in order to have fresh data.
  * */
-void Process::refresh_malloc_info()
+void RemoteClient::refresh_malloc_info()
 {
   // Refresh process->heapinfo:
-  if (this->cache_flags_ & Process::cache_malloc)
+  if (this->cache_flags_ & RemoteClient::cache_malloc)
     return;
   size_t count = this->heap->heaplimit + 1;
   if (this->heap_info.size() < count)
     this->heap_info.resize(count);
-  this->read_bytes(this->heap_info.data(), count * sizeof(malloc_info),
-    remote(this->heap->heapinfo), simgrid::mc::ProcessIndexDisabled);
-  this->cache_flags_ |= Process::cache_malloc;
+  this->read_bytes(this->heap_info.data(), count * sizeof(malloc_info), remote(this->heap->heapinfo),
+                   simgrid::mc::ProcessIndexDisabled);
+  this->cache_flags_ |= RemoteClient::cache_malloc;
 }
 
 /** @brief Finds the range of the different memory segments and binary paths */
-void Process::init_memory_map_info()
+void RemoteClient::init_memory_map_info()
 {
   XBT_DEBUG("Get debug information ...");
   this->maestro_stack_start_ = nullptr;
-  this->maestro_stack_end_ = nullptr;
+  this->maestro_stack_end_   = nullptr;
   this->object_infos.resize(0);
-  this->binary_info = nullptr;
+  this->binary_info     = nullptr;
   this->libsimgrid_info = nullptr;
 
   struct s_mc_memory_map_re res;
 
-  if(regcomp(&res.so_re, SO_RE, 0) || regcomp(&res.version_re, VERSION_RE, 0))
+  if (regcomp(&res.so_re, SO_RE, 0) || regcomp(&res.version_re, VERSION_RE, 0))
     xbt_die(".so regexp did not compile");
 
   std::vector<simgrid::xbt::VmMap> const& maps = this->memory_map_;
@@ -309,9 +306,9 @@ void Process::init_memory_map_info()
 
   this->object_infos.clear();
 
-  for (size_t i=0; i < maps.size(); i++) {
+  for (size_t i = 0; i < maps.size(); i++) {
     simgrid::xbt::VmMap const& reg = maps[i];
-    const char* pathname = maps[i].pathname.c_str();
+    const char* pathname           = maps[i].pathname.c_str();
 
     // Nothing to do
     if (maps[i].pathname.empty()) {
@@ -323,13 +320,13 @@ void Process::init_memory_map_info()
     if (pathname[0] == '[') {
       if ((reg.prot & PROT_WRITE) && not memcmp(pathname, "[stack]", 7)) {
         this->maestro_stack_start_ = remote(reg.start_addr);
-        this->maestro_stack_end_ = remote(reg.end_addr);
+        this->maestro_stack_end_   = remote(reg.end_addr);
       }
       current_name = nullptr;
       continue;
     }
 
-    if (current_name && strcmp(current_name, pathname)==0)
+    if (current_name && strcmp(current_name, pathname) == 0)
       continue;
 
     current_name = pathname;
@@ -337,7 +334,7 @@ void Process::init_memory_map_info()
       continue;
 
     const bool is_executable = not i;
-    char* libname = nullptr;
+    char* libname            = nullptr;
     if (not is_executable) {
       libname = get_lib_name(pathname, &res);
       if (not libname)
@@ -349,7 +346,7 @@ void Process::init_memory_map_info()
     }
 
     std::shared_ptr<simgrid::mc::ObjectInformation> info =
-      simgrid::mc::createObjectInformation(this->memory_map_, pathname);
+        simgrid::mc::createObjectInformation(this->memory_map_, pathname);
     this->object_infos.push_back(info);
     if (is_executable)
       this->binary_info = info;
@@ -371,42 +368,39 @@ void Process::init_memory_map_info()
   XBT_DEBUG("Get debug information done !");
 }
 
-std::shared_ptr<simgrid::mc::ObjectInformation> Process::find_object_info(RemotePtr<void> addr) const
+std::shared_ptr<simgrid::mc::ObjectInformation> RemoteClient::find_object_info(RemotePtr<void> addr) const
 {
   for (auto const& object_info : this->object_infos)
-    if (addr.address() >= (std::uint64_t)object_info->start
-        && addr.address() <= (std::uint64_t)object_info->end)
+    if (addr.address() >= (std::uint64_t)object_info->start && addr.address() <= (std::uint64_t)object_info->end)
       return object_info;
   return nullptr;
 }
 
-std::shared_ptr<ObjectInformation> Process::find_object_info_exec(RemotePtr<void> addr) const
+std::shared_ptr<ObjectInformation> RemoteClient::find_object_info_exec(RemotePtr<void> addr) const
 {
   for (std::shared_ptr<ObjectInformation> const& info : this->object_infos)
-    if (addr.address() >= (std::uint64_t) info->start_exec
-        && addr.address() <= (std::uint64_t) info->end_exec)
+    if (addr.address() >= (std::uint64_t)info->start_exec && addr.address() <= (std::uint64_t)info->end_exec)
       return info;
   return nullptr;
 }
 
-std::shared_ptr<ObjectInformation> Process::find_object_info_rw(RemotePtr<void> addr) const
+std::shared_ptr<ObjectInformation> RemoteClient::find_object_info_rw(RemotePtr<void> addr) const
 {
   for (std::shared_ptr<ObjectInformation> const& info : this->object_infos)
-    if (addr.address() >= (std::uint64_t)info->start_rw
-        && addr.address() <= (std::uint64_t)info->end_rw)
+    if (addr.address() >= (std::uint64_t)info->start_rw && addr.address() <= (std::uint64_t)info->end_rw)
       return info;
   return nullptr;
 }
 
-simgrid::mc::Frame* Process::find_function(RemotePtr<void> ip) const
+simgrid::mc::Frame* RemoteClient::find_function(RemotePtr<void> ip) const
 {
   std::shared_ptr<simgrid::mc::ObjectInformation> info = this->find_object_info_exec(ip);
-  return info ? info->find_function((void*) ip.address()) : nullptr;
+  return info ? info->find_function((void*)ip.address()) : nullptr;
 }
 
 /** Find (one occurrence of) the named variable definition
  */
-simgrid::mc::Variable* Process::find_variable(const char* name) const
+simgrid::mc::Variable* RemoteClient::find_variable(const char* name) const
 {
   // First lookup the variable in the executable shared object.
   // A global variable used directly by the executable code from a library
@@ -414,7 +408,7 @@ simgrid::mc::Variable* Process::find_variable(const char* name) const
   // We need to look up the variable in the executable first.
   if (this->binary_info) {
     std::shared_ptr<simgrid::mc::ObjectInformation> const& info = this->binary_info;
-    simgrid::mc::Variable* var = info->find_variable(name);
+    simgrid::mc::Variable* var                                  = info->find_variable(name);
     if (var)
       return var;
   }
@@ -428,7 +422,7 @@ simgrid::mc::Variable* Process::find_variable(const char* name) const
   return nullptr;
 }
 
-void Process::read_variable(const char* name, void* target, size_t size) const
+void RemoteClient::read_variable(const char* name, void* target, size_t size) const
 {
   simgrid::mc::Variable* var = this->find_variable(name);
   xbt_assert(var->address, "No simple location for this variable");
@@ -438,7 +432,7 @@ void Process::read_variable(const char* name, void* target, size_t size) const
   this->read_bytes(target, size, remote(var->address));
 }
 
-std::string Process::read_string(RemotePtr<char> address) const
+std::string RemoteClient::read_string(RemotePtr<char> address) const
 {
   if (not address)
     return {};
@@ -448,14 +442,14 @@ std::string Process::read_string(RemotePtr<char> address) const
   off_t off = 0;
 
   while (1) {
-    ssize_t c = pread(this->memory_file, res.data() + off, res.size() - off, (off_t) address.address() + off);
+    ssize_t c = pread(this->memory_file, res.data() + off, res.size() - off, (off_t)address.address() + off);
     if (c == -1) {
       if (errno == EINTR)
         continue;
       else
         xbt_die("Could not read from from remote process");
     }
-    if (c==0)
+    if (c == 0)
       xbt_die("Could not read string from remote process");
 
     void* p = memchr(res.data() + off, '\0', c);
@@ -463,42 +457,39 @@ std::string Process::read_string(RemotePtr<char> address) const
       return std::string(res.data());
 
     off += c;
-    if (off == (off_t) res.size())
+    if (off == (off_t)res.size())
       res.resize(res.size() * 2);
   }
 }
 
-const void *Process::read_bytes(void* buffer, std::size_t size,
-  RemotePtr<void> address, int process_index,
-  ReadOptions options) const
+const void* RemoteClient::read_bytes(void* buffer, std::size_t size, RemotePtr<void> address, int process_index,
+                                     ReadOptions options) const
 {
   if (process_index != simgrid::mc::ProcessIndexDisabled) {
-    std::shared_ptr<simgrid::mc::ObjectInformation> const& info =
-      this->find_object_info_rw((void*)address.address());
-    // Segment overlap is not handled.
+    std::shared_ptr<simgrid::mc::ObjectInformation> const& info = this->find_object_info_rw((void*)address.address());
+// Segment overlap is not handled.
 #if HAVE_SMPI
     if (info.get() && this->privatized(*info)) {
       if (process_index < 0)
         xbt_die("Missing process index");
-      if (process_index >= (int) MC_smpi_process_count())
+      if (process_index >= (int)MC_smpi_process_count())
         xbt_die("Invalid process index");
 
       // Read smpi_privatization_regions from MCed:
       smpi_privatization_region_t remote_smpi_privatization_regions =
-        mc_model_checker->process().read_variable<smpi_privatization_region_t>(
-          "smpi_privatization_regions");
+          mc_model_checker->process().read_variable<smpi_privatization_region_t>("smpi_privatization_regions");
 
       s_smpi_privatization_region_t privatization_region =
-        mc_model_checker->process().read<s_smpi_privatization_region_t>(
-          remote(remote_smpi_privatization_regions + process_index));
+          mc_model_checker->process().read<s_smpi_privatization_region_t>(
+              remote(remote_smpi_privatization_regions + process_index));
 
       // Address translation in the privatization segment:
       size_t offset = address.address() - (std::uint64_t)info->start_rw;
-      address = remote((char*)privatization_region.address + offset);
+      address       = remote((char*)privatization_region.address + offset);
     }
 #endif
   }
-  if (pread_whole(this->memory_file, buffer, size, (size_t) address.address()) < 0)
+  if (pread_whole(this->memory_file, buffer, size, (size_t)address.address()) < 0)
     xbt_die("Read at %p from process %lli failed", (void*)address.address(), (long long)this->pid_);
   return buffer;
 }
@@ -509,24 +500,24 @@ const void *Process::read_bytes(void* buffer, std::size_t size,
  *  @param len      data size
  *  @param address  target process memory address (target)
  */
-void Process::write_bytes(const void* buffer, size_t len, RemotePtr<void> address)
+void RemoteClient::write_bytes(const void* buffer, size_t len, RemotePtr<void> address)
 {
-  if (pwrite_whole(this->memory_file, buffer, len,  (size_t)address.address()) < 0)
-    xbt_die("Write to process %lli failed", (long long) this->pid_);
+  if (pwrite_whole(this->memory_file, buffer, len, (size_t)address.address()) < 0)
+    xbt_die("Write to process %lli failed", (long long)this->pid_);
 }
 
-void Process::clear_bytes(RemotePtr<void> address, size_t len)
+void RemoteClient::clear_bytes(RemotePtr<void> address, size_t len)
 {
   pthread_once(&zero_buffer_flag, zero_buffer_init);
   while (len) {
     size_t s = len > zero_buffer_size ? zero_buffer_size : len;
     this->write_bytes(zero_buffer, s, address);
-    address = remote((char*) address.address() + s);
+    address = remote((char*)address.address() + s);
     len -= s;
   }
 }
 
-void Process::ignore_region(std::uint64_t addr, std::size_t size)
+void RemoteClient::ignore_region(std::uint64_t addr, std::size_t size)
 {
   IgnoredRegion region;
   region.addr = addr;
@@ -537,13 +528,13 @@ void Process::ignore_region(std::uint64_t addr, std::size_t size)
     return;
   }
 
-  unsigned int cursor = 0;
+  unsigned int cursor           = 0;
   IgnoredRegion* current_region = nullptr;
 
   int start = 0;
-  int end = ignored_regions_.size() - 1;
+  int end   = ignored_regions_.size() - 1;
   while (start <= end) {
-    cursor = (start + end) / 2;
+    cursor         = (start + end) / 2;
     current_region = &ignored_regions_[cursor];
     if (current_region->addr == addr) {
       if (current_region->size == size)
@@ -568,11 +559,10 @@ void Process::ignore_region(std::uint64_t addr, std::size_t size)
     position = cursor + 1;
   else
     position = cursor;
-  ignored_regions_.insert(
-    ignored_regions_.begin() + position, region);
+  ignored_regions_.insert(ignored_regions_.begin() + position, region);
 }
 
-void Process::ignore_heap(IgnoredHeapRegion const& region)
+void RemoteClient::ignore_heap(IgnoredHeapRegion const& region)
 {
   if (ignored_heap_.empty()) {
     ignored_heap_.push_back(std::move(region));
@@ -582,12 +572,12 @@ void Process::ignore_heap(IgnoredHeapRegion const& region)
   typedef std::vector<IgnoredHeapRegion>::size_type size_type;
 
   size_type start = 0;
-  size_type end = ignored_heap_.size() - 1;
+  size_type end   = ignored_heap_.size() - 1;
 
   // Binary search the position of insertion:
   size_type cursor;
   while (start <= end) {
-    cursor = start + (end - start) / 2;
+    cursor               = start + (end - start) / 2;
     auto& current_region = ignored_heap_[cursor];
     if (current_region.address == region.address)
       return;
@@ -603,27 +593,27 @@ void Process::ignore_heap(IgnoredHeapRegion const& region)
   // Insert it mc_heap_ignore_region_t:
   if (ignored_heap_[cursor].address < region.address)
     ++cursor;
-  ignored_heap_.insert( ignored_heap_.begin() + cursor, region);
+  ignored_heap_.insert(ignored_heap_.begin() + cursor, region);
 }
 
-void Process::unignore_heap(void *address, size_t size)
+void RemoteClient::unignore_heap(void* address, size_t size)
 {
   typedef std::vector<IgnoredHeapRegion>::size_type size_type;
 
   size_type start = 0;
-  size_type end = ignored_heap_.size() - 1;
+  size_type end   = ignored_heap_.size() - 1;
 
   // Binary search:
   size_type cursor;
   while (start <= end) {
-    cursor = (start + end) / 2;
+    cursor       = (start + end) / 2;
     auto& region = ignored_heap_[cursor];
     if (region.address == address) {
       ignored_heap_.erase(ignored_heap_.begin() + cursor);
       return;
     } else if (region.address < address)
       start = cursor + 1;
-    else if ((char *) region.address <= ((char *) address + size)) {
+    else if ((char*)region.address <= ((char*)address + size)) {
       ignored_heap_.erase(ignored_heap_.begin() + cursor);
       return;
     } else if (cursor != 0)
@@ -634,28 +624,27 @@ void Process::unignore_heap(void *address, size_t size)
   }
 }
 
-void Process::ignore_local_variable(const char *var_name, const char *frame_name)
+void RemoteClient::ignore_local_variable(const char* var_name, const char* frame_name)
 {
   if (frame_name != nullptr && strcmp(frame_name, "*") == 0)
     frame_name = nullptr;
-  for (std::shared_ptr<simgrid::mc::ObjectInformation> const& info :
-      this->object_infos)
+  for (std::shared_ptr<simgrid::mc::ObjectInformation> const& info : this->object_infos)
     info->remove_local_variable(var_name, frame_name);
 }
 
-std::vector<simgrid::mc::ActorInformation>& Process::actors()
+std::vector<simgrid::mc::ActorInformation>& RemoteClient::actors()
 {
   this->refresh_simix();
   return smx_actors_infos;
 }
 
-std::vector<simgrid::mc::ActorInformation>& Process::dead_actors()
+std::vector<simgrid::mc::ActorInformation>& RemoteClient::dead_actors()
 {
   this->refresh_simix();
   return smx_dead_actors_infos;
 }
 
-void Process::dumpStack()
+void RemoteClient::dumpStack()
 {
   unw_addr_space_t as = unw_create_addr_space(&_UPT_accessors, BYTE_ORDER);
   if (as == nullptr) {
@@ -684,6 +673,5 @@ void Process::dumpStack()
   unw_destroy_addr_space(as);
   return;
 }
-
 }
 }
similarity index 75%
rename from src/mc/Process.hpp
rename to src/mc/remote/RemoteClient.hpp
index 19c2e5e..34c31b6 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2008-2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2008-2017. 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. */
@@ -7,13 +6,13 @@
 #ifndef SIMGRID_MC_PROCESS_H
 #define SIMGRID_MC_PROCESS_H
 
-#include <cstdint>
 #include <cstddef>
+#include <cstdint>
 
-#include <type_traits>
-#include <vector>
 #include <memory>
 #include <string>
+#include <type_traits>
+#include <vector>
 
 #include <sys/types.h>
 
@@ -27,9 +26,9 @@
 #include "src/mc/remote/Channel.hpp"
 #include "src/mc/remote/RemotePtr.hpp"
 
-#include <simgrid/simix.h>
 #include "src/simix/popping_private.h"
 #include "src/simix/smx_private.h"
+#include <simgrid/simix.h>
 
 #include "src/xbt/memory_map.hpp"
 
@@ -55,7 +54,7 @@ public:
   void clear()
   {
     name.clear();
-    address = nullptr;
+    address  = nullptr;
     hostname = nullptr;
   }
 };
@@ -68,11 +67,11 @@ struct IgnoredRegion {
 struct IgnoredHeapRegion {
   int block;
   int fragment;
-  void *address;
+  voidaddress;
   std::size_t size;
 };
 
-/** Representation of a process
+/** The Model-Checked process, seen from the MCer perspective
  *
  *  This class is mixing a lot of different responsibilities and is tied
  *  to SIMIX. It should probably be split into different classes.
@@ -87,36 +86,35 @@ struct IgnoredHeapRegion {
  *  - stack unwinding;
  *  - etc.
  */
-class Process final : public AddressSpace {
+class RemoteClient final : public AddressSpace {
 private:
   // Those flags are used to track down which cached information
   // is still up to date and which information needs to be updated.
-  static constexpr int cache_none = 0;
-  static constexpr int cache_heap = 1;
-  static constexpr int cache_malloc = 2;
+  static constexpr int cache_none            = 0;
+  static constexpr int cache_heap            = 1;
+  static constexpr int cache_malloc          = 2;
   static constexpr int cache_simix_processes = 4;
+
 public:
-  Process(pid_t pid, int sockfd);
-  ~Process();
+  RemoteClient(pid_t pid, int sockfd);
+  ~RemoteClient();
   void init();
 
-  Process(Process const&) = delete;
-  Process(Process &&) = delete;
-  Process& operator=(Process const&) = delete;
-  Process& operator=(Process &&) = delete;
+  RemoteClient(RemoteClient const&) = delete;
+  RemoteClient(RemoteClient&&)      = delete;
+  RemoteClient& operator=(RemoteClient const&) = delete;
+  RemoteClient& operator=(RemoteClient&&) = delete;
 
   // Read memory:
-  const void* read_bytes(void* buffer, std::size_t size,
-    RemotePtr<void> address, int process_index = ProcessIndexAny,
-    ReadOptions options = ReadOptions::none()) const override;
+  const void* read_bytes(void* buffer, std::size_t size, RemotePtr<void> address, int process_index = ProcessIndexAny,
+                         ReadOptions options = ReadOptions::none()) const override;
 
   void read_variable(const char* name, void* target, size_t size) const;
-  template<class T> void read_variable(const char* name, T* target) const
+  template <class T> void read_variable(const char* name, T* target) const
   {
     read_variable(name, target, sizeof(*target));
   }
-  template<class T>
-  Remote<T> read_variable(const char *name) const
+  template <class T> Remote<T> read_variable(const char* name) const
   {
     Remote<T> res;
     read_variable(name, res.getBuffer(), sizeof(T));
@@ -143,29 +141,23 @@ public:
   // Heap access:
   xbt_mheap_t get_heap()
   {
-    if (not(this->cache_flags_ & Process::cache_heap))
+    if (not(this->cache_flags_ & RemoteClient::cache_heap))
       this->refresh_heap();
     return this->heap.get();
   }
   const malloc_info* get_malloc_info()
   {
-    if (not(this->cache_flags_ & Process::cache_malloc))
+    if (not(this->cache_flags_ & RemoteClient::cache_malloc))
       this->refresh_malloc_info();
     return this->heap_info.data();
   }
 
-  void clear_cache()
-  {
-    this->cache_flags_ = Process::cache_none;
-  }
+  void clear_cache() { this->cache_flags_ = RemoteClient::cache_none; }
 
   Channel const& getChannel() const { return channel_; }
   Channel& getChannel() { return channel_; }
 
-  std::vector<IgnoredRegion> const& ignored_regions() const
-  {
-    return ignored_regions_;
-  }
+  std::vector<IgnoredRegion> const& ignored_regions() const { return ignored_regions_; }
   void ignore_region(std::uint64_t address, std::size_t size);
 
   pid_t pid() const { return pid_; }
@@ -175,50 +167,28 @@ public:
     return p >= this->maestro_stack_start_ && p < this->maestro_stack_end_;
   }
 
-  bool running() const
-  {
-    return running_;
-  }
+  bool running() const { return running_; }
 
-  void terminate()
-  {
-    running_ = false;
-  }
+  void terminate() { running_ = false; }
 
-  bool privatized(ObjectInformation const& info) const
-  {
-    return privatized_ && info.executable();
-  }
-  bool privatized() const
-  {
-    return privatized_;
-  }
+  bool privatized(ObjectInformation const& info) const { return privatized_ && info.executable(); }
+  bool privatized() const { return privatized_; }
   void privatized(bool privatized) { privatized_ = privatized; }
 
   void ignore_global_variable(const char* name)
   {
-    for (std::shared_ptr<simgrid::mc::ObjectInformation> const& info :
-        this->object_infos)
+    for (std::shared_ptr<simgrid::mc::ObjectInformation> const& info : this->object_infos)
       info->remove_global_variable(name);
   }
 
-  std::vector<s_stack_region_t>& stack_areas()
-  {
-    return stack_areas_;
-  }
-  std::vector<s_stack_region_t> const& stack_areas() const
-  {
-    return stack_areas_;
-  }
+  std::vector<s_stack_region_t>& stack_areas() { return stack_areas_; }
+  std::vector<s_stack_region_t> const& stack_areas() const { return stack_areas_; }
 
-  std::vector<IgnoredHeapRegion> const& ignored_heap() const
-  {
-    return ignored_heap_;
-  }
+  std::vector<IgnoredHeapRegion> const& ignored_heap() const { return ignored_heap_; }
   void ignore_heap(IgnoredHeapRegion const& region);
-  void unignore_heap(void *address, size_t size);
+  void unignore_heap(voidaddress, size_t size);
 
-  void ignore_local_variable(const char *var_name, const char *frame_name);
+  void ignore_local_variable(const char* var_name, const char* frame_name);
   std::vector<simgrid::mc::ActorInformation>& actors();
   std::vector<simgrid::mc::ActorInformation>& dead_actors();
 
@@ -276,10 +246,10 @@ public: // object info
   std::shared_ptr<simgrid::mc::ObjectInformation> binary_info;
 
 public: // Copies of MCed SMX data structures
-  /** Copy of `simix_global->process_list`
-   *
-   *  See mc_smx.c.
-   */
+        /** Copy of `simix_global->process_list`
+         *
+         *  See mc_smx.c.
+         */
   std::vector<ActorInformation> smx_actors_infos;
 
   /** Copy of `simix_global->process_to_destroy`
@@ -290,7 +260,7 @@ public: // Copies of MCed SMX data structures
 
 private:
   /** State of the cache (which variables are up to date) */
-  int cache_flags_ = Process::cache_none;
+  int cache_flags_ = RemoteClient::cache_none;
 
 public:
   /** Address of the heap structure in the MCed process. */
@@ -302,7 +272,7 @@ public:
    *  This is not used if the process is the current one:
    *  use `get_heap_info()` in order to use it.
    */
-   std::unique_ptr<s_xbt_mheap_t> heap;
+  std::unique_ptr<s_xbt_mheap_t> heap;
 
   /** Copy of the allocation info structure
    *
@@ -313,13 +283,12 @@ public:
   std::vector<malloc_info> heap_info;
 
 public: // Libunwind-data
-
-  /** Full-featured MC-aware libunwind address space for the process
-   *
-   *  This address space is using a simgrid::mc::UnwindContext*
-   *  (with simgrid::mc::Process* / simgrid::mc::AddressSpace*
-   *  and unw_context_t).
-   */
+        /** Full-featured MC-aware libunwind address space for the process
+         *
+         *  This address space is using a simgrid::mc::UnwindContext*
+         *  (with simgrid::mc::Process* / simgrid::mc::AddressSpace*
+         *  and unw_context_t).
+         */
   unw_addr_space_t unw_addr_space;
 
   /** Underlying libunwind address-space
@@ -338,7 +307,6 @@ public: // Libunwind-data
 /** Open a FD to a remote process memory (`/dev/$pid/mem`)
  */
 XBT_PRIVATE int open_vm(pid_t pid, int flags);
-
 }
 }
 
index add0efa..4ca6653 100644 (file)
@@ -53,71 +53,64 @@ typedef enum {
  *
  *  Moreover the protocol is not stable. The same version of the library should be used
  *  for the client and the server.
- *
- *  This is the basic structure shared by all messages: all message start with a message
- *  type.
  */
+
+/* Basic structure: all message start with a message type */
 struct s_mc_message {
   e_mc_message_type type;
 };
-typedef struct s_mc_message s_mc_message_t;
-typedef struct s_mc_message* mc_message_t;
+typedef struct s_mc_message mc_message_t;
 
-struct s_mc_int_message {
+struct s_mc_message_int {
   e_mc_message_type type;
   uint64_t value;
 };
-typedef struct s_mc_int_message s_mc_int_message_t;
-typedef struct s_mc_int_message* mc_int_message_t;
+typedef struct s_mc_message_int mc_message_int_t;
 
-struct s_mc_ignore_heap_message {
+/* Client->Server */
+struct s_mc_message_ignore_heap {
   e_mc_message_type type;
   int block;
   int fragment;
   void* address;
   size_t size;
 };
-typedef struct s_mc_ignore_heap_message s_mc_ignore_heap_message_t;
-typedef struct s_mc_ignore_heap_message* mc_ignore_heap_message_t;
+typedef struct s_mc_message_ignore_heap s_mc_message_ignore_heap_t;
 
-struct s_mc_ignore_memory_message {
+struct s_mc_message_ignore_memory {
   e_mc_message_type type;
   uint64_t addr;
   size_t size;
 };
-typedef struct s_mc_ignore_memory_message s_mc_ignore_memory_message_t;
-typedef struct s_mc_ignore_memory_message* mc_ignore_memory_message_t;
+typedef struct s_mc_message_ignore_memory s_mc_message_ignore_memory_t;
 
-struct s_mc_stack_region_message {
+struct s_mc_message_stack_region {
   e_mc_message_type type;
   s_stack_region_t stack_region;
 };
-typedef struct s_mc_stack_region_message s_mc_stack_region_message_t;
-typedef struct s_mc_stack_region_message* mc_stack_region_message_t;
-
-struct s_mc_simcall_handle_message {
-  e_mc_message_type type;
-  unsigned long pid;
-  int value;
-};
-typedef struct s_mc_simcall_handle_message s_mc_simcall_handle_message_t;
-typedef struct s_mc_simcall_handle_message* mc_simcall_handle_message;
+typedef struct s_mc_message_stack_region s_mc_message_stack_region_t;
 
-struct s_mc_register_symbol_message {
+struct s_mc_message_register_symbol {
   e_mc_message_type type;
   char name[128];
   int (*callback)(void*);
   void* data;
 };
-typedef struct s_mc_register_symbol_message s_mc_register_symbol_message_t;
-typedef struct s_mc_register_symbol_message* mc_register_symbol_message_t;
+typedef struct s_mc_message_register_symbol s_mc_message_register_symbol_t;
+
+/* Server -> client */
+struct s_mc_message_simcall_handle {
+  e_mc_message_type type;
+  unsigned long pid;
+  int value;
+};
+typedef struct s_mc_message_simcall_handle s_mc_message_simcall_handle_t;
 
-struct s_mc_restore_message {
+struct s_mc_message_restore {
   e_mc_message_type type;
   int index;
 };
-typedef struct s_mc_restore_message s_mc_restore_message_t;
-typedef struct s_mc_restore_message* mc_restore_message_t;
+typedef struct s_mc_message_restore s_mc_message_restore_t;
 
 XBT_PRIVATE const char* MC_message_type_name(e_mc_message_type type);
 
index 285d76a..f9d0762 100644 (file)
@@ -118,15 +118,6 @@ double MSG_host_get_speed(msg_host_t host) {
   return host->getSpeed();
 }
 
-/** \ingroup m_host_management
- * \brief Return the speed of the processor (in flop/s), regardless of the current load on the machine.
- * Deprecated: use MSG_host_get_speed
- */
-double MSG_get_host_speed(msg_host_t host) {
-  XBT_WARN("MSG_get_host_speed is deprecated: use MSG_host_get_speed");
-  return MSG_host_get_speed(host);
-}
-
 /** \ingroup m_host_management
  * \brief Return the number of cores.
  *
index 0203ed7..1913d3b 100644 (file)
@@ -323,7 +323,7 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa
 
   /* Create file on remote host, write it and close it */
   msg_file_t fd = new simgrid::s4u::File(fullpath, dst_host, nullptr);
-  fd->write(read_size, dst_host);
+  fd->write(read_size);
   delete fd;
   return MSG_OK;
 }
index 79ebf4e..2eb403d 100644 (file)
@@ -365,18 +365,15 @@ static int migration_rx_fun(int argc, char *argv[])
 static void start_dirty_page_tracking(msg_vm_t vm)
 {
   vm->pimpl_vm_->dp_enabled = 1;
-  if (not vm->pimpl_vm_->dp_objs)
+  if (vm->pimpl_vm_->dp_objs.empty())
     return;
 
-  char *key = nullptr;
-  xbt_dict_cursor_t cursor = nullptr;
-  dirty_page_t dp = nullptr;
-  xbt_dict_foreach (vm->pimpl_vm_->dp_objs, cursor, key, dp) {
+  for (auto elm : vm->pimpl_vm_->dp_objs) {
+    dirty_page_t dp    = elm.second;
     double remaining = MSG_task_get_flops_amount(dp->task);
     dp->prev_clock = MSG_get_clock();
     dp->prev_remaining = remaining;
-
-    // XBT_INFO("%s@%s remaining %f", key, sg_host_name(vm), remaining);
+    XBT_DEBUG("%s@%s remaining %f", elm.first.c_str(), vm->getCname(), remaining);
   }
 }
 
@@ -385,7 +382,7 @@ static void stop_dirty_page_tracking(msg_vm_t vm)
   vm->pimpl_vm_->dp_enabled = 0;
 }
 
-static double get_computed(char *key, msg_vm_t vm, dirty_page_t dp, double remaining, double clock)
+static double get_computed(const char* key, msg_vm_t vm, dirty_page_t dp, double remaining, double clock)
 {
   double computed = dp->prev_remaining - remaining;
   double duration = clock - dp->prev_clock;
@@ -400,10 +397,9 @@ static double lookup_computed_flop_counts(msg_vm_t vm, int stage_for_fancy_debug
 {
   double total = 0;
 
-  char *key = nullptr;
-  xbt_dict_cursor_t cursor = nullptr;
-  dirty_page_t dp = nullptr;
-  xbt_dict_foreach (vm->pimpl_vm_->dp_objs, cursor, key, dp) {
+  for (auto elm : vm->pimpl_vm_->dp_objs) {
+    const char* key  = elm.first.c_str();
+    dirty_page_t dp  = elm.second;
     double remaining = MSG_task_get_flops_amount(dp->task);
 
     double clock = MSG_get_clock();
@@ -443,10 +439,7 @@ void MSG_host_add_task(msg_host_t host, msg_task_t task)
     dp->prev_clock = MSG_get_clock();
     dp->prev_remaining = remaining;
   }
-  if (not vm->pimpl_vm_->dp_objs)
-    vm->pimpl_vm_->dp_objs = xbt_dict_new_homogeneous(nullptr);
-  xbt_assert(xbt_dict_get_or_null(vm->pimpl_vm_->dp_objs, key) == nullptr);
-  xbt_dict_set(vm->pimpl_vm_->dp_objs, key, dp, nullptr);
+  vm->pimpl_vm_->dp_objs.insert({key, dp});
   XBT_DEBUG("add %s on %s (remaining %f, dp_enabled %d)", key, host->getCname(), remaining, vm->pimpl_vm_->dp_enabled);
 
   xbt_free(key);
@@ -459,8 +452,10 @@ void MSG_host_del_task(msg_host_t host, msg_task_t task)
     return;
 
   char *key = bprintf("%s-%p", task->name, task);
-  dirty_page_t dp = (dirty_page_t)(vm->pimpl_vm_->dp_objs ? xbt_dict_get_or_null(vm->pimpl_vm_->dp_objs, key) : NULL);
-  xbt_assert(dp->task == task);
+  dirty_page_t dp = nullptr;
+  if (vm->pimpl_vm_->dp_objs.find(key) != vm->pimpl_vm_->dp_objs.end())
+    dp = vm->pimpl_vm_->dp_objs.at(key);
+  xbt_assert(dp && dp->task == task);
 
   /* If we are in the middle of dirty page tracking, we record how much computation has been done until now, and keep
    * the information for the lookup_() function that will called soon. */
@@ -472,8 +467,8 @@ void MSG_host_del_task(msg_host_t host, msg_task_t task)
 
     vm->pimpl_vm_->dp_updated_by_deleted_tasks += updated;
   }
-  if (vm->pimpl_vm_->dp_objs)
-    xbt_dict_remove(vm->pimpl_vm_->dp_objs, key);
+
+  vm->pimpl_vm_->dp_objs.erase(key);
   xbt_free(dp);
 
   XBT_DEBUG("del %s on %s", key, host->getCname());
index 019fd79..a3b4a0a 100644 (file)
@@ -126,21 +126,18 @@ VirtualMachineImpl::~VirtualMachineImpl()
     allVms_.erase(iter);
 
   /* dirty page tracking */
-  unsigned int size          = xbt_dict_size(dp_objs);
+  unsigned int size          = dp_objs.size();
   static bool already_warned = false;
   if (size > 0 && not already_warned) {
-    xbt_dict_cursor_t cursor = nullptr;
-    xbt_dict_cursor_first(dp_objs, &cursor);
+    auto front = dp_objs.begin();
     XBT_WARN("Dirty page tracking: %u pending task(s) on a destroyed VM (first one is %s).\n"
              "If you don't understand why your task was not properly removed, please report that bug.\n"
              "This is a known bug if you turned the host off during the VM execution.\n"
              "Please remind us of that problem at some point: our code base is not ready to fix this harmless issue in "
              "2016, sorry.",
-             size, (xbt_log_no_loc ? "(name hidden)" : xbt_dict_cursor_get_key(cursor)));
-    xbt_dict_cursor_free(&cursor);
+             size, (xbt_log_no_loc ? "(name hidden)" : front->first.c_str()));
     already_warned = true;
   }
-  xbt_dict_free(&dp_objs);
 
   /* Free the cpu_action of the VM. */
   XBT_ATTRIB_UNUSED int ret = action_->unref();
index 797bfb0..1063bf1 100644 (file)
@@ -8,6 +8,7 @@
 #include "src/surf/HostImpl.hpp"
 #include <algorithm>
 #include <deque>
+#include <unordered_map>
 
 #ifndef VM_INTERFACE_HPP_
 #define VM_INTERFACE_HPP_
@@ -15,6 +16,8 @@
 #define GUESTOS_NOISE 100 // This value corresponds to the cost of the global action associated to the VM
                           // It corresponds to the cost of a VM running no tasks.
 
+typedef struct dirty_page* dirty_page_t;
+
 namespace simgrid {
 namespace vm {
 
@@ -86,8 +89,8 @@ public:
   surf::Action* action_ = nullptr;
 
   /* Dirty pages stuff */
+  std::unordered_map<std::string, dirty_page_t> dp_objs;
   int dp_enabled                     = 0;
-  xbt_dict_t dp_objs                 = nullptr;
   double dp_updated_by_deleted_tasks = 0;
 
 protected:
index db1c5b2..043f6d5 100644 (file)
@@ -56,17 +56,12 @@ File::~File()
 
 sg_size_t File::read(sg_size_t size)
 {
-  return simcall_file_read(pimpl_, size, Host::current());
+  return simcall_file_read(pimpl_, size);
 }
 
 sg_size_t File::write(sg_size_t size)
 {
-  return simcall_file_write(pimpl_,size, Host::current());
-}
-
-sg_size_t File::write(sg_size_t size, sg_host_t host)
-{
-  return simcall_file_write(pimpl_, size, host);
+  return simcall_file_write(pimpl_, size);
 }
 
 sg_size_t File::size()
index 60a9142..f746562 100644 (file)
@@ -67,12 +67,12 @@ xbt_dict_t Storage::getProperties()
 
 const char* Storage::getProperty(const char* key)
 {
-  return static_cast<const char*>(xbt_dict_get_or_null(this->getProperties(), key));
+  return this->pimpl_->getProperty(key);
 }
 
 void Storage::setProperty(const char* key, char* value)
 {
-  xbt_dict_set(this->getProperties(), key, value, nullptr);
+  simgrid::simix::kernelImmediate([this, key, value] { this->pimpl_->setProperty(key, value); });
 }
 
 std::map<std::string, sg_size_t>* Storage::getContent()
index d5c9811..f05e1f1 100644 (file)
@@ -609,18 +609,18 @@ int simcall_sem_get_capacity(smx_sem_t sem)
  * \ingroup simix_file_management
  *
  */
-sg_size_t simcall_file_read(surf_file_t fd, sg_size_t size, sg_host_t host)
+sg_size_t simcall_file_read(surf_file_t fd, sg_size_t size)
 {
-  return simcall_BODY_file_read(fd, size, host);
+  return simcall_BODY_file_read(fd, size);
 }
 
 /**
  * \ingroup simix_file_management
  *
  */
-sg_size_t simcall_file_write(surf_file_t fd, sg_size_t size, sg_host_t host)
+sg_size_t simcall_file_write(surf_file_t fd, sg_size_t size)
 {
-  return simcall_BODY_file_write(fd, size, host);
+  return simcall_BODY_file_write(fd, size);
 }
 
 void simcall_run_kernel(std::function<void()> const& code)
index 9bdee47..1966f28 100644 (file)
@@ -1480,18 +1480,6 @@ static inline void simcall_file_read__set__size(smx_simcall_t simcall, sg_size_t
 {
   simgrid::simix::marshal<sg_size_t>(simcall->args[1], arg);
 }
-static inline sg_host_t simcall_file_read__get__host(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal<sg_host_t>(simcall->args[2]);
-}
-static inline sg_host_t simcall_file_read__getraw__host(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal_raw<sg_host_t>(simcall->args[2]);
-}
-static inline void simcall_file_read__set__host(smx_simcall_t simcall, sg_host_t arg)
-{
-  simgrid::simix::marshal<sg_host_t>(simcall->args[2], arg);
-}
 static inline sg_size_t simcall_file_read__get__result(smx_simcall_t simcall)
 {
   return simgrid::simix::unmarshal<sg_size_t>(simcall->result);
@@ -1528,18 +1516,6 @@ static inline void simcall_file_write__set__size(smx_simcall_t simcall, sg_size_
 {
   simgrid::simix::marshal<sg_size_t>(simcall->args[1], arg);
 }
-static inline sg_host_t simcall_file_write__get__host(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal<sg_host_t>(simcall->args[2]);
-}
-static inline sg_host_t simcall_file_write__getraw__host(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal_raw<sg_host_t>(simcall->args[2]);
-}
-static inline void simcall_file_write__set__host(smx_simcall_t simcall, sg_host_t arg)
-{
-  simgrid::simix::marshal<sg_host_t>(simcall->args[2], arg);
-}
 static inline sg_size_t simcall_file_write__get__result(smx_simcall_t simcall)
 {
   return simgrid::simix::unmarshal<sg_size_t>(simcall->result);
@@ -1689,6 +1665,6 @@ XBT_PRIVATE int simcall_HANDLER_sem_would_block(smx_simcall_t simcall, smx_sem_t
 XBT_PRIVATE void simcall_HANDLER_sem_acquire(smx_simcall_t simcall, smx_sem_t sem);
 XBT_PRIVATE void simcall_HANDLER_sem_acquire_timeout(smx_simcall_t simcall, smx_sem_t sem, double timeout);
 XBT_PRIVATE int simcall_HANDLER_sem_get_capacity(smx_simcall_t simcall, smx_sem_t sem);
-XBT_PRIVATE void simcall_HANDLER_file_read(smx_simcall_t simcall, surf_file_t fd, sg_size_t size, sg_host_t host);
-XBT_PRIVATE void simcall_HANDLER_file_write(smx_simcall_t simcall, surf_file_t fd, sg_size_t size, sg_host_t host);
+XBT_PRIVATE void simcall_HANDLER_file_read(smx_simcall_t simcall, surf_file_t fd, sg_size_t size);
+XBT_PRIVATE void simcall_HANDLER_file_write(smx_simcall_t simcall, surf_file_t fd, sg_size_t size);
 XBT_PRIVATE int simcall_HANDLER_mc_random(smx_simcall_t simcall, int min, int max);
\ No newline at end of file
index 8d0c849..486da23 100644 (file)
@@ -314,18 +314,20 @@ inline static int simcall_BODY_sem_get_capacity(smx_sem_t sem) {
     return simcall<int, smx_sem_t>(SIMCALL_SEM_GET_CAPACITY, sem);
   }
 
-  inline static sg_size_t simcall_BODY_file_read(surf_file_t fd, sg_size_t size, sg_host_t host)
+  inline static sg_size_t simcall_BODY_file_read(surf_file_t fd, sg_size_t size)
   {
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_file_read(&SIMIX_process_self()->simcall, fd, size, host);
-    return simcall<sg_size_t, surf_file_t, sg_size_t, sg_host_t>(SIMCALL_FILE_READ, fd, size, host);
+    if (0)
+      simcall_HANDLER_file_read(&SIMIX_process_self()->simcall, fd, size);
+    return simcall<sg_size_t, surf_file_t, sg_size_t>(SIMCALL_FILE_READ, fd, size);
   }
 
-  inline static sg_size_t simcall_BODY_file_write(surf_file_t fd, sg_size_t size, sg_host_t host)
+  inline static sg_size_t simcall_BODY_file_write(surf_file_t fd, sg_size_t size)
   {
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_file_write(&SIMIX_process_self()->simcall, fd, size, host);
-    return simcall<sg_size_t, surf_file_t, sg_size_t, sg_host_t>(SIMCALL_FILE_WRITE, fd, size, host);
+    if (0)
+      simcall_HANDLER_file_write(&SIMIX_process_self()->simcall, fd, size);
+    return simcall<sg_size_t, surf_file_t, sg_size_t>(SIMCALL_FILE_WRITE, fd, size);
   }
 
 inline static int simcall_BODY_mc_random(int min, int max) {
index cf13847..0de896d 100644 (file)
@@ -313,14 +313,12 @@ case SIMCALL_SEM_GET_CAPACITY:
 
 case SIMCALL_FILE_READ:
   simcall_HANDLER_file_read(simcall, simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]),
-                            simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]),
-                            simgrid::simix::unmarshal<sg_host_t>(simcall->args[2]));
+                            simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]));
   break;
 
 case SIMCALL_FILE_WRITE:
   simcall_HANDLER_file_write(simcall, simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]),
-                             simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]),
-                             simgrid::simix::unmarshal<sg_host_t>(simcall->args[2]));
+                             simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]));
   break;
 
 case SIMCALL_MC_RANDOM:
index d5b7cc1..69734e4 100644 (file)
@@ -81,8 +81,8 @@ void      sem_acquire(smx_sem_t sem) [[block]];
 void      sem_acquire_timeout(smx_sem_t sem, double timeout) [[block]];
 int       sem_get_capacity(smx_sem_t sem);
 
-sg_size_t   file_read(surf_file_t fd, sg_size_t size, sg_host_t host) [[block]];
-sg_size_t   file_write(surf_file_t fd, sg_size_t size, sg_host_t host) [[block]];
+sg_size_t   file_read(surf_file_t fd, sg_size_t size) [[block]];
+sg_size_t   file_write(surf_file_t fd, sg_size_t size) [[block]];
 
 int        mc_random(int min, int max);
 void       set_category(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> synchro, const char* category) [[nohandler]];
index ab65eeb..68d6465 100644 (file)
@@ -579,7 +579,7 @@ void SIMIX_run()
  */
 smx_timer_t SIMIX_timer_set(double date, void (*callback)(void*), void *arg)
 {
-  smx_timer_t timer = new s_smx_timer_t(date, [=](){ callback(arg); });
+  smx_timer_t timer = new s_smx_timer_t(date, [callback, arg]() { callback(arg); });
   xbt_heap_push(simix_timers, timer, date);
   return timer;
 }
@@ -669,18 +669,6 @@ void SIMIX_display_process_status()
       if (boost::dynamic_pointer_cast<simgrid::kernel::activity::IoImpl>(process->waiting_synchro) != nullptr)
         synchro_description = "I/O";
 
-
-      /*
-        switch (process->waiting_synchro->type) {
-      case SIMIX_SYNC_PARALLEL_EXECUTE:
-        synchro_description = "parallel execution";
-        break;
-
-      case SIMIX_SYNC_JOIN:
-        synchro_description = "joining";
-        break;
-*/
-
       XBT_INFO("Process %lu (%s@%s): waiting for %s synchro %p (%s) in state %d to finish", process->pid,
                process->cname(), process->host->getCname(), synchro_description, process->waiting_synchro.get(),
                process->waiting_synchro->name.c_str(), (int)process->waiting_synchro->state);
index 9d6ccb2..9361f1d 100644 (file)
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_io, simix, "Logging specific to SIMIX (io)");
 
 //SIMIX FILE READ
-void simcall_HANDLER_file_read(smx_simcall_t simcall, surf_file_t fd, sg_size_t size, sg_host_t host)
+void simcall_HANDLER_file_read(smx_simcall_t simcall, surf_file_t fd, sg_size_t size)
 {
-  smx_activity_t synchro = SIMIX_file_read(fd, size, host);
+  smx_activity_t synchro = SIMIX_file_read(fd, size);
   synchro->simcalls.push_back(simcall);
   simcall->issuer->waiting_synchro = synchro;
 }
 
-smx_activity_t SIMIX_file_read(surf_file_t file, sg_size_t size, sg_host_t host)
+smx_activity_t SIMIX_file_read(surf_file_t file, sg_size_t size)
 {
-  /* check if the host is active */
-  if (host->isOff())
-    THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->getCname());
-
   simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl();
   synchro->surf_io                           = file->read(size);
 
@@ -45,18 +41,15 @@ smx_activity_t SIMIX_file_read(surf_file_t file, sg_size_t size, sg_host_t host)
 }
 
 //SIMIX FILE WRITE
-void simcall_HANDLER_file_write(smx_simcall_t simcall, surf_file_t fd, sg_size_t size, sg_host_t host)
+void simcall_HANDLER_file_write(smx_simcall_t simcall, surf_file_t fd, sg_size_t size)
 {
-  smx_activity_t synchro = SIMIX_file_write(fd,  size, host);
+  smx_activity_t synchro = SIMIX_file_write(fd, size);
   synchro->simcalls.push_back(simcall);
   simcall->issuer->waiting_synchro = synchro;
 }
 
-smx_activity_t SIMIX_file_write(surf_file_t file, sg_size_t size, sg_host_t host)
+smx_activity_t SIMIX_file_write(surf_file_t file, sg_size_t size)
 {
-  if (host->isOff())
-    THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->getCname());
-
   simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl();
   synchro->surf_io                           = file->write(size);
   synchro->surf_io->setData(synchro);
index e51804d..db1c66d 100644 (file)
@@ -11,8 +11,8 @@
 #include "simgrid/simix.h"
 #include "popping_private.h"
 
-XBT_PRIVATE smx_activity_t SIMIX_file_read(surf_file_t fd, sg_size_t size, sg_host_t host);
-XBT_PRIVATE smx_activity_t SIMIX_file_write(surf_file_t fd, sg_size_t size, sg_host_t host);
+XBT_PRIVATE smx_activity_t SIMIX_file_read(surf_file_t fd, sg_size_t size);
+XBT_PRIVATE smx_activity_t SIMIX_file_write(surf_file_t fd, sg_size_t size);
 
 XBT_PRIVATE void SIMIX_io_destroy(smx_activity_t synchro);
 XBT_PRIVATE void SIMIX_io_finish(smx_activity_t synchro);
index 857fc9a..23de66f 100644 (file)
@@ -423,11 +423,10 @@ void Comm::init_smp(){
     smpi_process()->set_comm_intra(comm_intra);
   }
 
-  int is_uniform = 1;
-
   // Are the nodes uniform ? = same number of process/node
   int my_local_size=comm_intra->size();
   if(comm_intra->rank()==0) {
+    int is_uniform       = 1;
     int* non_uniform_map = xbt_new0(int,leader_group_size);
     Coll_allgather_mpich::allgather(&my_local_size, 1, MPI_INT,
         non_uniform_map, 1, MPI_INT, leader_comm);
index 7d53cd0..488962d 100644 (file)
@@ -20,9 +20,6 @@
 
 namespace simgrid {
 namespace surf {
-
-class XBT_PRIVATE HostModel;
-class XBT_PRIVATE HostImpl;
 class XBT_PRIVATE HostAction;
 }
 }
@@ -44,7 +41,7 @@ namespace surf {
  * @brief SURF Host model interface class
  * @details A model is an object which handle the interactions between its Resources and its Actions
  */
-class HostModel : public Model {
+class XBT_PRIVATE HostModel : public Model {
 public:
   HostModel() : Model() {}
 
@@ -60,7 +57,7 @@ public:
  * @brief SURF Host interface class
  * @details An host represents a machine with a aggregation of a Cpu, a RoutingEdge and a Storage
  */
-class HostImpl : public simgrid::surf::PropertyHolder {
+class XBT_PRIVATE HostImpl : public simgrid::surf::PropertyHolder {
 
 public:
   explicit HostImpl(s4u::Host* host);
index 1fb0fbc..03e1f87 100644 (file)
@@ -154,20 +154,6 @@ sg_size_t StorageImpl::getUsedSize()
 /**********
  * Action *
  **********/
-StorageAction::StorageAction(Model* model, double cost, bool failed, StorageImpl* storage,
-                             e_surf_action_storage_type_t type)
-    : Action(model, cost, failed), type_(type), storage_(storage), file_(nullptr)
-{
-  progress_ = 0;
-};
-
-StorageAction::StorageAction(Model* model, double cost, bool failed, lmm_variable_t var, StorageImpl* storage,
-                             e_surf_action_storage_type_t type)
-    : Action(model, cost, failed, var), type_(type), storage_(storage), file_(nullptr)
-{
-  progress_ = 0;
-}
-
 void StorageAction::setState(Action::State state)
 {
   Action::State old = getState();
index 97a3e7d..c2ea20b 100644 (file)
@@ -185,7 +185,8 @@ public:
    * @param storage The Storage associated to this StorageAction
    * @param type [description]
    */
-  StorageAction(Model* model, double cost, bool failed, StorageImpl* storage, e_surf_action_storage_type_t type);
+  StorageAction(Model* model, double cost, bool failed, StorageImpl* storage, e_surf_action_storage_type_t type)
+      : Action(model, cost, failed), type_(type), storage_(storage){};
 
   /**
  * @brief StorageAction constructor
@@ -198,14 +199,14 @@ public:
  * @param type [description]
  */
   StorageAction(Model* model, double cost, bool failed, lmm_variable_t var, StorageImpl* storage,
-                e_surf_action_storage_type_t type);
+                e_surf_action_storage_type_t type)
+      : Action(model, cost, failed, var), type_(type), storage_(storage){};
 
   void setState(simgrid::surf::Action::State state) override;
 
   e_surf_action_storage_type_t type_;
   StorageImpl* storage_;
-  FileImpl* file_;
-  double progress_;
+  FileImpl* file_ = nullptr;
 };
 }
 }
index f6dfe9a..a444396 100644 (file)
@@ -460,7 +460,6 @@ void lmm_expand(lmm_system_t sys, lmm_constraint_t cnst, lmm_variable_t var, dou
 void lmm_expand_add(lmm_system_t sys, lmm_constraint_t cnst, lmm_variable_t var, double value)
 {
   int i;
-  double weight;
   sys->modified = 1;
 
   lmm_check_concurrency(sys);
@@ -482,7 +481,7 @@ void lmm_expand_add(lmm_system_t sys, lmm_constraint_t cnst, lmm_variable_t var,
     //We need to check that increasing value of the element does not cross the concurrency limit
     if (var->sharing_weight) {
       if(lmm_concurrency_slack(cnst)<lmm_element_concurrency(&var->cnsts[i])){
-        weight = var->sharing_weight;
+        double weight = var->sharing_weight;
         lmm_disable_var(sys,var);
         for (int j = 0; j < var->cnsts_number; j++)
           lmm_on_disabled_var(sys,var->cnsts[j].constraint);
index 2ab9fce..dd44583 100644 (file)
@@ -80,34 +80,18 @@ void StorageN11Model::updateActionsState(double /*now*/, double delta)
 
     StorageAction *action = static_cast<StorageAction*>(&*it);
 
-    if (action->type_ == WRITE) {
-      // Update the disk usage
-      // Update the file size
-      // For each action of type write
-      double current_progress = delta * lmm_variable_getvalue(action->getVariable());
-      long int incr = current_progress;
-
-      XBT_DEBUG("%s:\n\t progress =  %.2f, current_progress = %.2f, incr = %ld, lrint(1) = %ld, lrint(2) = %ld",
-                action->file_->cname(), action->progress_, current_progress, incr,
-                lrint(action->progress_ + current_progress), lrint(action->progress_) + incr);
-
-      /* take care of rounding error accumulation */
-      if (lrint(action->progress_ + current_progress) > lrint(action->progress_) + incr)
-        incr++;
+    double current_progress = lrint(lmm_variable_getvalue(action->getVariable()) * delta);
 
-      action->progress_ += current_progress;
-
-      action->storage_->usedSize_ += incr;     // disk usage
-      action->file_->incrPosition(incr);       // current_position
-      //  which becomes the new file size
+    action->updateRemains(current_progress);
+    if (action->type_ == WRITE) {
+      action->storage_->usedSize_ += current_progress;
+      action->file_->incrPosition(current_progress);
       action->file_->setSize(action->file_->tell());
 
       action->storage_->getContent()->erase(action->file_->cname());
       action->storage_->getContent()->insert({action->file_->cname(), action->file_->size()});
     }
 
-    action->updateRemains(lmm_variable_getvalue(action->getVariable()) * delta);
-
     if (action->getMaxDuration() > NO_MAX_DURATION)
       action->updateMaxDuration(delta);
 
index 2da0174..42793eb 100644 (file)
@@ -44,11 +44,8 @@ public:
   StorageN11(StorageModel* model, const char* name, lmm_system_t maxminSystem, double bread, double bwrite,
              const char* type_id, char* content_name, sg_size_t size, char* attach);
   virtual ~StorageN11() = default;
-  StorageAction *open(const char* mount, const char* path);
-  StorageAction *ls(const char *path);
   StorageAction* read(sg_size_t size);
   StorageAction* write(sg_size_t size);
-  void rename(const char *src, const char *dest);
 };
 
 /**********
index 97e7964..46f00de 100644 (file)
@@ -41,7 +41,6 @@ void surf_presolve()
 double surf_solve(double max_date)
 {
   double time_delta = -1.0; /* duration */
-  double next_event_date = -1.0;
   double model_next_action_end = -1.0;
   double value = -1.0;
   simgrid::surf::Resource *resource = nullptr;
@@ -71,7 +70,7 @@ double surf_solve(double max_date)
   XBT_DEBUG("Looking for next trace event");
 
   while (1) { // Handle next occurring events until none remains
-    next_event_date = future_evt_set->next_date();
+    double next_event_date = future_evt_set->next_date();
     XBT_DEBUG("Next TRACE event: %f", next_event_date);
 
     if (not surf_network_model->nextOccuringEventIsIdempotent()) { // NS3, I see you
index fedd818..cf5f486 100644 (file)
@@ -900,13 +900,8 @@ void Action::updateRemainingLazy(double now)
       double_update(&maxDuration_, delta, sg_surf_precision);
 
     //FIXME: duplicated code
-    if ((remains_ <= 0) &&
-        (lmm_get_variable_weight(getVariable()) > 0)) {
-      finish();
-      setState(Action::State::done);
-      heapRemove(getModel()->getActionHeap());
-    } else if (((maxDuration_ != NO_MAX_DURATION)
-        && (maxDuration_ <= 0))) {
+    if (((remains_ <= 0) && (lmm_get_variable_weight(getVariable()) > 0)) ||
+        ((maxDuration_ > NO_MAX_DURATION) && (maxDuration_ <= 0))) {
       finish();
       setState(Action::State::done);
       heapRemove(getModel()->getActionHeap());
index 010e6f0..3d29ba4 100644 (file)
@@ -31,7 +31,7 @@ XBT_PUBLIC(double) surf_parse_get_size(const char *string, const char *entity_ki
 XBT_PUBLIC(double) surf_parse_get_bandwidth(const char *string, const char *entity_kind, const char *name);
 XBT_PUBLIC(double) surf_parse_get_speed(const char *string, const char *entity_kind, const char *name);
 
-XBT_PUBLIC_DATA(int_f_void_t) surf_parse;       /* Entry-point to the parser. Set this to your function. */
+XBT_PUBLIC(int) surf_parse(); /* Entry-point to the parser */
 
 SG_END_DECL()
 
index e304c1f..b82863a 100644 (file)
@@ -1138,11 +1138,10 @@ void surf_parse_close()
   }
 }
 
-/* Call the lexer to parse the currently opened file. This pointer to function enables bypassing of the parser */
-static int _surf_parse() {
+/* Call the lexer to parse the currently opened file */
+int surf_parse()
+{
   return surf_parse_lex();
 }
 
-int_f_void_t surf_parse = &_surf_parse;
-
 SG_END_DECL()
index 8008c3e..eac5f1a 100644 (file)
@@ -250,8 +250,6 @@ static int xbt_test_suite_run(xbt_test_suite_t suite, int verbosity)
   xbt_test_test_t test;
   xbt_test_log_t log;
 
-  unsigned int it_test;
-
   if (suite == nullptr)
     return 0;
 
@@ -297,6 +295,7 @@ static int xbt_test_suite_run(xbt_test_suite_t suite, int verbosity)
         unit->func();
 
       /* iterate through all performed tests to determine status */
+      unsigned int it_test;
       xbt_dynar_foreach(unit->tests, it_test, test) {
         if (test->ignored) {
           unit->test_ignore++;
index b1a20fd..cef1231 100644 (file)
@@ -393,9 +393,6 @@ extern "C" void xbt_dynar_remove_at(xbt_dynar_t const dynar, const int idx, void
  */
 extern "C" void xbt_dynar_remove_n_at(xbt_dynar_t const dynar, const unsigned int n, const int idx)
 {
-  unsigned long nb_shift;
-  unsigned long offset;
-
   if (not n)
     return;
 
@@ -409,10 +406,10 @@ extern "C" void xbt_dynar_remove_n_at(xbt_dynar_t const dynar, const unsigned in
     }
   }
 
-  nb_shift = dynar->used - n - idx;
+  unsigned long nb_shift = dynar->used - n - idx;
 
   if (nb_shift) {
-    offset = nb_shift * dynar->elmsize;
+    unsigned long offset = nb_shift * dynar->elmsize;
     memmove(_xbt_dynar_elm(dynar, idx), _xbt_dynar_elm(dynar, idx + n), offset);
   }
 
index ae6113c..b2185d7 100644 (file)
@@ -232,7 +232,6 @@ XBT_PRIVATE std::vector<VmMap> get_memory_map(pid_t pid)
       xbt_abort();
 
     memreg.prot = 0;
-
     for (i = 0; i < 3; i++){
       switch(lfields[1][i]){
         case 'r':
@@ -251,6 +250,7 @@ XBT_PRIVATE std::vector<VmMap> get_memory_map(pid_t pid)
     if (memreg.prot == 0)
       memreg.prot |= PROT_NONE;
 
+    memreg.flags = 0;
     if (lfields[1][3] == 'p') {
       memreg.flags |= MAP_PRIVATE;
     } else {
index 66ec157..7ee5e76 100644 (file)
@@ -20,8 +20,7 @@
 /* Return memory to the heap.  */
 void mfree(struct mdesc *mdp, void *ptr)
 {
-  int type;
-  size_t block, frag_nb;
+  size_t frag_nb;
   size_t i;
   int it;
 
@@ -31,14 +30,14 @@ void mfree(struct mdesc *mdp, void *ptr)
   if (ptr == NULL)
     return;
 
-  block = BLOCK(ptr);
+  size_t block = BLOCK(ptr);
 
   if ((char *) ptr < (char *) mdp->heapbase || block > mdp->heapsize) {
     fprintf(stderr,"Ouch, this pointer is not mine, I refuse to free it. Give me valid pointers, or give me death!!\n");
     abort();
   }
 
-  type = mdp->heapinfo[block].type;
+  int type = mdp->heapinfo[block].type;
 
   switch (type) {
   case MMALLOC_TYPE_HEAPINFO:
@@ -59,10 +58,8 @@ void mfree(struct mdesc *mdp, void *ptr)
     mdp -> heapstats.bytes_free +=
       mdp -> heapinfo[block].busy_block.size * BLOCKSIZE;
 
-    if(MC_is_active()){
-      if(mdp->heapinfo[block].busy_block.ignore > 0)
-        MC_remove_ignore_heap(ptr, mdp -> heapinfo[block].busy_block.busy_size);
-    }
+    if (MC_is_active() && mdp->heapinfo[block].busy_block.ignore > 0)
+      MC_unignore_heap(ptr, mdp->heapinfo[block].busy_block.busy_size);
 
     /* Find the free cluster previous to this one in the free list.
        Start searching at the last block referenced; this may benefit
@@ -171,10 +168,8 @@ void mfree(struct mdesc *mdp, void *ptr)
       THROWF(system_error, 0, "Asked to free a fragment that is already free. I'm puzzled\n");
     }
 
-    if(MC_is_active()){
-      if(mdp->heapinfo[block].busy_frag.ignore[frag_nb] > 0)
-        MC_remove_ignore_heap(ptr, mdp->heapinfo[block].busy_frag.frag_size[frag_nb]);
-    }
+    if (MC_is_active() && mdp->heapinfo[block].busy_frag.ignore[frag_nb] > 0)
+      MC_unignore_heap(ptr, mdp->heapinfo[block].busy_frag.frag_size[frag_nb]);
 
     /* Set size used in the fragment to -1 */
     mdp->heapinfo[block].busy_frag.frag_size[frag_nb] = -1;
index eac80c8..6c04fdf 100644 (file)
@@ -120,7 +120,8 @@ xbt_mheap_t xbt_mheap_new_options(int fd, void *baseaddr, int options)
          unsuccessful for some reason. */
 
       struct mdesc newmd;
-      struct mdesc *mdptr = NULL, *mdptemp = NULL;
+      struct mdesc* mdptr   = NULL;
+      struct mdesc* mdptemp = NULL;
 
       if (lseek(fd, 0L, SEEK_SET) != 0)
         return NULL;
@@ -156,15 +157,13 @@ xbt_mheap_t xbt_mheap_new_options(int fd, void *baseaddr, int options)
     }
   }
 
-  /* NULL is not a valid baseaddr as we cannot map anything there.
-     C'mon, user. Think! */
+  /* NULL is not a valid baseaddr as we cannot map anything there. C'mon, user. Think! */
   if (baseaddr == NULL)
     return (NULL);
 
-  /* We start off with the malloc descriptor allocated on the stack, until
-     we build it up enough to call _mmalloc_mmap_morecore() to allocate the
-     first page of the region and copy it there.  Ensure that it is zero'd and
-     then initialize the fields that we know values for. */
+  /* We start off with the malloc descriptor allocated on the stack, until we build it up enough to
+   * call _mmalloc_mmap_morecore() to allocate the first page of the region and copy it there.  Ensure that it is
+   * zero'd and then initialize the fields that we know values for. */
 
   mdp = &mtemp;
   memset((char *) mdp, 0, sizeof(mtemp));
@@ -187,10 +186,9 @@ xbt_mheap_t xbt_mheap_new_options(int fd, void *baseaddr, int options)
   /* If we have not been passed a valid open file descriptor for the file
      to map to, then open /dev/zero and use that to map to. */
 
-  /* Now try to map in the first page, copy the malloc descriptor structure
-     there, and arrange to return a pointer to this new copy.  If the mapping
-     fails, then close the file descriptor if it was opened by us, and arrange
-     to return a NULL. */
+  /* Now try to map in the first page, copy the malloc descriptor structure there, and arrange to return a pointer to
+   * this new copy.  If the mapping fails, then close the file descriptor if it was opened by us, and arrange to return
+   * a NULL. */
 
   if ((mbase = mmorecore(mdp, sizeof(mtemp))) != NULL) {
     memcpy(mbase, mdp, sizeof(mtemp));
@@ -229,41 +227,35 @@ void xbt_mheap_destroy_no_free(xbt_mheap_t md)
   }
 }
 
-/** Terminate access to a mmalloc managed region by unmapping all memory pages
-    associated with the region, and closing the file descriptor if it is one
-    that we opened.
+/** Terminate access to a mmalloc managed region by unmapping all memory pages associated with the region, and closing
+ *  the file descriptor if it is one that we opened.
 
     Returns NULL on success.
 
-    Returns the malloc descriptor on failure, which can subsequently be used
-    for further action, such as obtaining more information about the nature of
-    the failure.
+    Returns the malloc descriptor on failure, which can subsequently be used for further action, such as obtaining more
+    information about the nature of the failure.
 
-    Note that the malloc descriptor that we are using is currently located in
-    region we are about to unmap, so we first make a local copy of it on the
-    stack and use the copy. */
+    Note that the malloc descriptor that we are using is currently located in region we are about to unmap, so we first
+    make a local copy of it on the stack and use the copy. */
 
 void *xbt_mheap_destroy(xbt_mheap_t mdp)
 {
-  struct mdesc mtemp, *mdptemp;
-
   if (mdp != NULL) {
     /* Remove the heap from the linked list of heaps attached by mmalloc */
-    mdptemp = __mmalloc_default_mdp;
+    struct mdesc* mdptemp = __mmalloc_default_mdp;
     while(mdptemp->next_mdesc != mdp )
       mdptemp = mdptemp->next_mdesc;
 
     mdptemp->next_mdesc = mdp->next_mdesc;
 
     xbt_mheap_destroy_no_free(mdp);
-    mtemp = *mdp;
+    struct mdesc mtemp = *mdp;
 
     /* Now unmap all the pages associated with this region by asking for a
        negative increment equal to the current size of the region. */
 
     if (mmorecore(&mtemp, (char *)mtemp.base - (char *)mtemp.breakval) == NULL) {
-      /* Deallocating failed.  Update the original malloc descriptor
-         with any changes */
+      /* Deallocating failed.  Update the original malloc descriptor with any changes */
       *mdp = mtemp;
     } else {
       if (mtemp.flags & MMALLOC_DEVZERO) {
@@ -277,8 +269,7 @@ void *xbt_mheap_destroy(xbt_mheap_t mdp)
 }
 
 /* Safety gap from the heap's break address.
- * Try to increase this first if you experience strange errors under
- * valgrind. */
+ * Try to increase this first if you experience strange errors under valgrind. */
 #define HEAP_OFFSET   (128UL<<20)
 
 xbt_mheap_t mmalloc_get_default_md(void)
index 6637f21..ac5bc37 100644 (file)
@@ -371,7 +371,8 @@ xbt_dynar_t xbt_str_split_quoted(const char *s)
 /** @brief Join a set of strings as a single string */
 char *xbt_str_join(xbt_dynar_t dyn, const char *sep)
 {
-  int len = 1, dyn_len = xbt_dynar_length(dyn);
+  int len     = 1;
+  int dyn_len = xbt_dynar_length(dyn);
   unsigned int cpt;
   char* cursor;
 
index f059b2c..afc7d12 100644 (file)
 
 #include "src/mc/mc_private.h"
 
-#include "src/mc/Process.hpp"
-#include "src/mc/Type.hpp"
 #include "src/mc/ObjectInformation.hpp"
+#include "src/mc/Type.hpp"
 #include "src/mc/Variable.hpp"
+#include "src/mc/remote/RemoteClient.hpp"
 
-static simgrid::mc::Process* process;
+static simgrid::mc::RemoteClient* process;
 
 static
 uintptr_t eval_binary_operation(
@@ -149,7 +149,7 @@ void test_deref(simgrid::dwarf::ExpressionContext const& state) {
 }
 
 int main(int argc, char** argv) {
-  process = new simgrid::mc::Process(getpid(), -1);
+  process = new simgrid::mc::RemoteClient(getpid(), -1);
   process->init();
 
   simgrid::dwarf::ExpressionContext state;
index fca03b1..20e0645 100644 (file)
 #include "mc/datatypes.h"
 #include "src/mc/mc_private.h"
 
-#include "src/mc/Process.hpp"
-#include "src/mc/Type.hpp"
 #include "src/mc/ObjectInformation.hpp"
+#include "src/mc/Type.hpp"
 #include "src/mc/Variable.hpp"
+#include "src/mc/remote/RemoteClient.hpp"
 
 int test_some_array[4][5][6];
 struct some_struct {
@@ -77,9 +77,9 @@ static void test_local_variable(simgrid::mc::ObjectInformation* info, const char
   xbt_assert(location.address() == address, "Bad resolution of local variable %s of %s", variable, function);
 }
 
-static simgrid::mc::Variable* test_global_variable(
-  simgrid::mc::Process& process, simgrid::mc::ObjectInformation* info,
-  const char* name, void* address, long byte_size)
+static simgrid::mc::Variable* test_global_variable(simgrid::mc::RemoteClient& process,
+                                                   simgrid::mc::ObjectInformation* info, const char* name,
+                                                   void* address, long byte_size)
 {
   simgrid::mc::Variable* variable = info->find_variable(name);
   xbt_assert(variable, "Global variable %s was not found", name);
@@ -107,7 +107,7 @@ int some_local_variable = 0;
 
 typedef struct foo {int i;} s_foo;
 
-static void test_type_by_name(simgrid::mc::Process& process, s_foo my_foo)
+static void test_type_by_name(simgrid::mc::RemoteClient& process, s_foo my_foo)
 {
   assert(process.binary_info->full_types_by_name.find("struct foo") != process.binary_info->full_types_by_name.end());
 }
@@ -119,7 +119,7 @@ int main(int argc, char** argv)
   simgrid::mc::Variable* var;
   simgrid::mc::Type* type;
 
-  simgrid::mc::Process process(getpid(), -1);
+  simgrid::mc::RemoteClient process(getpid(), -1);
   process.init();
 
   test_global_variable(process, process.binary_info.get(), "some_local_variable", &some_local_variable, sizeof(int));
index 0a87cdc..8203287 100644 (file)
@@ -1,5 +1,6 @@
 # C examples
-foreach(x cloud-sharing get_sender host_on_off host_on_off_recv host_on_off_processes trace_integration)
+foreach(x actions-comm actions-storage cloud-sharing get_sender host_on_off host_on_off_recv host_on_off_processes 
+          trace_integration)
   add_executable       (${x}  ${x}/${x}.c)
   target_link_libraries(${x}  simgrid)
   set_target_properties(${x}  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
@@ -20,7 +21,14 @@ endforeach()
 
 set(teshsuite_src ${teshsuite_src}  PARENT_SCOPE)
 set(tesh_files    ${tesh_files}     PARENT_SCOPE)
-set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/trace_integration/test-hbp1.0-hbp1.0-hbp1.0.xml
+set(txt_files     ${txt_files}     ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/actions-comm.txt
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/actions-comm_split_p0.txt
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/actions-comm_split_p1.txt
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/actions-storage/actions-storage.txt         PARENT_SCOPE)
+set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/actions-comm_d.xml
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/actions-comm_split_d.xml
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/actions-storage/actions-storage_d.xml
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/trace_integration/test-hbp1.0-hbp1.0-hbp1.0.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/trace_integration/test-hbp1.0-hbp3.0-hbp4.0.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/trace_integration/test-hbp1.5-hbp1.5.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/trace_integration/test-hbp1-c0s0-c0s1.xml
@@ -37,7 +45,9 @@ foreach(x get_sender host_on_off host_on_off_processes host_on_off_recv task_des
   ADD_TESH_FACTORIES(tesh-msg-${x} "thread;boost;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/msg/${x} --cd ${CMAKE_BINARY_DIR}/teshsuite/msg/${x} ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/${x}/${x}.tesh)
 endforeach()
 
-
+foreach(x actions-comm actions-storage)
+  ADD_TESH_FACTORIES(tesh-msg-${x} "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/msg/${x} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/${x} ${x}.tesh)
+endforeach()
 # One context factory is enough for these ones
 
 foreach(x cloud-sharing)
similarity index 59%
rename from examples/msg/actions-comm/actions-comm.c
rename to teshsuite/msg/actions-comm/actions-comm.c
index 2c487db..b431b35 100644 (file)
@@ -9,24 +9,24 @@
 XBT_LOG_NEW_DEFAULT_CATEGORY(actions, "Messages specific for this msg example");
 int communicator_size = 0;
 
-static void action_Isend(const char *const *action);
+static void action_Isend(const char* const* action);
 
 typedef struct {
   int last_Irecv_sender_id;
   int bcast_counter;
-  xbt_dynar_t isends;           /* of msg_comm_t */
+  xbt_dynar_t isends; /* of msg_comm_t */
   /* Used to implement irecv+wait */
-  xbt_dynar_t irecvs;           /* of msg_comm_t */
-  xbt_dynar_t tasks;            /* of msg_task_t */
+  xbt_dynar_t irecvs; /* of msg_comm_t */
+  xbt_dynar_t tasks;  /* of msg_task_t */
 } s_process_globals_t;
 
-typedef s_process_globals_t *process_globals_t;
+typedef s_process_globals_tprocess_globals_t;
 
 /* Helper function */
-static double parse_double(const char *string)
+static double parse_double(const charstring)
 {
   double value;
-  char *endptr;
+  charendptr;
 
   value = strtod(string, &endptr);
   if (*endptr != '\0')
@@ -34,17 +34,18 @@ static double parse_double(const char *string)
   return value;
 }
 
-#define ACT_DEBUG(...) \
-  if (XBT_LOG_ISENABLED(actions, xbt_log_priority_verbose)) {  \
-    char *NAME = xbt_str_join_array(action, " ");              \
-    XBT_DEBUG(__VA_ARGS__);                                    \
-    xbt_free(NAME);                                            \
-  } else ((void)0)
+#define ACT_DEBUG(...)                                                                                                 \
+  if (XBT_LOG_ISENABLED(actions, xbt_log_priority_verbose)) {                                                          \
+    char* NAME = xbt_str_join_array(action, " ");                                                                      \
+    XBT_DEBUG(__VA_ARGS__);                                                                                            \
+    xbt_free(NAME);                                                                                                    \
+  } else                                                                                                               \
+  ((void)0)
 
-static void log_action(const char *const *action, double date)
+static void log_action(const char* const* action, double date)
 {
   if (XBT_LOG_ISENABLED(actions, xbt_log_priority_verbose)) {
-    char *name = xbt_str_join_array(action, " ");
+    charname = xbt_str_join_array(action, " ");
     XBT_VERB("%s %f", name, date);
     xbt_free(name);
   }
@@ -52,11 +53,11 @@ static void log_action(const char *const *action, double date)
 
 static void asynchronous_cleanup(void)
 {
-  process_globals_t globals = (process_globals_t) MSG_process_get_data(MSG_process_self());
+  process_globals_t globals = (process_globals_t)MSG_process_get_data(MSG_process_self());
 
   /* Destroy any isend which correspond to completed communications */
   msg_comm_t comm;
-  while (1/*true*/) {
+  while (1 /*true*/) {
     int pos_found = MSG_comm_testany(globals->isends);
     if (pos_found == -1) /* none remaining */
       break;
@@ -66,14 +67,14 @@ static void asynchronous_cleanup(void)
 }
 
 /* My actions */
-static void action_send(const char *const *action)
+static void action_send(const char* const* action)
 {
   char to[250];
-  const char *size_str = action[3];
-  double size = parse_double(size_str);
-  double clock = MSG_get_clock();
+  const charsize_str = action[3];
+  double size          = parse_double(size_str);
+  double clock         = MSG_get_clock();
 
-  snprintf(to,249, "%s_%s", MSG_process_get_name(MSG_process_self()), action[2]);
+  snprintf(to, 249, "%s_%s", MSG_process_get_name(MSG_process_self()), action[2]);
 
   ACT_DEBUG("Entering Send: %s (size: %g)", NAME, size);
   if (size < 65536) {
@@ -86,14 +87,14 @@ static void action_send(const char *const *action)
   asynchronous_cleanup();
 }
 
-static void action_Isend(const char *const *action)
+static void action_Isend(const char* const* action)
 {
   char to[250];
-  const char *size = action[3];
-  double clock = MSG_get_clock();
-  process_globals_t globals = (process_globals_t) MSG_process_get_data(MSG_process_self());
+  const char* size          = action[3];
+  double clock              = MSG_get_clock();
+  process_globals_t globals = (process_globals_t)MSG_process_get_data(MSG_process_self());
 
-  snprintf(to,249, "%s_%s", MSG_process_get_name(MSG_process_self()), action[2]);
+  snprintf(to, 249, "%s_%s", MSG_process_get_name(MSG_process_self()), action[2]);
   msg_comm_t comm = MSG_task_isend(MSG_task_create(to, 0, parse_double(size), NULL), to);
   xbt_dynar_push(globals->isends, &comm);
 
@@ -102,13 +103,13 @@ static void action_Isend(const char *const *action)
   asynchronous_cleanup();
 }
 
-static void action_recv(const char *const *action)
+static void action_recv(const char* const* action)
 {
   char mailbox_name[250];
   msg_task_t task = NULL;
-  double clock = MSG_get_clock();
+  double clock    = MSG_get_clock();
 
-  snprintf(mailbox_name,249, "%s_%s", action[2], MSG_process_get_name(MSG_process_self()));
+  snprintf(mailbox_name, 249, "%s_%s", action[2], MSG_process_get_name(MSG_process_self()));
 
   ACT_DEBUG("Receiving: %s", NAME);
   msg_error_t res = MSG_task_receive(&task, mailbox_name);
@@ -120,15 +121,15 @@ static void action_recv(const char *const *action)
   asynchronous_cleanup();
 }
 
-static void action_Irecv(const char *const *action)
+static void action_Irecv(const char* const* action)
 {
   char mailbox[250];
-  double clock = MSG_get_clock();
-  process_globals_t globals = (process_globals_t) MSG_process_get_data(MSG_process_self());
+  double clock              = MSG_get_clock();
+  process_globals_t globals = (process_globals_t)MSG_process_get_data(MSG_process_self());
 
   XBT_DEBUG("Irecv on %s", MSG_process_get_name(MSG_process_self()));
 
-  snprintf(mailbox,249, "%s_%s", action[2], MSG_process_get_name(MSG_process_self()));
+  snprintf(mailbox, 249, "%s_%s", action[2], MSG_process_get_name(MSG_process_self()));
   msg_task_t t = NULL;
   xbt_dynar_push(globals->tasks, &t);
   msg_comm_t c = MSG_task_irecv(xbt_dynar_get_ptr(globals->tasks, xbt_dynar_length(globals->tasks) - 1), mailbox);
@@ -138,12 +139,12 @@ static void action_Irecv(const char *const *action)
   asynchronous_cleanup();
 }
 
-static void action_wait(const char *const *action)
+static void action_wait(const char* const* action)
 {
   msg_task_t task = NULL;
   msg_comm_t comm;
-  double clock = MSG_get_clock();
-  process_globals_t globals = (process_globals_t) MSG_process_get_data(MSG_process_self());
+  double clock              = MSG_get_clock();
+  process_globals_t globals = (process_globals_t)MSG_process_get_data(MSG_process_self());
 
   xbt_assert(xbt_dynar_length(globals->irecvs), "action wait not preceded by any irecv: %s",
              xbt_str_join_array(action, " "));
@@ -159,7 +160,7 @@ static void action_wait(const char *const *action)
 }
 
 /* FIXME: that's a poor man's implementation: we should take the message exchanges into account */
-static void action_barrier(const char *const *action)
+static void action_barrier(const char* const* action)
 {
   static msg_bar_t barrier           = NULL;
   static int processes_arrived_sofar = 0;
@@ -178,35 +179,35 @@ static void action_barrier(const char *const *action)
   ACT_DEBUG("Exiting barrier: %s", NAME);
 
   processes_arrived_sofar--;
-  if (processes_arrived_sofar<=0) {
+  if (processes_arrived_sofar <= 0) {
     MSG_barrier_destroy(barrier);
     barrier = NULL;
   }
 }
 
-static void action_bcast(const char *const *action)
+static void action_bcast(const char* const* action)
 {
   char mailbox[80];
   double comm_size = parse_double(action[2]);
-  msg_task_t task = NULL;
-  double clock = MSG_get_clock();
+  msg_task_t task  = NULL;
+  double clock     = MSG_get_clock();
 
-  process_globals_t counters = (process_globals_t) MSG_process_get_data(MSG_process_self());
+  process_globals_t counters = (process_globals_t)MSG_process_get_data(MSG_process_self());
 
   xbt_assert(communicator_size, "Size of Communicator is not defined, can't use collective operations");
 
-  const char * process_name = MSG_process_get_name(MSG_process_self());
+  const char* process_name = MSG_process_get_name(MSG_process_self());
 
-  char *bcast_identifier = bprintf("bcast_%d", counters->bcast_counter);
+  charbcast_identifier = bprintf("bcast_%d", counters->bcast_counter);
   counters->bcast_counter++;
 
   if (!strcmp(process_name, "p0")) {
     XBT_DEBUG("%s: %s is the Root", bcast_identifier, process_name);
 
-    msg_comm_t *comms = xbt_new0(msg_comm_t, communicator_size - 1);
+    msg_comm_tcomms = xbt_new0(msg_comm_t, communicator_size - 1);
 
     for (int i = 1; i < communicator_size; i++) {
-      snprintf(mailbox,79, "%s_p0_p%d", bcast_identifier, i);
+      snprintf(mailbox, 79, "%s_p0_p%d", bcast_identifier, i);
       comms[i - 1] = MSG_task_isend(MSG_task_create(mailbox, 0, comm_size, NULL), mailbox);
     }
     MSG_comm_waitall(comms, communicator_size - 1, -1);
@@ -216,7 +217,7 @@ static void action_bcast(const char *const *action)
 
     XBT_DEBUG("%s: all messages sent by %s have been received", bcast_identifier, process_name);
   } else {
-    snprintf(mailbox,79, "%s_p0_%s", bcast_identifier, process_name);
+    snprintf(mailbox, 79, "%s_p0_%s", bcast_identifier, process_name);
     MSG_task_receive(&task, mailbox);
     MSG_task_destroy(task);
     XBT_DEBUG("%s: %s has received", bcast_identifier, process_name);
@@ -226,20 +227,20 @@ static void action_bcast(const char *const *action)
   xbt_free(bcast_identifier);
 }
 
-static void action_comm_size(const char *const *action)
+static void action_comm_size(const char* const* action)
 {
-  const char *size = action[2];
-  double clock = MSG_get_clock();
+  const charsize = action[2];
+  double clock     = MSG_get_clock();
 
   communicator_size = parse_double(size);
   log_action(action, MSG_get_clock() - clock);
 }
 
-static void action_compute(const char *const *action)
+static void action_compute(const char* const* action)
 {
-  const char *amount = action[2];
-  msg_task_t task = MSG_task_create("task", parse_double(amount), 0, NULL);
-  double clock = MSG_get_clock();
+  const charamount = action[2];
+  msg_task_t task    = MSG_task_create("task", parse_double(amount), 0, NULL);
+  double clock       = MSG_get_clock();
 
   ACT_DEBUG("Entering %s", NAME);
   MSG_task_execute(task);
@@ -247,19 +248,19 @@ static void action_compute(const char *const *action)
   log_action(action, MSG_get_clock() - clock);
 }
 
-static void action_init(const char *const *action)
+static void action_init(const char* const* action)
 {
   XBT_DEBUG("Initialize the counters");
-  process_globals_t globals = (process_globals_t) calloc(1, sizeof(s_process_globals_t));
-  globals->isends = xbt_dynar_new(sizeof(msg_comm_t), NULL);
-  globals->irecvs = xbt_dynar_new(sizeof(msg_comm_t), NULL);
-  globals->tasks = xbt_dynar_new(sizeof(msg_task_t), NULL);
+  process_globals_t globals = (process_globals_t)calloc(1, sizeof(s_process_globals_t));
+  globals->isends           = xbt_dynar_new(sizeof(msg_comm_t), NULL);
+  globals->irecvs           = xbt_dynar_new(sizeof(msg_comm_t), NULL);
+  globals->tasks            = xbt_dynar_new(sizeof(msg_task_t), NULL);
   MSG_process_set_data(MSG_process_self(), globals);
 }
 
-static void action_finalize(const char *const *action)
+static void action_finalize(const char* const* action)
 {
-  process_globals_t globals = (process_globals_t) MSG_process_get_data(MSG_process_self());
+  process_globals_t globals = (process_globals_t)MSG_process_get_data(MSG_process_self());
   if (globals) {
     asynchronous_cleanup();
     xbt_dynar_free_container(&(globals->isends));
@@ -269,20 +270,19 @@ static void action_finalize(const char *const *action)
   }
 }
 
-int main(int argc, char *argv[])
+int main(int argc, charargv[])
 {
   /* Check the given arguments */
   MSG_init(&argc, argv);
   /* Explicit initialization of the action module is required now*/
   MSG_action_init();
 
-  xbt_assert(argc > 2,
-       "Usage: %s platform_file deployment_file [action_files]\n"
-       "\t# if all actions are in the same file\n"
-       "\tExample: %s msg_platform.xml msg_deployment.xml actions\n"
-       "\t# if actions are in separate files, specified in deployment\n"
-       "\tExample: %s msg_platform.xml msg_deployment.xml ",
-       argv[0],argv[0],argv[0]);
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file [action_files]\n"
+                       "\t# if all actions are in the same file\n"
+                       "\tExample: %s msg_platform.xml msg_deployment.xml actions\n"
+                       "\t# if actions are in separate files, specified in deployment\n"
+                       "\tExample: %s msg_platform.xml msg_deployment.xml ",
+             argv[0], argv[0], argv[0]);
 
   MSG_create_environment(argv[1]);
   MSG_launch_application(argv[2]);
@@ -10,34 +10,37 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(storage_actions, "Messages specific for this exampl
 
 static xbt_dict_t opened_files = NULL;
 
-#define ACT_DEBUG(...) \
-  if (XBT_LOG_ISENABLED(storage_actions, xbt_log_priority_verbose)) {  \
-    char *NAME = xbt_str_join_array(action, " ");              \
-    XBT_DEBUG(__VA_ARGS__);                                    \
-    xbt_free(NAME);                                            \
-  } else ((void)0)
-
-static void log_action(const char *const *action, double date)
+#define ACT_DEBUG(...)                                                                                                 \
+  if (XBT_LOG_ISENABLED(storage_actions, xbt_log_priority_verbose)) {                                                  \
+    char* NAME = xbt_str_join_array(action, " ");                                                                      \
+    XBT_DEBUG(__VA_ARGS__);                                                                                            \
+    xbt_free(NAME);                                                                                                    \
+  } else                                                                                                               \
+  ((void)0)
+
+static void log_action(const char* const* action, double date)
 {
   if (XBT_LOG_ISENABLED(storage_actions, xbt_log_priority_verbose)) {
-    char *name = xbt_str_join_array(action, " ");
+    charname = xbt_str_join_array(action, " ");
     XBT_VERB("%s %f", name, date);
     xbt_free(name);
   }
 }
 
-static msg_file_t get_file_descriptor(const char *file_name){
+static msg_file_t get_file_descriptor(const char* file_name)
+{
   char full_name[1024];
 
-  snprintf(full_name,1023, "%s:%s", MSG_process_get_name(MSG_process_self()), file_name);
+  snprintf(full_name, 1023, "%s:%s", MSG_process_get_name(MSG_process_self()), file_name);
 
   msg_file_t file = (msg_file_t)xbt_dict_get_or_null(opened_files, full_name);
   return file;
 }
 
-static sg_size_t parse_size(const char *string){
+static sg_size_t parse_size(const char* string)
+{
   sg_size_t size;
-  char *endptr;
+  charendptr;
 
   size = strtoul(string, &endptr, 10);
   if (*endptr != '\0')
@@ -45,13 +48,14 @@ static sg_size_t parse_size(const char *string){
   return size;
 }
 
-static void action_open(const char *const *action) {
-  const char *file_name = action[2];
+static void action_open(const char* const* action)
+{
+  const char* file_name = action[2];
   char full_name[1024];
   msg_file_t file = NULL;
-  double clock = MSG_get_clock();
+  double clock    = MSG_get_clock();
 
-  snprintf(full_name,1023, "%s:%s", MSG_process_get_name(MSG_process_self()), file_name);
+  snprintf(full_name, 1023, "%s:%s", MSG_process_get_name(MSG_process_self()), file_name);
 
   ACT_DEBUG("Entering Open: %s (filename: %s)", NAME, file_name);
   file = MSG_file_open(file_name, NULL);
@@ -61,10 +65,11 @@ static void action_open(const char *const *action) {
   log_action(action, MSG_get_clock() - clock);
 }
 
-static void action_read(const char *const *action) {
-  const char *file_name = action[2];
-  const char *size_str = action[3];
-  sg_size_t size = parse_size(size_str);
+static void action_read(const char* const* action)
+{
+  const char* file_name = action[2];
+  const char* size_str  = action[3];
+  sg_size_t size        = parse_size(size_str);
 
   double clock = MSG_get_clock();
 
@@ -76,8 +81,9 @@ static void action_read(const char *const *action) {
   log_action(action, MSG_get_clock() - clock);
 }
 
-static void action_close(const char *const *action) {
-  const char *file_name = action[2];
+static void action_close(const char* const* action)
+{
+  const char* file_name = action[2];
   msg_file_t file;
   double clock = MSG_get_clock();
 
@@ -89,12 +95,14 @@ static void action_close(const char *const *action) {
   log_action(action, MSG_get_clock() - clock);
 }
 
-int main(int argc, char *argv[]) {
+int main(int argc, char* argv[])
+{
   MSG_init(&argc, argv);
   /* Explicit initialization of the action module is required */
   MSG_action_init();
 
-  xbt_assert(argc > 3,"Usage: %s platform_file deployment_file [action_files]\n"
+  xbt_assert(argc > 3,
+             "Usage: %s platform_file deployment_file [action_files]\n"
              "\texample: %s platform.xml deployment.xml actions # if all actions are in the same file\n"
              "\texample: %s platform.xml deployment.xml # if actions are in separate files, specified in deployment\n",
              argv[0], argv[0], argv[0]);
@@ -120,5 +128,5 @@ int main(int argc, char *argv[]) {
   /* Explicit finalization of the action module is required now*/
   MSG_action_exit();
 
-  return res!=MSG_OK;
+  return res != MSG_OK;
 }
index 01a2dfa..ce8eac5 100644 (file)
@@ -6,12 +6,13 @@
 /* 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. */
 
-#include "xbt/sysdep.h"
+#include "simgrid/msg.h"
+#include "src/surf/surf_interface.hpp"
 #include "surf/maxmin.h"
 #include "xbt/log.h"
 #include "xbt/module.h"
+#include "xbt/sysdep.h"
 #include <math.h>
-#include "src/surf/surf_interface.hpp"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, "Messages specific for surf example");
 
@@ -298,8 +299,9 @@ static void test3(method_t method)
   xbt_free(A);
 }
 
-int main()
+int main(int argc, char** argv)
 {
+  MSG_init(&argc, argv);
   XBT_INFO("***** Test 1 (Max-Min)");
   test1(MAXMIN);
   XBT_INFO("***** Test 1 (Lagrange - Vegas)");
index c4972b2..aed2abb 100644 (file)
@@ -7,9 +7,10 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "surf/maxmin.h"
+#include "simgrid/msg.h"
 #include "xbt/module.h"
+#include "xbt/sysdep.h" /* time manipulation for benchmarking */
 #include "xbt/xbt_os_time.h"
-#include "xbt/sysdep.h"         /* time manipulation for benchmarking */
 
 #define MYRANDMAX 1000
 
@@ -117,6 +118,8 @@ unsigned int TestClasses [][4]=
 
 int main(int argc, char **argv)
 {
+  MSG_init(&argc, argv);
+
   float rate_no_limit=0.2;
   float acc_date=0;
   float acc_date2=0;
index 1ce4276..0b0f8af 100644 (file)
@@ -13,7 +13,6 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, "Messages specific for surf example");
 
 int main(int argc, char **argv)
 {
-  double now = -1.0;
   int running;
 
   surf_init(&argc, argv);       /* Initialize some common structures */
@@ -40,7 +39,7 @@ int main(int argc, char **argv)
     surf_action_t action = nullptr;
     running = 0;
 
-    now = surf_get_clock();
+    double now = surf_get_clock();
     XBT_INFO("Next Event : %g", now);
 
     for (auto model: *all_existing_models) {
index 3d2c542..47797d2 100644 (file)
@@ -10,6 +10,7 @@
 #include <math.h>
 #include <xbt/xbt_os_time.h>
 
+#include "simgrid/msg.h"
 #include "xbt/heap.h"
 #include "xbt/sysdep.h"
 
@@ -89,10 +90,11 @@ static void test_heap_mean_operation(int size)
   xbt_heap_free(heap);
 }
 
-int main(int argc, char **argv)
+int main(int argc, char** argv)
 {
-  int size;
-  for (size = 100; size < 10000; size *= 10) {
+  MSG_init(&argc, argv);
+
+  for (int size = 100; size < 10000; size *= 10) {
     test_heap_validity(size);
     test_heap_mean_operation(size);
   }
index 9eeec68..3abb24a 100644 (file)
@@ -7,11 +7,13 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "xbt.h"
+#include <simgrid/msg.h>
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Logs of this example");
 
 int main(int argc, char *argv[])
 {
+  MSG_init(&argc, argv);
   char *tmp = bprintf("\n%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s",
     1, ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
     2, ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
@@ -24,8 +26,6 @@ int main(int argc, char *argv[])
     9, ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
     0, ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n");
 
-  xbt_init(&argc, argv);
-
   XBT_INFO("This is a very large message:\n0%s1%s2%s3%s4%s5%s6%s7%s8%s9%s",
          tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp);
   XBT_INFO("Done (strlen>%d)", (int) (10 * strlen(tmp)));
index 6415bbb..ca88375 100644 (file)
@@ -579,6 +579,8 @@ set(MC_SRC
   src/mc/remote/Channel.hpp
   src/mc/remote/Client.cpp
   src/mc/remote/Client.hpp
+  src/mc/remote/RemoteClient.hpp
+  src/mc/remote/RemoteClient.cpp
   src/mc/remote/RemotePtr.hpp
   src/mc/remote/mc_protocol.h
   src/mc/remote/mc_protocol.cpp
@@ -599,8 +601,6 @@ set(MC_SRC
   src/mc/Type.hpp
   src/mc/Variable.hpp
   src/mc/mc_forward.hpp
-  src/mc/Process.hpp
-  src/mc/Process.cpp
   src/mc/Session.cpp
   src/mc/Session.hpp
   src/mc/mc_unw.h
@@ -610,8 +610,8 @@ set(MC_SRC
   src/mc/mc_snapshot.h
   src/mc/mc_snapshot.cpp
   src/mc/mc_page_snapshot.cpp
-  src/mc/mc_comm_pattern.h
   src/mc/mc_comm_pattern.cpp
+  src/mc/mc_comm_pattern.hpp
   src/mc/compare.cpp
   src/mc/mc_dwarf.hpp
   src/mc/mc_dwarf.cpp