Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr/gitroot/simgrid/simgrid
authorJulien Gossa <julien.gossa@unistra.fr>
Mon, 29 Feb 2016 13:25:32 +0000 (14:25 +0100)
committerJulien Gossa <julien.gossa@unistra.fr>
Mon, 29 Feb 2016 13:25:32 +0000 (14:25 +0100)
[doc] Change of Task.setBound comment to fit the native semantic.

91 files changed:
.gitignore
CMakeLists.txt
doc/doxygen/FAQ.doc
examples/msg/README
examples/msg/actions/actions.c
examples/msg/actions/storage_actions.c
examples/msg/bittorrent/connection.c
examples/msg/chainsend/CMakeLists.txt
examples/msg/chainsend/README [deleted file]
examples/msg/chainsend/broadcaster.c
examples/msg/chainsend/broadcaster.h
examples/msg/chainsend/chainsend.c
examples/msg/chainsend/common.h
examples/msg/chainsend/iterator.h
examples/msg/chainsend/messages.h
examples/msg/chainsend/peer.c
examples/msg/chainsend/peer.h
examples/msg/chord/chord.c
examples/msg/cloud/master_worker_vm.c
examples/msg/cloud/master_worker_vm.tesh
examples/msg/cloud/migrate_vm.c
examples/msg/cloud/multicore.c
examples/msg/cloud/scale.c
examples/msg/cloud/simple_vm.c
examples/msg/cloud/two_tasks_vm.c
examples/msg/energy/consumption/energy_consumption.c
examples/msg/energy/onoff/onoff.c
examples/msg/energy/pstate/pstate.c
examples/msg/energy/vm/CMakeLists.txt
examples/msg/energy/vm/deployment_consumption.xml [deleted file]
examples/msg/energy/vm/energy_vm.c
examples/msg/exception/exception.c
examples/msg/gpu/test_MSG_gpu_task_create.c
examples/msg/gtnets/gtnets.c
examples/msg/icomms/peer.c
examples/msg/icomms/peer2.c
examples/msg/icomms/peer3.c
examples/msg/io/file.c
examples/msg/io/file_unlink.c
examples/msg/io/remote.c
examples/msg/io/storage.c
examples/msg/kademlia/kademlia.c
examples/msg/kademlia/node.c
examples/msg/kademlia/routing_table.c
examples/msg/masterslave/masterslave_arg.c
examples/msg/masterslave/masterslave_failure.c
examples/msg/masterslave/masterslave_forwarder.c
examples/msg/masterslave/masterslave_kill.c
examples/msg/masterslave/masterslave_mailbox.c
examples/msg/migration/migration.c
examples/msg/ns3/ns3.c
examples/msg/parallel_task/parallel_task.c
examples/msg/pastry/pastry.c
examples/msg/pmm/msg_pmm.c
examples/msg/semaphores/synchro.c
examples/msg/start_kill_time/sk_time.c
include/simgrid/s4u/actor.hpp
include/simgrid/simix.h
src/include/surf/surf.h
src/instr/jedule/jedule_sd_binding.cpp
src/mc/RegionSnapshot.cpp
src/mc/RegionSnapshot.hpp
src/mc/mc_checkpoint.cpp
src/mc/mc_compare.cpp
src/mc/mc_snapshot.h
src/msg/msg_environment.cpp
src/msg/msg_gos.cpp
src/msg/msg_mailbox.cpp
src/msg/msg_process.cpp
src/probes.tp [deleted file]
src/s4u/s4u_actor.cpp
src/simix/smx_process.cpp
src/smpi/smpi_global.cpp
src/surf/instr_routing.cpp
src/surf/surf_routing.cpp
src/surf/surf_routing.hpp
src/surf/surf_routing_RoutedGraph.cpp
src/surf/surf_routing_RoutedGraph.hpp
src/surf/surf_routing_dijkstra.cpp
src/surf/surf_routing_dijkstra.hpp
src/surf/surf_routing_floyd.cpp
src/surf/surf_routing_floyd.hpp
src/surf/surf_routing_full.cpp
src/surf/surf_routing_full.hpp
src/surf/surf_routing_vivaldi.hpp
src/xbt/probes.h [deleted file]
tools/cmake/DefinePackages.cmake
tools/cmake/MakeLib.cmake
tools/cmake/Modules/FindRubySimgrid.cmake [deleted file]
tools/cmake/Option.cmake
tools/stack-cleaner/as

index f7dcfda..d258f85 100644 (file)
@@ -139,7 +139,6 @@ examples/msg/cloud/scale
 examples/msg/cloud/simple_vm
 examples/msg/cloud/two_tasks_vm
 examples/msg/energy/consumption/energy_consumption
-examples/msg/energy/e3/e3
 examples/msg/energy/onoff/onoff
 examples/msg/energy/pstate/pstate
 examples/msg/gpu/test_MSG_gpu_task_create
@@ -158,13 +157,10 @@ examples/msg/irc_isend/toto.txt
 examples/msg/kademlia/kademlia
 examples/msg/masterslave/masterslave_arg
 examples/msg/masterslave/masterslave_cluster
-examples/msg/masterslave/masterslave_console
 examples/msg/masterslave/masterslave_failure
-examples/msg/masterslave/masterslave_failure_platfgen
 examples/msg/masterslave/masterslave_forwarder
 examples/msg/masterslave/masterslave_kill
 examples/msg/masterslave/masterslave_mailbox
-examples/msg/masterslave/masterslave_platfgen
 examples/msg/masterslave/toto.txt
 examples/msg/mc/bugged1
 examples/msg/mc/bugged1_liveness
index c2cd759..fd5fe39 100644 (file)
@@ -740,6 +740,8 @@ else()
     message(FATAL_ERROR "Could not figure out the stack direction. Test prog returned: ${stack}; CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}.")
   endif()
 endif()
+# If the test ran well, remove the test binary
+execute_process(COMMAND ${CMAKE_COMMAND} -E remove test_stackgrowth)
 
 ###############
 ## System checks
index 11b7ba9..0cdd751 100644 (file)
@@ -49,19 +49,16 @@ We also have a more graphical output. Have a look at section \ref options_tracin
 
 \subsection faq_C Argh! Do I really have to code in C?
 
-Currently bindings on top of MSG are supported for Java, Ruby and Lua. You can find a few
-documentation about them on the doc page. Note that bindings are released separately from the main dist
-and so have their own version numbers.
-
-Moreover If you use C++,
-you should be able to use the SimGrid library as a standard C library
-and everything should work fine (simply <i>link</i> against this
-library; recompiling SimGrid with a C++ compiler won't work and it
-wouldn't help if you could).
-
-For now,
-we do not feel a real demand for any other language. But if you think there is one,
- please speak up!
+We provide Java bindings of the MSG interface, which is the main
+SimGrid user API.
+
+Moreover If you use C++, you should be able to use the SimGrid library
+as a standard C library and everything should work fine (simply
+<i>link</i> against this library; recompiling SimGrid with a C++
+compiler won't work and it wouldn't help if you could).
+
+For now, we do not feel a real demand for any other language. But if
+you think there is one, please speak up!
 
 \section faq_howto Feature related questions
 
index ecdfac5..58db3bd 100644 (file)
@@ -57,7 +57,7 @@ communications, there is several other examples in the archive:
  * msg/icomms/peer2.c: demonstrates the MSG_comm_waitall() function
  * msg/icomms/peer3.c: demonstrates the MSG_comm_waitany() function
 
-Tracing and vizualization features
+Tracing and visualization features
 ==================================
  * tracing/simple.c very simple program that creates, executes and
    destroy a task
index f8b1b88..df86b80 100644 (file)
@@ -4,9 +4,7 @@
 /* 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 <stdio.h>
-#include <stdlib.h>
-#include "simgrid/msg.h"        /* Yeah! If you want to use msg, you need to include simgrid/msg.h */
+#include "simgrid/msg.h"
 #include "simgrid/simix.h"      /* semaphores for the barrier */
 #include <xbt/replay.h>
 
  *
  *  @section MSG_ex_actions Trace driven simulations
  * 
- *  The <b>actions/actions.c</b> example demonstrates how to run trace-driven simulations. It
- *  is very handy when you want to test an algorithm or protocol that
- *  does nothing unless it receives some events from outside. For
- *  example, a P2P protocol reacts to requests from the user, but
- *  does nothing if there is no such event. 
+ *  The <b>actions/actions.c</b> example demonstrates how to run trace-driven simulations. It is very handy when you
+ *  want to test an algorithm or protocol that does nothing unless it receives some events from outside. For example,
+ *  a P2P protocol reacts to requests from the user, but does nothing if there is no such event.
  * 
- *  In such situations, SimGrid allows to write your protocol in your
- *  C file, and the events to react to in a separate text file.
- *  Declare a function handling each of the events that you want to
- *  accept in your trace files, register them using \ref
- *  xbt_replay_action_register in your main, and then use \ref
- *  MSG_action_trace_run to launch the simulation. You can either
- *  have one trace file containing all your events, or a file per
- *  simulated process. Check the tesh files in the example directory
- *  for details on how to do it.
+ *  In such situations, SimGrid allows to write your protocol in your C file, and the events to react to in a separate
+ *  text file. Declare a function handling each of the events that you want to accept in your trace files, register
+ *  them using \ref xbt_replay_action_register in your main, and then use \ref MSG_action_trace_run to launch the
+ *  simulation. You can either have one trace file containing all your events, or a file per simulated process. Check
+ *  the tesh files in the example directory for details on how to do it.
  *
- *  This example uses this approach to replay MPI-like traces. It
- *  comes with a set of event handlers reproducing MPI events. This
- *  is somehow similar to SMPI, yet differently implemented. This
- *  code should probably be changed to use SMPI internals instead,
- *  but wasn't, so far.
- * 
+ *  This example uses this approach to replay MPI-like traces. It comes with a set of event handlers reproducing MPI
+ *  events. This is somehow similar to SMPI, yet differently implemented. This code should probably be changed to use
+ *  SMPI internals instead, but wasn't, so far.
  */
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(actions, "Messages specific for this msg example");
@@ -84,8 +73,7 @@ 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 */
   int found;
@@ -102,7 +90,7 @@ 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();       /* this "call" is free thanks to inlining */
+  double clock = MSG_get_clock();
 
   sprintf(to, "%s_%s", MSG_process_get_name(MSG_process_self()), action[2]);
 
@@ -122,12 +110,10 @@ 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());
+  process_globals_t globals = (process_globals_t) MSG_process_get_data(MSG_process_self());
 
   sprintf(to, "%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);
+  msg_comm_t comm = MSG_task_isend(MSG_task_create(to, 0, parse_double(size), NULL), to);
   xbt_dynar_push(globals->isends, &comm);
 
   XBT_DEBUG("Isend on %s", MSG_process_get_name(MSG_process_self()));
@@ -135,15 +121,13 @@ static void action_Isend(const char *const *action)
   asynchronous_cleanup();
 }
 
-
 static void action_recv(const char *const *action)
 {
   char mailbox_name[250];
   msg_task_t task = NULL;
   double clock = MSG_get_clock();
 
-  sprintf(mailbox_name, "%s_%s", action[2],
-          MSG_process_get_name(MSG_process_self()));
+  sprintf(mailbox_name, "%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);
@@ -159,36 +143,28 @@ 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());
+  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()));
 
-  sprintf(mailbox, "%s_%s", action[2],
-          MSG_process_get_name(MSG_process_self()));
+  sprintf(mailbox, "%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);
+  msg_comm_t c = MSG_task_irecv(xbt_dynar_get_ptr(globals->tasks, xbt_dynar_length(globals->tasks) - 1), mailbox);
   xbt_dynar_push(globals->irecvs, &c);
 
   log_action(action, MSG_get_clock() - clock);
   asynchronous_cleanup();
 }
 
-
 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());
+  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_assert(xbt_dynar_length(globals->irecvs), "action wait not preceded by any irecv: %s",
              xbt_str_join_array(action, " "));
 
   ACT_DEBUG("Entering %s", NAME);
@@ -213,8 +189,7 @@ static void action_barrier(const char *const *action)
     cond = simcall_cond_init();
     processes_arrived_sofar = 0;
   }
-  ACT_DEBUG("Entering barrier: %s (%d already there)", NAME,
-            processes_arrived_sofar);
+  ACT_DEBUG("Entering barrier: %s (%d already there)", NAME, processes_arrived_sofar);
 
   simcall_mutex_lock(mutex);
   if (++processes_arrived_sofar == communicator_size) {
@@ -246,11 +221,9 @@ static void action_reduce(const char *const *action)
   const char *process_name;
   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");
+  xbt_assert(communicator_size, "Size of Communicator is not defined can't use collective operations");
 
   process_name = MSG_process_get_name(MSG_process_self());
 
@@ -278,13 +251,11 @@ static void action_reduce(const char *const *action)
     MSG_task_execute(comp_task);
     MSG_task_destroy(comp_task);
     XBT_DEBUG("%s: computed", reduce_identifier);
-
   } else {
     XBT_DEBUG("%s: %s sends", reduce_identifier, process_name);
     sprintf(mailbox, "%s_%s_p0", reduce_identifier, process_name);
     XBT_DEBUG("put on %s", mailbox);
-    MSG_task_send(MSG_task_create(reduce_identifier, 0, comm_size, NULL),
-                  mailbox);
+    MSG_task_send(MSG_task_create(reduce_identifier, 0, comm_size, NULL), mailbox);
   }
 
   log_action(action, MSG_get_clock() - clock);
@@ -301,11 +272,9 @@ static void action_bcast(const char *const *action)
   const char *process_name;
   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");
+  xbt_assert(communicator_size, "Size of Communicator is not defined, can't use collective operations");
 
   process_name = MSG_process_get_name(MSG_process_self());
 
@@ -318,17 +287,14 @@ static void action_bcast(const char *const *action)
 
     for (i = 1; i < communicator_size; i++) {
       sprintf(mailbox, "%s_p0_p%d", bcast_identifier, i);
-      comms[i - 1] =
-          MSG_task_isend(MSG_task_create(mailbox, 0, comm_size, NULL), mailbox);
+      comms[i - 1] = MSG_task_isend(MSG_task_create(mailbox, 0, comm_size, NULL), mailbox);
     }
     MSG_comm_waitall(comms, communicator_size - 1, -1);
     for (i = 1; i < communicator_size; i++)
       MSG_comm_destroy(comms[i - 1]);
     xbt_free(comms);
 
-    XBT_DEBUG("%s: all messages sent by %s have been received",
-              bcast_identifier, process_name);
-
+    XBT_DEBUG("%s: all messages sent by %s have been received", bcast_identifier, process_name);
   } else {
     sprintf(mailbox, "%s_p0_%s", bcast_identifier, process_name);
     MSG_task_receive(&task, mailbox);
@@ -340,7 +306,6 @@ static void action_bcast(const char *const *action)
   xbt_free(bcast_identifier);
 }
 
-
 static void action_sleep(const char *const *action)
 {
   const char *duration = action[2];
@@ -362,11 +327,9 @@ static void action_allReduce(const char *const *action)
   const char *process_name;
   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");
+  xbt_assert(communicator_size, "Size of Communicator is not defined, can't use collective operations");
 
   process_name = MSG_process_get_name(MSG_process_self());
 
@@ -396,23 +359,19 @@ static void action_allReduce(const char *const *action)
 
     for (i = 1; i < communicator_size; i++) {
       sprintf(mailbox, "%s_p0_p%d", allreduce_identifier, i);
-      comms[i - 1] =
-          MSG_task_isend(MSG_task_create(mailbox, 0, comm_size, NULL), mailbox);
+      comms[i - 1] = MSG_task_isend(MSG_task_create(mailbox, 0, comm_size, NULL), mailbox);
     }
     MSG_comm_waitall(comms, communicator_size - 1, -1);
     for (i = 1; i < communicator_size; i++)
       MSG_comm_destroy(comms[i - 1]);
     xbt_free(comms);
 
-    XBT_DEBUG("%s: all messages sent by %s have been received",
-              allreduce_identifier, process_name);
-
+    XBT_DEBUG("%s: all messages sent by %s have been received", allreduce_identifier, process_name);
   } else {
     XBT_DEBUG("%s: %s sends", allreduce_identifier, process_name);
     sprintf(mailbox, "%s_%s_p0", allreduce_identifier, process_name);
     XBT_DEBUG("put on %s", mailbox);
-    MSG_task_send(MSG_task_create(allreduce_identifier, 0, comm_size, NULL),
-                  mailbox);
+    MSG_task_send(MSG_task_create(allreduce_identifier, 0, comm_size, NULL), mailbox);
 
     sprintf(mailbox, "%s_p0_%s", allreduce_identifier, process_name);
     MSG_task_receive(&task, mailbox);
@@ -448,19 +407,16 @@ static void action_compute(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));
+  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)
 {
-  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));
@@ -489,14 +445,10 @@ int main(int argc, char *argv[])
        argv[0],argv[0],argv[0]);
 
   printf("WARNING: THIS BINARY IS KINDA DEPRECATED\n"
-   "This example is still relevant if you want to learn about MSG-based trace replay, "
-   "but if you want to simulate MPI-like traces, you should use the newer version "
-   "that is in the examples/smpi/replay directory instead.\n");
+   "This example is still relevant if you want to learn about MSG-based trace replay, but if you want to simulate "
+   "MPI-like traces, you should use the newer version that is in the examples/smpi/replay directory instead.\n");
    
-  /*  Simulation setting */
   MSG_create_environment(argv[1]);
-
-  /* No need to register functions as in classical MSG programs: the actions get started anyway */
   MSG_launch_application(argv[2]);
 
   /*   Action registration */
@@ -515,7 +467,6 @@ int main(int argc, char *argv[])
   xbt_replay_action_register("sleep", action_sleep);
   xbt_replay_action_register("compute", action_compute);
 
-
   /* Actually do the simulation using MSG_action_trace_run */
   res = MSG_action_trace_run(argv[3]);  // it's ok to pass a NULL argument here
 
@@ -525,4 +476,4 @@ int main(int argc, char *argv[])
   MSG_action_exit();
 
   return res != MSG_OK;
-}                               /* end_of_main */
+}
index aa1ef5b..0d29d49 100644 (file)
@@ -4,10 +4,7 @@
 /* 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 <stdio.h>
-#include <stdlib.h>
 #include "simgrid/msg.h"
-#include "xbt.h"                /* calloc, printf */
 #include <xbt/replay.h>
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(storage_actions, "Messages specific for this example");
@@ -43,28 +40,26 @@ static msg_file_t get_file_descriptor(const char *file_name){
 static sg_size_t parse_size(const char *string){
   sg_size_t size;
   char *endptr;
-  
+
   size = strtoul(string, &endptr, 10);
   if (*endptr != '\0')
     THROWF(unknown_error, 0, "%s is not a long unsigned int (a.k.a. sg_size_t)", string);
   return size;
 }
 
-
 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();       /* this "call" is free thanks to inlining */
+  double clock = MSG_get_clock();
 
-  sprintf(full_name, "%s:%s", MSG_process_get_name(MSG_process_self()), 
-    file_name);
+  sprintf(full_name, "%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);
+
   xbt_dict_set(opened_files, full_name, file, NULL);
-  
+
   log_action(action, MSG_get_clock() - clock);
 }
 
@@ -73,11 +68,11 @@ static void action_read(const char *const *action) {
   const char *size_str = action[3];
   msg_file_t file = NULL;
   sg_size_t size = parse_size(size_str);
-  
-  double clock = MSG_get_clock();       /* this "call" is free thanks to inlining */
+
+  double clock = MSG_get_clock();
 
   file = get_file_descriptor(file_name);
-  
+
   ACT_DEBUG("Entering Read: %s (size: %llu)", NAME, size);
   MSG_file_read(file, size);
 
@@ -87,7 +82,7 @@ static void action_read(const char *const *action) {
 static void action_close(const char *const *action) {
   const char *file_name = action[2];
   msg_file_t file;
-  double clock = MSG_get_clock();       /* this "call" is free thanks to inlining */
+  double clock = MSG_get_clock();
 
   file = get_file_descriptor(file_name);
 
@@ -100,33 +95,23 @@ static void action_close(const char *const *action) {
 int main(int argc, char *argv[]) {
   msg_error_t res = MSG_OK;
 
-  /* Check the given arguments */
   MSG_init(&argc, argv);
   /* Explicit initialization of the action module is required now*/
   MSG_action_init();
 
-  if (argc < 3) {
-    printf("Usage: %s platform_file deployment_file [action_files]\n", argv[0]);
-    printf
-        ("example: %s msg_platform.xml msg_deployment.xml actions # if all actions are in the same file\n",
-         argv[0]);
-    printf
-        ("example: %s msg_platform.xml msg_deployment.xml # if actions are in separate files, specified in deployment\n",
-         argv[0]);
-    exit(1);
-  }
+  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]);
 
-  /*  Simulation setting */
   MSG_create_environment(argv[1]);
-
-  /* No need to register functions as in classical MSG programs: the actions get started anyway */
   MSG_launch_application(argv[2]);
 
   /*   Action registration */
   xbt_replay_action_register("open", action_open);
   xbt_replay_action_register("read", action_read);
   xbt_replay_action_register("close", action_close);
-  
+
   if (!opened_files)
     opened_files = xbt_dict_new_homogeneous(NULL);
   /* Actually do the simulation using MSG_action_trace_run */
@@ -140,5 +125,5 @@ int main(int argc, char *argv[]) {
   /* Explicit finalization of the action module is required now*/
   MSG_action_exit();
 
-  return !!res;
-}                               /* end_of_main */
+  return res!=MSG_OK;
+}
index c0ee2a5..847a6c4 100644 (file)
@@ -38,5 +38,4 @@ void connection_free(void *data)
   xbt_free(co->bitfield);
   xbt_free(co->mailbox);
   xbt_free(co);
-
 }
index 773c0cb..b90e420 100644 (file)
@@ -23,10 +23,3 @@ set(examples_src
   ${CMAKE_CURRENT_SOURCE_DIR}/peer.c
   ${CMAKE_CURRENT_SOURCE_DIR}/chainsend.c
   PARENT_SCOPE)
-set(bin_files
-  ${bin_files}
-  PARENT_SCOPE)
-set(txt_files
-  ${txt_files}
-  ${CMAKE_CURRENT_SOURCE_DIR}/README
-  PARENT_SCOPE)
diff --git a/examples/msg/chainsend/README b/examples/msg/chainsend/README
deleted file mode 100644 (file)
index 17b605b..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-This directory contains a MSG implementation of a file broadcasting
-system, similar to Kastafior (from the Kadeploy).
index 112bb25..f14a1be 100644 (file)
@@ -6,8 +6,7 @@
 
 #include "broadcaster.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_broadcaster,
-                             "Messages specific for the broadcaster");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_broadcaster, "Messages specific for the broadcaster");
 
 xbt_dynar_t build_hostlist_from_hostcount(int hostcount)
 {
@@ -38,8 +37,7 @@ int broadcaster_build_chain(broadcaster_t bc)
     next = *cur;
     bc->first = next;
 
-    /* This iterator iterates one step ahead: cur is current iterated element, 
-       but it's actually the next one in the chain */
+    /* This iterator iterates one step ahead: cur is current iterated element, but is actually next in the chain */
     do {
       /* following steps: prev=last, host=next, next=cur */
       cur = (char**)xbt_dynar_iterator_next(bc->it);
@@ -49,8 +47,8 @@ int broadcaster_build_chain(broadcaster_t bc)
         next = *cur;
       else
         next = NULL;
-      XBT_DEBUG("Building chain -- broadcaster:\"%s\" dest:\"%s\" prev:\"%s\" next:\"%s\"", me, current_host, prev, next);
-    
+      XBT_DEBUG("Building chain--broadcaster:\"%s\" dest:\"%s\" prev:\"%s\" next:\"%s\"", me, current_host, prev, next);
+
       /* Send message to current peer */
       task = task_message_chain_new(prev, next, bc->piece_count);
       MSG_task_send(task, current_host);
index c1f9198..e9aca94 100644 (file)
@@ -4,16 +4,10 @@
 /* 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. */
 
-#ifndef KADEPLOY_BROADCASTER_H
-#define KADEPLOY_BROADCASTER_H
-
-#include "simgrid/msg.h"
-#include "xbt/sysdep.h"
-
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
+#ifndef BROADCASTER_H
+#define BROADCASTER_H
 
+#include "xbt/dynar.h"
 #include "messages.h"
 #include "iterator.h"
 #include "common.h"
@@ -46,4 +40,4 @@ int broadcaster_send_file(broadcaster_t bc);
 /* Tasks */
 int broadcaster(int argc, char *argv[]);
 
-#endif /* KADEPLOY_BROADCASTER_H */
+#endif /* BROADCASTER_H */
index 51ca4d7..e7316ac 100644 (file)
@@ -4,16 +4,7 @@
 /* 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 <stdio.h>
-#include <stdlib.h>
-
-#include "simgrid/msg.h"        /* Yeah! If you want to use msg, you need to include simgrid/msg.h */
-#include "xbt/sysdep.h"         /* calloc */
-
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
-
+#include "simgrid/msg.h"
 #include "iterator.h"
 #include "messages.h"
 #include "broadcaster.h"
 
 /** @addtogroup MSG_examples
  * 
- *  - <b>chainsend/chainsend.c: Chainsend implementation</b>.
+ *  - <b>chainsend: MSG implementation of a file broadcasting system, similar to Kastafior (from Kadeploy).</b>.
  */
 
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_chainsend, "Messages specific for chainsend");
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_chainsend,
-                             "Messages specific for chainsend");
-
-/*
- Data structures
- */
-
-/* Initialization stuff */
-msg_error_t test_all(const char *platform_file,
-                     const char *application_file);
-
-
-/** Test function */
-msg_error_t test_all(const char *platform_file,
-                     const char *application_file)
+int main(int argc, char *argv[])
 {
-
   msg_error_t res = MSG_OK;
 
-  XBT_DEBUG("test_all");
+  MSG_init(&argc, argv);
 
-  /*  Simulation setting */
-  MSG_create_environment(platform_file);
+  MSG_create_environment(argv[1]);
 
   /* Trace categories */
   TRACE_category_with_color("host0", "0 0 1");
@@ -64,33 +40,11 @@ msg_error_t test_all(const char *platform_file,
   MSG_function_register("broadcaster", broadcaster);
   MSG_function_register("peer", peer);
 
-  MSG_launch_application(application_file);
+  MSG_launch_application(argv[2]);
 
   res = MSG_main();
 
-  return res;
-}                               /* end_of_test_all */
-
-
-/** Main function */
-int main(int argc, char *argv[])
-{
-  msg_error_t res = MSG_OK;
-
-#ifdef _MSC_VER
-  unsigned int prev_exponent_format =
-      _set_output_format(_TWO_DIGIT_EXPONENT);
-#endif
-
-  MSG_init(&argc, argv);
-
-  res = test_all(argv[1], argv[2]);
-
   XBT_INFO("Total simulation time: %e", MSG_get_clock());
 
-#ifdef _MSC_VER
-  _set_output_format(prev_exponent_format);
-#endif
-
   return res != MSG_OK;
 }
index 8b0249d..57ca331 100644 (file)
@@ -4,8 +4,8 @@
 /* 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. */
 
-#ifndef KADEPLOY_COMMON_H
-#define KADEPLOY_COMMON_H
+#ifndef COMMON_H
+#define COMMON_H
 
 #include "simgrid/msg.h"
 #include "xbt/sysdep.h"
@@ -17,4 +17,4 @@ static XBT_INLINE void queue_pending_connection(msg_comm_t comm, xbt_dynar_t q)
 
 int process_pending_connections(xbt_dynar_t q);
 
-#endif /* KADEPLOY_COMMON_H */
+#endif /* COMMON_H */
index dfc2693..5d3d06d 100644 (file)
@@ -4,10 +4,8 @@
 /* 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. */
 
-#ifndef KADEPLOY_ITERATOR_H
-#define KADEPLOY_ITERATOR_H
-
-#include <stdlib.h>
+#ifndef ITERATOR_H
+#define ITERATOR_H
 
 #include "xbt/dynar.h"
 #include "xbt/sysdep.h"
@@ -45,4 +43,4 @@ void xbt_dynar_shuffle_in_place(xbt_dynar_t indices_list);
     xbt_dynar_get_as(indices_list, (unsigned int)i, type)); \
   xbt_dynar_set_as(indices_list, (unsigned int)i, type, tmp);
 
-#endif /* KADEPLOY_ITERATOR_H */
+#endif /* ITERATOR_H */
index 9e976d4..e90bf62 100644 (file)
@@ -4,11 +4,10 @@
 /* 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. */
 
-#ifndef KADEPLOY_MESSAGES_H
-#define KADEPLOY_MESSAGES_H
+#ifndef MESSAGES_H
+#define MESSAGES_H
 
 #include "simgrid/msg.h"
-#include "xbt/sysdep.h"
 
 #define MESSAGE_BUILD_CHAIN_SIZE 40
 #define MESSAGE_SEND_DATA_HEADER_SIZE 1
@@ -36,4 +35,4 @@ msg_task_t task_message_chain_new(const char* prev, const char *next, const unsi
 msg_task_t task_message_data_new(const char *block, unsigned int len);
 void task_message_delete(void *);
 
-#endif /* KADEPLOY_MESSAGES_H */
+#endif /* MESSAGES_H */
index 6be29c1..433200e 100644 (file)
@@ -6,12 +6,7 @@
 
 #include "peer.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_peer,
-                             "Messages specific for the peer");
-
-/*******************************************************
- *                     Peer                            *
- *******************************************************/
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_peer, "Messages specific for the peer");
 
 void peer_init_chain(peer_t peer, message_t msg)
 {
@@ -161,4 +156,4 @@ int peer(int argc, char *argv[])
   peer_delete(p);
 
   return status;
-}                               /* end_of_receiver */
+}
index 71306b1..4ed5bcc 100644 (file)
@@ -4,11 +4,11 @@
 /* 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. */
 
-#ifndef KADEPLOY_PEER_H
-#define KADEPLOY_PEER_H
+#ifndef PEER_H
+#define PEER_H
 
 #include "simgrid/msg.h"
-#include "xbt/sysdep.h"
+#include "xbt/dynar.h"
 
 #include "messages.h"
 #include "common.h"
@@ -39,4 +39,4 @@ void peer_print_stats(peer_t p, float elapsed_time);
 
 int peer(int argc, char *argv[]);
 
-#endif /* KADEPLOY_PEER_H */
+#endif /* PEER_H */
index ef8324c..800a648 100644 (file)
@@ -4,10 +4,7 @@
 /* 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 <stdio.h>
 #include "simgrid/msg.h"
-#include "xbt/log.h"
-#include "xbt/asserts.h"
 #include "simgrid/modelchecker.h"
 #include <xbt/RngStream.h>
 #include "src/mc/mc_replay.h" // FIXME: this is an internal header
 /** @addtogroup MSG_examples
  *
  *  - <b>chord/chord.c: Classical Chord P2P protocol</b>
- *    This example implements the well known Chord P2P protocol. Its
- *    main advantage is that it constitute a fully working non-trivial
- *    example. In addition, its implementation is rather efficient, as
- *    demonstrated in http://hal.inria.fr/inria-00602216/
+ *    This example implements the well known Chord P2P protocol. Its main advantage is that it constitute a fully
+ *    working non-trivial example. In addition, its implementation is rather efficient, as demonstrated in
+ *    http://hal.inria.fr/inria-00602216/
  */
 
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_chord,
-                             "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_chord, "Messages specific for this msg example");
 
 #define COMM_SIZE 10
 #define COMP_SIZE 0
@@ -42,17 +37,13 @@ static const double sleep_delay = 4.9999;
 
 extern long int smx_total_comms;
 
-/*
- * Finger element.
- */
+/* Finger element. */
 typedef struct s_finger {
   int id;
   char mailbox[MAILBOX_NAME_SIZE]; // string representation of the id
 } s_finger_t, *finger_t;
 
-/*
- * Node data.
- */
+/* Node data. */
 typedef struct s_node {
   int id;                                 // my id
   char mailbox[MAILBOX_NAME_SIZE];        // my mailbox name (string representation of the id)
@@ -65,9 +56,7 @@ typedef struct s_node {
   RngStream stream;                       //RngStream for
 } s_node_t, *node_t;
 
-/**
- * Types of tasks exchanged between nodes.
- */
+/* Types of tasks exchanged between nodes. */
 typedef enum {
   TASK_FIND_SUCCESSOR,
   TASK_FIND_SUCCESSOR_ANSWER,
@@ -80,9 +69,7 @@ typedef enum {
   TASK_PREDECESSOR_ALIVE_ANSWER
 } e_task_type_t;
 
-/*
- * Data attached with the tasks sent and received
- */
+/* Data attached with the tasks sent and received */
 typedef struct s_task_data {
   e_task_type_t type;                     // type of task
   int request_id;                         // id paramater (used by some types of tasks)
@@ -96,7 +83,6 @@ static int *powers2;
 static xbt_dynar_t host_list;
 
 // utility functions
-static void chord_initialize(void);
 static void chord_exit(void);
 static int normalize(int id);
 static int is_in_interval(int id, int start, int end);
@@ -126,9 +112,7 @@ static void check_predecessor(node_t node);
 static void random_lookup(node_t);
 static void quit_notify(node_t node);
 
-/**
- * \brief Global initialization of the Chord simulation.
- */
+/* \brief Global initialization of the Chord simulation. */
 static void chord_initialize(void)
 {
   // compute the powers of 2 once for all
@@ -994,7 +978,8 @@ static void check_predecessor(node_t node)
           node->comm_receive = NULL;
           handle_task(node, task_received);
         }else{
-          XBT_DEBUG("Received the answer to my 'Predecessor Alive' request (task %p) : my predecessor %d is alive", task_received, node->pred_id);
+          XBT_DEBUG("Received the answer to my 'Predecessor Alive' request (task %p) : my predecessor %d is alive",
+                    task_received, node->pred_id);
           stop = 1;
           MSG_comm_destroy(node->comm_receive);
           node->comm_receive = NULL;
@@ -1019,16 +1004,12 @@ static void random_lookup(node_t node)
 
 }
 
-/**
- * \brief Main function.
- */
 int main(int argc, char *argv[])
 {
   MSG_init(&argc, argv);
   xbt_assert(argc > 2, 
        "Usage: %s [-nb_bits=n] [-timeout=t] platform_file deployment_file\n"
-       "\tExample: %s ../msg_platform.xml chord.xml\n", 
-       argv[0], argv[0]);
+       "\tExample: %s ../msg_platform.xml chord.xml\n", argv[0], argv[0]);
 
   char **options = &argv[1];
   while (!strncmp(options[0], "-", 1)) {
index 8e4209e..bd0bfc7 100644 (file)
@@ -4,15 +4,9 @@
 /* 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 <stdio.h>
 #include "simgrid/msg.h"
-#include "xbt/sysdep.h"         /* calloc, printf */
 
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 #define MAXMBOXLEN 64
 
@@ -25,15 +19,9 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
 const double task_comp_size = 10000000;
 const double task_comm_size = 10000000;
 
-
-int master_fun(int argc, char *argv[]);
-int worker_fun(int argc, char *argv[]);
-
-
 static void send_tasks(int nb_workers)
 {
-  int i;
-  for (i = 0; i < nb_workers; i++) {
+  for (int i = 0; i < nb_workers; i++) {
     char *tname = bprintf("Task%02d", i);
     char *mbox  = bprintf("MBOX:WRK%02d", i);
 
@@ -47,7 +35,38 @@ static void send_tasks(int nb_workers)
   }
 }
 
-int master_fun(int argc, char *argv[])
+static int worker_fun(int argc, char *argv[])
+{
+  const char *pr_name = MSG_process_get_name(MSG_process_self());
+  char mbox[MAXMBOXLEN];
+  snprintf(mbox, MAXMBOXLEN, "MBOX:%s", pr_name);
+
+  XBT_INFO("%s is listening on mailbox(%s)", pr_name, mbox);
+
+  for (;;) {
+    msg_task_t task = NULL;
+
+    msg_error_t res = MSG_task_receive(&task, mbox);
+    if (res != MSG_OK) {
+      XBT_CRITICAL("MSG_task_get failed");
+      DIE_IMPOSSIBLE;
+    }
+
+    XBT_INFO("%s received task(%s) from mailbox(%s)", pr_name, MSG_task_get_name(task), mbox);
+
+    if (!strcmp(MSG_task_get_name(task), "finalize")) {
+      MSG_task_destroy(task);
+      break;
+    }
+
+    MSG_task_execute(task);
+    XBT_INFO("%s executed task(%s)", pr_name, MSG_task_get_name(task));
+    MSG_task_destroy(task);
+  }
+  return 0;
+}
+
+static int master_fun(int argc, char *argv[])
 {
   msg_vm_t vm;
   unsigned int i;
@@ -57,11 +76,9 @@ int master_fun(int argc, char *argv[])
 
   xbt_dynar_t vms = xbt_dynar_new(sizeof(msg_vm_t), NULL);
 
-
   /* Launch VMs and worker processes. One VM per PM, and one worker process per VM. */
-
   XBT_INFO("# Launch %d VMs", nb_workers);
-  for (i = 0; i< nb_workers; i++) {
+  for (int i = 0; i< nb_workers; i++) {
     char *vm_name = bprintf("VM%02d", i);
     char *pr_name = bprintf("WRK%02d", i);
 
@@ -85,7 +102,6 @@ int master_fun(int argc, char *argv[])
     xbt_free(pr_name);
   }
 
-
   /* Send a bunch of work to every one */
   XBT_INFO("# Send a task to %d worker process", nb_workers);
   send_tasks(nb_workers);
@@ -105,7 +121,6 @@ int master_fun(int argc, char *argv[])
     MSG_vm_resume(vm);
   }
 
-
   XBT_INFO("# Sleep long enough for everyone to be done with previous batch of work");
   MSG_process_sleep(1000 - MSG_get_clock());
 
@@ -138,7 +153,6 @@ int master_fun(int argc, char *argv[])
     MSG_vm_migrate(vm, worker_pm1);
   }
 
-
   XBT_INFO("# Shutdown the half of worker processes gracefuly. The remaining half will be forcibly killed.");
   for (i = 0; i < nb_workers; i++) {
     char mbox[MAXMBOXLEN];
@@ -150,7 +164,6 @@ int master_fun(int argc, char *argv[])
   XBT_INFO("# Wait a while before effective shutdown.");
   MSG_process_sleep(2);
 
-
   XBT_INFO("# Shutdown and destroy all the VMs. The remaining worker processes will be forcibly killed.");
   xbt_dynar_foreach(vms, i, vm) {
     XBT_INFO("shutdown %s", MSG_host_get_name(vm));
@@ -161,56 +174,16 @@ int master_fun(int argc, char *argv[])
 
   XBT_INFO("# Goodbye now!");
   xbt_dynar_free(&vms);
-
   return 0;
 }
 
 /** Receiver function  */
-int worker_fun(int argc, char *argv[])
-{
-  const char *pr_name = MSG_process_get_name(MSG_process_self());
-  char mbox[MAXMBOXLEN];
-  snprintf(mbox, MAXMBOXLEN, "MBOX:%s", pr_name);
-
-  XBT_INFO("%s is listenning on mailbox(%s)", pr_name, mbox);
-
-  for (;;) {
-    msg_task_t task = NULL;
-
-    msg_error_t res = MSG_task_receive(&task, mbox);
-    if (res != MSG_OK) {
-      XBT_CRITICAL("MSG_task_get failed");
-      DIE_IMPOSSIBLE;
-    }
-
-    XBT_INFO("%s received task(%s) from mailbox(%s)",
-        pr_name, MSG_task_get_name(task), mbox);
-
-    if (!strcmp(MSG_task_get_name(task), "finalize")) {
-      MSG_task_destroy(task);
-      break;
-    }
-
-    MSG_task_execute(task);
-    XBT_INFO("%s executed task(%s)", pr_name, MSG_task_get_name(task));
-    MSG_task_destroy(task);
-  }
-
-  return 0;
-}
-
-
-
-
 int main(int argc, char *argv[])
 {
   const int nb_workers = 2;
 
   MSG_init(&argc, argv);
-  if (argc != 2) {
-    printf("Usage: %s example/msg/msg_platform.xml\n", argv[0]);
-    return 1;
-  }
+  xbt_assert(argc >1,"Usage: %s example/msg/msg_platform.xml\n", argv[0]);
 
   /* Load the platform file */
   MSG_create_environment(argv[1]);
@@ -219,22 +192,17 @@ int main(int argc, char *argv[])
   xbt_dynar_t pms = MSG_hosts_as_dynar();
 
   /* we need a master node and worker nodes */
-  if (xbt_dynar_length(pms) < nb_workers + 1) {
-    XBT_CRITICAL("need %d hosts", nb_workers + 1);
-    return 1;
-  }
+  xbt_assert(xbt_dynar_length(pms) > nb_workers,"need %d hosts", nb_workers + 1);
 
   /* the first pm is the master, the others are workers */
   msg_host_t master_pm = xbt_dynar_get_as(pms, 0, msg_host_t);
 
   xbt_dynar_t worker_pms = xbt_dynar_new(sizeof(msg_host_t), NULL);
-  int i;
-  for (i = 1; i < nb_workers + 1; i++) {
+  for (int i = 1; i < nb_workers + 1; i++) {
     msg_host_t pm = xbt_dynar_get_as(pms, i, msg_host_t);
     xbt_dynar_push(worker_pms, &pm);
   }
 
-
   /* Start the master process on the master pm. */
   MSG_process_create("master", master_fun, worker_pms, master_pm);
 
index 3d01d42..66ee458 100644 (file)
@@ -7,11 +7,11 @@ $ $SG_TEST_EXENV ${bindir:=.}/master_worker_vm$EXEEXT --log=no_loc ${srcdir:=.}/
 > [Jacquelin:master:(1) 0.000000] [msg_test/INFO] create VM00 on PM(Intel)
 > [0.000000] [surf_vm/INFO] Create VM(VM00)@PM(Intel) with 0 mounted disks
 > [Jacquelin:master:(1) 0.000000] [msg_test/INFO] put a process (WRK00) on VM00
-> [VM00:WRK00:(2) 0.000000] [msg_test/INFO] WRK00 is listenning on mailbox(MBOX:WRK00)
+> [VM00:WRK00:(2) 0.000000] [msg_test/INFO] WRK00 is listening on mailbox(MBOX:WRK00)
 > [Jacquelin:master:(1) 0.000000] [msg_test/INFO] create VM01 on PM(Provost)
 > [0.000000] [surf_vm/INFO] Create VM(VM01)@PM(Provost) with 0 mounted disks
 > [Jacquelin:master:(1) 0.000000] [msg_test/INFO] put a process (WRK01) on VM01
-> [VM01:WRK01:(3) 0.000000] [msg_test/INFO] WRK01 is listenning on mailbox(MBOX:WRK01)
+> [VM01:WRK01:(3) 0.000000] [msg_test/INFO] WRK01 is listening on mailbox(MBOX:WRK01)
 > [Jacquelin:master:(1) 0.000000] [msg_test/INFO] # Send a task to 2 worker process
 > [Jacquelin:master:(1) 0.000000] [msg_test/INFO] Send task(Task00) to mailbox(MBOX:WRK00)
 > [VM00:WRK00:(2) 23.846402] [msg_test/INFO] WRK00 received task(Task00) from mailbox(MBOX:WRK00)
@@ -27,9 +27,9 @@ $ $SG_TEST_EXENV ${bindir:=.}/master_worker_vm$EXEEXT --log=no_loc ${srcdir:=.}/
 > [VM01:WRK01:(3) 50.726576] [msg_test/INFO] WRK01 executed task(Task01)
 > [Jacquelin:master:(1) 1000.000000] [msg_test/INFO] # Add one more process on each VM
 > [Jacquelin:master:(1) 1000.000000] [msg_test/INFO] put a process (WRK02) on VM00
-> [VM00:WRK02:(4) 1000.000000] [msg_test/INFO] WRK02 is listenning on mailbox(MBOX:WRK02)
+> [VM00:WRK02:(4) 1000.000000] [msg_test/INFO] WRK02 is listening on mailbox(MBOX:WRK02)
 > [Jacquelin:master:(1) 1000.000000] [msg_test/INFO] put a process (WRK03) on VM01
-> [VM01:WRK03:(5) 1000.000000] [msg_test/INFO] WRK03 is listenning on mailbox(MBOX:WRK03)
+> [VM01:WRK03:(5) 1000.000000] [msg_test/INFO] WRK03 is listening on mailbox(MBOX:WRK03)
 > [Jacquelin:master:(1) 1000.000000] [msg_test/INFO] # Send a task to 4 worker process
 > [Jacquelin:master:(1) 1000.000000] [msg_test/INFO] Send task(Task00) to mailbox(MBOX:WRK00)
 > [VM00:WRK00:(2) 1023.846402] [msg_test/INFO] WRK00 received task(Task00) from mailbox(MBOX:WRK00)
index 3eaed07..1c92fb5 100644 (file)
@@ -4,16 +4,9 @@
 /* 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 <stdio.h>
 #include "simgrid/msg.h"
-#include "xbt/sysdep.h"         /* calloc, printf */
-
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
 
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 static void vm_migrate(msg_vm_t vm, msg_host_t dst_pm)
 {
@@ -67,8 +60,6 @@ static int master_main(int argc, char *argv[])
   s_vm_params_t params;
   memset(&params, 0, sizeof(params));
 
-
-
   vm0 = MSG_vm_create_core(pm0, "VM0");
   params.ramsize = 1L * 1000 * 1000 * 1000; // 1Gbytes
   MSG_host_set_params(vm0, &params);
@@ -79,8 +70,6 @@ static int master_main(int argc, char *argv[])
 
   MSG_vm_destroy(vm0);
 
-
-
   vm0 = MSG_vm_create_core(pm0, "VM0");
   params.ramsize = 1L * 1000 * 1000 * 100; // 100Mbytes
   MSG_host_set_params(vm0, &params);
@@ -91,8 +80,6 @@ static int master_main(int argc, char *argv[])
 
   MSG_vm_destroy(vm0);
 
-
-
   vm0 = MSG_vm_create_core(pm0, "VM0");
   vm1 = MSG_vm_create_core(pm0, "VM1");
 
@@ -110,8 +97,6 @@ static int master_main(int argc, char *argv[])
   MSG_vm_destroy(vm0);
   MSG_vm_destroy(vm1);
 
-
-
   vm0 = MSG_vm_create_core(pm0, "VM0");
   vm1 = MSG_vm_create_core(pm0, "VM1");
 
@@ -129,7 +114,6 @@ static int master_main(int argc, char *argv[])
   MSG_vm_destroy(vm0);
   MSG_vm_destroy(vm1);
 
-
   return 0;
 }
 
@@ -143,7 +127,6 @@ static void launch_master(msg_host_t host)
   MSG_process_create_with_arguments(pr_name, master_main, NULL, host, 1, argv);
 }
 
-
 int main(int argc, char *argv[])
 {
   /* Get the arguments */
@@ -159,6 +142,5 @@ int main(int argc, char *argv[])
   int res = MSG_main();
   XBT_INFO("Bye (simulation time %g)", MSG_get_clock());
 
-
   return !(res == MSG_OK);
 }
index c6bd09f..32229cf 100644 (file)
@@ -4,19 +4,9 @@
 /* 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 <stdio.h>
 #include "simgrid/msg.h"
-#include "xbt/sysdep.h"         /* calloc, printf */
-
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
-
-
-
-
 static int worker_main(int argc, char *argv[])
 {
   msg_task_t task = MSG_process_get_data(MSG_process_self());
@@ -27,21 +17,18 @@ static int worker_main(int argc, char *argv[])
   return 0;
 }
 
-
 struct task_data {
   msg_task_t task;
   double prev_computation_amount;
   double prev_clock;
 };
 
-
 static void task_data_init_clock(struct task_data *t)
 {
   t->prev_computation_amount = MSG_task_get_flops_amount(t->task);
   t->prev_clock = MSG_get_clock();
 }
 
-
 static void task_data_get_clock(struct task_data *t)
 {
   double now_computation_amount = MSG_task_get_flops_amount(t->task);
@@ -56,7 +43,6 @@ static void task_data_get_clock(struct task_data *t)
   t->prev_clock = now_clock;
 }
 
-
 static void test_pm_pin(void)
 {
   xbt_dynar_t hosts_dynar = MSG_hosts_as_dynar();
@@ -64,7 +50,6 @@ static void test_pm_pin(void)
   msg_host_t pm1 = xbt_dynar_get_as(hosts_dynar, 1, msg_host_t);
   msg_host_t pm2 = xbt_dynar_get_as(hosts_dynar, 2, msg_host_t);
 
-
   struct task_data t1;
   struct task_data t2;
   struct task_data t3;
@@ -80,7 +65,6 @@ static void test_pm_pin(void)
   MSG_process_create("worker3", worker_main, t3.task, pm1);
   MSG_process_create("worker4", worker_main, t4.task, pm1);
 
-
   XBT_INFO("## 1. start 4 tasks on PM1 (2 cores)");
   task_data_init_clock(&t1);
   task_data_init_clock(&t2);
@@ -93,7 +77,6 @@ static void test_pm_pin(void)
   task_data_get_clock(&t3);
   task_data_get_clock(&t4);
 
-
   XBT_INFO("## 2. pin all tasks to CPU0");
   MSG_task_set_affinity(t1.task, pm1, 0x01);
   MSG_task_set_affinity(t2.task, pm1, 0x01);
@@ -106,7 +89,6 @@ static void test_pm_pin(void)
   task_data_get_clock(&t3);
   task_data_get_clock(&t4);
 
-
   XBT_INFO("## 3. clear the affinity of task4");
   MSG_task_set_affinity(t4.task, pm1, 0);
 
@@ -116,7 +98,6 @@ static void test_pm_pin(void)
   task_data_get_clock(&t3);
   task_data_get_clock(&t4);
 
-
   XBT_INFO("## 4. clear the affinity of task3");
   MSG_task_set_affinity(t3.task, pm1, 0);
 
@@ -126,7 +107,6 @@ static void test_pm_pin(void)
   task_data_get_clock(&t3);
   task_data_get_clock(&t4);
 
-
   XBT_INFO("## 5. clear the affinity of task2");
   MSG_task_set_affinity(t2.task, pm1, 0);
 
@@ -136,7 +116,6 @@ static void test_pm_pin(void)
   task_data_get_clock(&t3);
   task_data_get_clock(&t4);
 
-
   XBT_INFO("## 6. pin all tasks to CPU0 of another PM (no effect now)");
   MSG_task_set_affinity(t1.task, pm0, 0);
   MSG_task_set_affinity(t2.task, pm0, 0);
@@ -149,8 +128,6 @@ static void test_pm_pin(void)
   task_data_get_clock(&t3);
   task_data_get_clock(&t4);
 
-
-
   MSG_task_cancel(t1.task);
   MSG_task_cancel(t2.task);
   MSG_task_cancel(t3.task);
@@ -162,7 +139,6 @@ static void test_pm_pin(void)
   MSG_task_destroy(t4.task);
 }
 
-
 static void test_vm_pin(void)
 {
   xbt_dynar_t hosts_dynar = MSG_hosts_as_dynar();
@@ -170,7 +146,6 @@ static void test_vm_pin(void)
   msg_host_t pm1 = xbt_dynar_get_as(hosts_dynar, 1, msg_host_t); // 2 cores
   msg_host_t pm2 = xbt_dynar_get_as(hosts_dynar, 2, msg_host_t); // 4 cores
 
-
   /* set up VMs on PM2 (4 cores) */
   msg_vm_t vm0 = MSG_vm_create_core(pm2, "VM0");
   msg_vm_t vm1 = MSG_vm_create_core(pm2, "VM1");
@@ -193,7 +168,6 @@ static void test_vm_pin(void)
   MSG_vm_start(vm2);
   MSG_vm_start(vm3);
 
-
   /* set up tasks and processes */
   struct task_data t0;
   struct task_data t1;
@@ -210,7 +184,6 @@ static void test_vm_pin(void)
   MSG_process_create("worker2", worker_main, t2.task, vm2);
   MSG_process_create("worker3", worker_main, t3.task, vm3);
 
-
   /* start experiments */
   XBT_INFO("## 1. start 4 VMs on PM2 (4 cores)");
   task_data_init_clock(&t0);
@@ -224,7 +197,6 @@ static void test_vm_pin(void)
   task_data_get_clock(&t2);
   task_data_get_clock(&t3);
 
-
   XBT_INFO("## 2. pin all VMs to CPU0 of PM2");
   MSG_vm_set_affinity(vm0, pm2, 0x01);
   MSG_vm_set_affinity(vm1, pm2, 0x01);
@@ -237,7 +209,6 @@ static void test_vm_pin(void)
   task_data_get_clock(&t2);
   task_data_get_clock(&t3);
 
-
   XBT_INFO("## 3. pin all VMs to CPU0 of PM1 (no effect at now)");
   /* Because VMs are on PM2, the below operations do not effect computation now. */
   MSG_vm_set_affinity(vm0, pm1, 0x01);
@@ -251,7 +222,6 @@ static void test_vm_pin(void)
   task_data_get_clock(&t2);
   task_data_get_clock(&t3);
 
-
   XBT_INFO("## 4. unpin VM0, and pin VM2 and VM3 to CPU1 of PM2");
   MSG_vm_set_affinity(vm0, pm2, 0x00);
   MSG_vm_set_affinity(vm2, pm2, 0x02);
@@ -263,7 +233,6 @@ static void test_vm_pin(void)
   task_data_get_clock(&t2);
   task_data_get_clock(&t3);
 
-
   XBT_INFO("## 5. migrate all VMs to PM0 (only 1 CPU core)");
   MSG_vm_migrate(vm0, pm0);
   MSG_vm_migrate(vm1, pm0);
@@ -282,7 +251,6 @@ static void test_vm_pin(void)
   task_data_get_clock(&t2);
   task_data_get_clock(&t3);
 
-
   XBT_INFO("## 6. migrate all VMs to PM1 (2 CPU cores, with affinity settings)");
   MSG_vm_migrate(vm0, pm1);
   MSG_vm_migrate(vm1, pm1);
@@ -320,7 +288,6 @@ static void test_vm_pin(void)
   task_data_get_clock(&t2);
   task_data_get_clock(&t3);
 
-
   /* clean up everything */
   MSG_task_cancel(t0.task);
   MSG_task_cancel(t1.task);
@@ -338,7 +305,6 @@ static void test_vm_pin(void)
   MSG_vm_destroy(vm3);
 }
 
-
 static int master_main(int argc, char *argv[])
 {
   XBT_INFO("=== Test PM (set affinity) ===");
@@ -350,7 +316,6 @@ static int master_main(int argc, char *argv[])
   return 0;
 }
 
-
 int main(int argc, char *argv[])
 {
   /* Get the arguments */
@@ -369,21 +334,17 @@ int main(int argc, char *argv[])
   msg_host_t pm1 = xbt_dynar_get_as(hosts_dynar, 1, msg_host_t);
   msg_host_t pm2 = xbt_dynar_get_as(hosts_dynar, 2, msg_host_t);
 
-
-  XBT_INFO("%s: %d core(s), %f flops/s per each", MSG_host_get_name(pm0), MSG_host_get_core_number(pm0), MSG_get_host_speed(pm0));
-  XBT_INFO("%s: %d core(s), %f flops/s per each", MSG_host_get_name(pm1), MSG_host_get_core_number(pm1), MSG_get_host_speed(pm1));
-  XBT_INFO("%s: %d core(s), %f flops/s per each", MSG_host_get_name(pm2), MSG_host_get_core_number(pm2), MSG_get_host_speed(pm2));
-
-
+  XBT_INFO("%s: %d core(s), %f flops/s per each", MSG_host_get_name(pm0), MSG_host_get_core_number(pm0),
+           MSG_get_host_speed(pm0));
+  XBT_INFO("%s: %d core(s), %f flops/s per each", MSG_host_get_name(pm1), MSG_host_get_core_number(pm1),
+           MSG_get_host_speed(pm1));
+  XBT_INFO("%s: %d core(s), %f flops/s per each", MSG_host_get_name(pm2), MSG_host_get_core_number(pm2),
+           MSG_get_host_speed(pm2));
 
   MSG_process_create("master", master_main, NULL, pm0);
 
-
-
-
   int res = MSG_main();
   XBT_INFO("Bye (simulation time %g)", MSG_get_clock());
 
-
   return !(res == MSG_OK);
 }
index 1c45b8c..9cc1153 100644 (file)
@@ -4,16 +4,10 @@
 /* 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 <stdio.h>
 #include <sys/time.h>
 #include "simgrid/msg.h"
-#include "xbt/sysdep.h"         /* calloc, printf */
 
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 /*
  * Usage:
@@ -26,12 +20,8 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
 static double time_precise(void) {
   struct timeval tv;
   int ret = gettimeofday(&tv, NULL);
-  if (ret < 0)
-    xbt_die("gettimeofday");
-
-  double now = (double) tv.tv_sec + tv.tv_usec * 0.001 * 0.001;
-
-  return now;
+  xbt_assert(ret >= 0, "gettimeofday");
+  return (double) tv.tv_sec + tv.tv_usec * 0.001 * 0.001;
 }
 
 static int computation_fun(int argc, char *argv[]) {
@@ -46,8 +36,6 @@ static int computation_fun(int argc, char *argv[]) {
 
     // XBT_INFO("%f", clock_end - clock_sta);
   }
-
-
   return 0;
 }
 
@@ -81,7 +69,6 @@ static int master_main(int argc, char *argv[])
     xbt_free(vm_name);
   }
 
-
   XBT_INFO("## Test (start)");
 
   for (i = 0; i < 10; i++) {
@@ -91,13 +78,11 @@ static int master_main(int argc, char *argv[])
     XBT_INFO("duration %f", clock_end - clock_sta);
   }
 
-
   for (i = 0; i < nvm; i++) {
     MSG_vm_destroy(vm[i]);
   }
 
   XBT_INFO("## Test (ended)");
-  
   return 0;
 }
 
@@ -128,6 +113,5 @@ int main(int argc, char *argv[])
   int res = MSG_main();
   XBT_INFO("Bye (simulation time %g)", MSG_get_clock());
 
-
   return !(res == MSG_OK);
 }
index aac646c..4140f38 100644 (file)
@@ -4,16 +4,8 @@
 /* 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 <stdio.h>
 #include "simgrid/msg.h"
-#include "xbt/sysdep.h"         /* calloc, printf */
-
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
-
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 static int computation_fun(int argc, char *argv[])
 {
@@ -81,9 +73,7 @@ static int communication_rx_fun(int argc, char *argv[])
   struct task_priv *priv = MSG_task_get_data(task);
   double clock_end = MSG_get_clock();
 
-  XBT_INFO("%s:%s to %s:%s => %g sec",
-      MSG_host_get_name(priv->tx_host),
-      MSG_process_get_name(priv->tx_proc),
+  XBT_INFO("%s:%s to %s:%s => %g sec", MSG_host_get_name(priv->tx_host), MSG_process_get_name(priv->tx_proc),
       host_name, pr_name, clock_end - priv->clock_sta);
 
   xbt_free(priv);
@@ -94,9 +84,7 @@ static int communication_rx_fun(int argc, char *argv[])
 
 static void launch_communication_worker(msg_host_t tx_host, msg_host_t rx_host)
 {
-  char *mbox = bprintf("MBOX:%s-%s",
-      MSG_host_get_name(tx_host),
-      MSG_host_get_name(rx_host));
+  char *mbox = bprintf("MBOX:%s-%s", MSG_host_get_name(tx_host), MSG_host_get_name(rx_host));
   char **argv = NULL;
   
   const char *pr_name_tx =  "comm_tx";
@@ -146,7 +134,6 @@ static int master_main(int argc, char *argv[])
 
   XBT_INFO("## Test 1 (ended)");
 
-
   XBT_INFO("## Test 2 (started): check impact of running a task inside a VM (there is no degradation for the moment)");
 
   XBT_INFO("### Put a VM on a PM, and put a task to the VM");
@@ -158,7 +145,6 @@ static int master_main(int argc, char *argv[])
 
   XBT_INFO("## Test 2 (ended)");
 
-  
   XBT_INFO("## Test 3 (started): check impact of running a task collocated with a VM (there is no VM noise for the moment)");
 
   XBT_INFO("### Put a VM on a PM, and put a task to the PM");
@@ -170,8 +156,8 @@ static int master_main(int argc, char *argv[])
 
   XBT_INFO("## Test 3 (ended)");
 
-
-  XBT_INFO("## Test 4 (started): compare the cost of running two tasks inside two different VMs collocated or not (for the moment, there is no degradation for the VMs. Hence, the time should be equals to the time of test 1");
+  XBT_INFO("## Test 4 (started): compare the cost of running two tasks inside two different VMs collocated or not (for"
+           " the moment, there is no degradation for the VMs. Hence, the time should be equals to the time of test 1");
 
   XBT_INFO("### Put two VMs on a PM, and put a task to each VM");
   vm0 = MSG_vm_create_core(pm0, "VM0");
@@ -196,7 +182,6 @@ static int master_main(int argc, char *argv[])
   MSG_vm_destroy(vm1);
   XBT_INFO("## Test 4 (ended)");
 
-  
   XBT_INFO("## Test 5  (started): Analyse network impact");
   XBT_INFO("### Make a connection between PM0 and PM1");
   launch_communication_worker(pm0, pm1);
@@ -250,8 +235,8 @@ static int master_main(int argc, char *argv[])
 
   XBT_INFO("## Test 5 (ended)");
 
-
-  XBT_INFO("## Test 6 (started): Check migration impact (not yet implemented neither on the CPU resource nor on the network one");
+  XBT_INFO("## Test 6 (started): Check migration impact (not yet implemented neither on the CPU resource nor on the"
+           " network one");
   XBT_INFO("### Relocate VM0 between PM0 and PM1");
   vm0 = MSG_vm_create_core(pm0, "VM0");
   {
@@ -269,7 +254,7 @@ static int master_main(int argc, char *argv[])
   MSG_process_sleep(5);
   MSG_vm_destroy(vm0);
   XBT_INFO("## Test 6 (ended)");
-  
+
   xbt_dynar_free(&hosts_dynar);
   return 0;
 }
@@ -284,7 +269,6 @@ static void launch_master(msg_host_t host)
   MSG_process_create_with_arguments(pr_name, master_main, NULL, host, 1, argv);
 }
 
-
 int main(int argc, char *argv[])
 {
   /* Get the arguments */
index d2e8263..15c9698 100644 (file)
@@ -4,14 +4,9 @@
 /* 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 <stdio.h>
 #include "simgrid/msg.h"
-#include "xbt/sysdep.h"
 
-#include "xbt/log.h"
-#include "xbt/asserts.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 msg_task_t atask = NULL;
 
@@ -108,6 +103,3 @@ int main(int argc, char *argv[]){
   return !(res == MSG_OK);
 }
 
-
-
-
index 092515d..5e1bd00 100644 (file)
@@ -4,60 +4,42 @@
 /* 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 <stdio.h>
 
 #include "simgrid/msg.h"
-#include "xbt/sysdep.h"         /* calloc */
 #include "simgrid/plugins/energy.h"
 
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
-
-int dvfs(int argc, char *argv[]);
-
-
-int dvfs(int argc, char *argv[])
+static int dvfs(int argc, char *argv[])
 {
-  msg_host_t host = NULL;
-  msg_task_t task1 = NULL;
-  host = MSG_host_by_name("MyHost1");
+  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), sg_host_get_consumed_energy(host));
+  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),
+           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,
+  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));
 
   // Run a task
   start = MSG_get_clock();
-  task1 = MSG_task_create ("t1", 100E6, 0, NULL);
+  msg_task_t task1 = MSG_task_create ("t1", 100E6, 0, NULL);
   XBT_INFO("Run a task of %.0E flops",MSG_task_get_flops_amount(task1));
   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));
+  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));
 
   // ========= 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));
+      pstate, MSG_host_get_power_peak_at(host, pstate), MSG_host_get_current_power_peak(host));
 
   // Run a second task
   start = MSG_get_clock();
@@ -66,15 +48,13 @@ 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_current_power_peak(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_current_power_peak(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.",
@@ -83,8 +63,7 @@ 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_current_power_peak(host), sg_host_get_consumed_energy(host));
   return 0;
 }
 
@@ -95,12 +74,9 @@ int main(int argc, char *argv[])
   MSG_init(&argc, argv);
 
   xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
-            "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
-            argv[0], argv[0]);
-  MSG_create_environment(argv[1]);
+            "\tExample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]);
 
-  /*   Application deployment */
+  MSG_create_environment(argv[1]);
   MSG_function_register("dvfs_test", dvfs);
 
   MSG_launch_application(argv[2]);
@@ -111,4 +87,3 @@ int main(int argc, char *argv[])
 
   return res != MSG_OK;
 }
-
index 4f0b927..78ced0e 100644 (file)
@@ -4,21 +4,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 <stdio.h>
 
 #include "simgrid/msg.h"
-#include "xbt/sysdep.h"         /* calloc */
 #include "simgrid/plugins/energy.h"
 
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-           "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 static void simulate_bootup(msg_host_t host) {
-
   int previous_pstate = MSG_host_get_pstate(host);
 
   XBT_INFO("Switch to virtual pstate 3, that encodes the shutting down state in the XML file of that example");
@@ -42,7 +34,6 @@ static void simulate_bootup(msg_host_t host) {
 }
 
 static void simulate_shutdown(msg_host_t host) {
-
   int previous_pstate = MSG_host_get_pstate(host);
 
   XBT_INFO("Switch to virtual pstate 4, that encodes the shutting down state in the XML file of that example");
@@ -67,8 +58,7 @@ static void simulate_shutdown(msg_host_t host) {
 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("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));
 
@@ -90,7 +80,6 @@ static int onoff(int argc, char *argv[]) {
   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));
 
-
   return 0;
 }
 
@@ -101,14 +90,11 @@ int main(int argc, char *argv[])
   MSG_init(&argc, argv);
 
   xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
-       "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
-       argv[0], argv[0]);
+       "\tExample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]);
 
   MSG_create_environment(argv[1]);
 
-  /*   Application deployment */
   MSG_function_register("onoff_test", onoff);
-
   MSG_launch_application(argv[2]);
 
   res = MSG_main();
@@ -117,4 +103,3 @@ int main(int argc, char *argv[])
 
   return res != MSG_OK;
 }
-
index cd37f4d..817e1ea 100644 (file)
@@ -5,38 +5,21 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "simgrid/msg.h"
-#include "xbt/sysdep.h"         /* calloc */
-
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
-
 
 /** @addtogroup MSG_examples
  *
- * - <b>energy/e1/e1.c</b> Shows how a set of pstates can be defined
- *     for a host and how the current pstate can be accessed/changed
- *     with @ref MSG_get_host_current_power_peak and @ref
- *     MSG_set_host_pstate.
- *     Make sure to read the platform XML file for details on how
- *     to declare the CPU capacity for each pstate.
- *
+ * - <b>energy/e1/e1.c</b> Shows how a set of pstates can be defined for a host and how the current pstate can be
+ *     accessed/changed with @ref MSG_get_host_current_power_peak and @ref  MSG_set_host_pstate.
+ *     Make sure to read the platform XML file for details on how to declare the CPU capacity for each pstate.
  */
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(test,
-                             "Pstate properties test");
-
-int dvfs(int argc, char *argv[]);
-
+XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Pstate properties test");
 
-int dvfs(int argc, char *argv[])
+static int dvfs(int argc, char *argv[])
 {
-  msg_host_t host = NULL;
-  msg_task_t task1 = NULL;
-  double task_time = 0;
   double workload = 100E6;
   int new_peak_index=2;
-  host = MSG_host_self();; //MSG_get_host_by_name("MyHost1");
+  msg_host_t host = MSG_host_self();; //MSG_get_host_by_name("MyHost1");
 
   int nb = MSG_host_get_nb_pstates(host);
   XBT_INFO("Count of Processor states=%d", nb);
@@ -45,19 +28,18 @@ int dvfs(int argc, char *argv[])
   XBT_INFO("Current power peak=%f", current_peak);
 
   // Run a task
-  task1 = MSG_task_create ("t1", workload, 0, NULL);
+  msg_task_t task1 = MSG_task_create ("t1", workload, 0, NULL);
   MSG_task_execute (task1);
   MSG_task_destroy(task1);
 
-  task_time = MSG_get_clock();
+  double task_time = MSG_get_clock();
   XBT_INFO("Task1 simulation time: %e", task_time);
 
   // Change power peak
-  if ((new_peak_index >= nb) || (new_peak_index < 0))
-    {
+  if ((new_peak_index >= nb) || (new_peak_index < 0)){
     XBT_INFO("Cannot set pstate %d, host supports only %d pstates", new_peak_index, nb);
     return 0;
-    }
+  }
 
   double peak_at = MSG_host_get_power_peak_at(host, new_peak_index);
   XBT_INFO("Changing power peak value to %f (at index %d)", peak_at, new_peak_index);
@@ -75,7 +57,6 @@ int dvfs(int argc, char *argv[])
   task_time = MSG_get_clock() - task_time;
   XBT_INFO("Task2 simulation time: %e", task_time);
 
-
   // Verify the default pstate is set to 0
   host = MSG_host_by_name("MyHost2");
   int nb2 = MSG_host_get_nb_pstates(host);
@@ -93,14 +74,11 @@ int main(int argc, char *argv[])
   MSG_init(&argc, argv);
 
   xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
-            "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
-            argv[0], argv[0]);
-  
+            "\tExample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]);
+
   MSG_create_environment(argv[1]);
 
-  /*   Application deployment */
   MSG_function_register("dvfs_test", dvfs);
-
   MSG_launch_application(argv[2]);
 
   res = MSG_main();
@@ -109,4 +87,3 @@ int main(int argc, char *argv[])
 
   return res != MSG_OK;
 }
-
index 982bc54..3959b1f 100644 (file)
@@ -5,10 +5,6 @@ set(tesh_files
   ${tesh_files}
   ${CMAKE_CURRENT_SOURCE_DIR}/energy_vm.tesh
   PARENT_SCOPE)
-set(xml_files
-  ${xml_files}
-  ${CMAKE_CURRENT_SOURCE_DIR}/deployment_consumption.xml
-  PARENT_SCOPE)
 set(examples_src
   ${examples_src}
   ${CMAKE_CURRENT_SOURCE_DIR}/energy_vm.c
diff --git a/examples/msg/energy/vm/deployment_consumption.xml b/examples/msg/energy/vm/deployment_consumption.xml
deleted file mode 100644 (file)
index 52ebe54..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
-<platform version="4">
-  <process host="MyHost1" function="dvfs_test" />
-</platform>
index 14a41d6..96175d3 100644 (file)
@@ -4,19 +4,12 @@
 /* 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 <stdio.h>
 
 #include "simgrid/msg.h"
-#include "xbt/sysdep.h"         /* calloc */
 #include "simgrid/plugins/energy.h"
 
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
-
 XBT_LOG_NEW_DEFAULT_CATEGORY(energy_vm, "Messages of this example");
 
-
 static int worker_func() {
   msg_task_t task1 = MSG_task_create("t1", 300E6, 0, NULL);
   MSG_task_execute (task1);
@@ -50,7 +43,8 @@ static int dvfs(int argc, char *argv[])
   MSG_process_create("p31", worker_func, NULL, vm_host3);
   MSG_process_create("p32", worker_func, NULL, vm_host3);
 
-  XBT_INFO("Wait 5 seconds. The tasks are still running (they run for 3 seconds, but 2 tasks are co-located, so they run for 6 seconds)");
+  XBT_INFO("Wait 5 seconds. The tasks are still running (they run for 3 seconds, but 2 tasks are co-located, "
+           "so they run for 6 seconds)");
   MSG_process_sleep(5);
   XBT_INFO("Wait another 5 seconds. The tasks stop at some point in between");
   MSG_process_sleep(5);
@@ -67,13 +61,10 @@ int main(int argc, char *argv[])
   sg_energy_plugin_init();
   MSG_init(&argc, argv);
 
-  xbt_assert(argc > 1, "Usage: %s platform_file\n"
-       "\tExample: %s msg_platform.xml\n", 
-       argv[0], argv[0]);
+  xbt_assert(argc > 1, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
 
   MSG_create_environment(argv[1]);
 
-  /*   Application deployment */
   MSG_process_create("dvfs",dvfs,NULL,MSG_host_by_name("MyHost1"));
 
   res = MSG_main();
index 3a11d2e..77e3406 100644 (file)
@@ -4,11 +4,9 @@
 /* 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/log.h"
 #include "simgrid/msg.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test_exception,
-                             "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test_exception, "Messages specific for this msg example");
 
 /** @addtogroup MSG_examples
  * 
@@ -17,7 +15,6 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test_exception,
 
 /** Victim. This process gets a lot of remote exceptions  */
 static int victim(int argc, char *argv[]) {
-
   xbt_ex_t e;
   msg_error_t res = MSG_OK;
   
@@ -36,7 +33,6 @@ static int victim(int argc, char *argv[]) {
     xbt_ex_free(e);
   }
 
-
   XBT_INFO("Let's get suspended.");
   int gotit = 0;
   TRY {
@@ -51,7 +47,7 @@ static int victim(int argc, char *argv[]) {
   if(!gotit) {
     xbt_die("I was expecting an exception during my suspension!");
   }
-  
+
   XBT_INFO("Let's sleep for 10 seconds.");
   TRY {
     res = MSG_process_sleep(10);
@@ -71,7 +67,6 @@ static int victim(int argc, char *argv[]) {
   MSG_process_sleep(10);
 
   XBT_INFO("That's enough now. I quit.");
-  
   return 0;
 }
 
@@ -89,7 +84,6 @@ static int terrorist(int argc, char *argv[])
   XBT_INFO("Send a first exception (host failure)");
   SIMIX_process_throw(victim_process, host_error, 0, "First Trick: Let's pretend that the host failed");
 
-
   XBT_INFO("Sweet, let's prepare a second trick!");
   XBT_INFO("Going to sleep for 2 seconds");
 
@@ -115,14 +109,12 @@ int main(int argc, char *argv[]) {
 
   MSG_init(&argc, argv);
   xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
-           "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
-           argv[0], argv[0]);
+             "\tExample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]);
 
   MSG_function_register("terrorist", terrorist);
   MSG_create_environment(argv[1]);
   MSG_launch_application(argv[2]);
 
-
   // Launch the simulation
   res = MSG_main();
 
index 771352d..07f85b9 100644 (file)
@@ -9,17 +9,10 @@
  * - <b>gpu/test_MSG_gpu_task_create.c</b> Example of use of the very experimental (for now) GPU resource. 
  */
 
-#include <stdio.h>
-#include <stdlib.h>
 #include "simgrid/msg.h"
-#include "xbt/log.h"
-#include "xbt/asserts.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for GPU msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for GPU msg example");
 
-
-/** Main function */
 int main(int argc, char *argv[])
 {
   msg_error_t res = MSG_OK;
index a2bed8d..83758ac 100644 (file)
@@ -4,25 +4,15 @@
 /* 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 <stdio.h>
-#include <stdlib.h>
 #include "simgrid/msg.h"
-#include "xbt/log.h"
-#include "xbt/asserts.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 /** @addtogroup MSG_examples
  * 
  * - <b>gtnets</b> Simple ping-pong using GTNeTs instead of the SimGrid network models.
  */
 
-int master(int argc, char *argv[]);
-int slave(int argc, char *argv[]);
-msg_error_t test_all(const char *platform_file,
-                     const char *application_file);
-
 int timer_start = 1;
 
 //keep a pointer to all surf running tasks.
@@ -36,8 +26,7 @@ const char *masternames[NTASKS];
 int gl_task_array_id = 0;
 int count_finished = 0;
 
-/** master */
-int master(int argc, char *argv[])
+static int master(int argc, char *argv[])
 {
   char *slavename = NULL;
   double task_comm_size = 0;
@@ -46,8 +35,7 @@ int master(int argc, char *argv[])
   //unique id to control statistics
   int id = -1;
 
-  xbt_assert(argc == 4, "Strange number of arguments expected 3 got %d",
-             argc - 1);
+  xbt_assert(argc == 4, "Strange number of arguments expected 3 got %d", argc - 1);
 
   /* data size */
   int read;
@@ -80,38 +68,32 @@ int master(int argc, char *argv[])
   MSG_task_send(todo, id_alias);
   end_time = MSG_get_clock();
 
-
   return 0;
-}                               /* end_of_master */
+}
 
-/** Receiver function  */
-int slave(int argc, char *argv[])
+static int slave(int argc, char *argv[])
 {
-
   msg_task_t task = NULL;
-  int a;
-  int id = 0;
 #ifdef HAVE_LATENCY_BOUND_TRACKING
   int limited_latency = 0;
 #endif
   double remaining = 0;
   char id_alias[10];
 
-  xbt_assert(argc == 2, "Strange number of arguments expected 1 got %d",
-             argc - 1);
+  xbt_assert(argc == 2, "Strange number of arguments expected 1 got %d", argc - 1);
 
-  id = atoi(argv[1]);
+  int id = atoi(argv[1]);
   sprintf(id_alias, "%d", id);
   int trace_id = id;
 
-  a = MSG_task_receive(&(task), id_alias);
+  int a = MSG_task_receive(&(task), id_alias);
 
   count_finished--;
   if(count_finished == 0){
       timer_start = 0;
   }
 
- xbt_assert(a == MSG_OK,"Hey?! What's up? Unexpected behavior");
 xbt_assert(a == MSG_OK,"Hey?! What's up? Unexpected behavior");
 
   elapsed_time = MSG_get_clock() - start_time;
 
@@ -127,15 +109,12 @@ int slave(int argc, char *argv[])
           XBT_INFO("WARNING FLOW[%d] is limited by latency!!", id);
         }
 #endif
-        XBT_INFO
-            ("===> Estimated Bw of FLOW[%d] : %f ;  message from %s to %s  with remaining : %f",
-             id, gl_data_size[id] / elapsed_time, masternames[id],
-             slavenames[id], 0.0);
+        XBT_INFO ("===> Estimated Bw of FLOW[%d] : %f ;  message from %s to %s  with remaining : %f",
+             id, gl_data_size[id] / elapsed_time, masternames[id], slavenames[id], 0.0);
         MSG_task_destroy(gl_task_array[id]);
         gl_task_array[id]=NULL;
       } else {
-        remaining =
-            MSG_task_get_remaining_communication(gl_task_array[id]);
+        remaining = MSG_task_get_remaining_communication(gl_task_array[id]);
 #ifdef HAVE_LATENCY_BOUND_TRACKING
         limited_latency = MSG_task_is_latency_bounded(gl_task_array[id]);
 
@@ -143,10 +122,8 @@ int slave(int argc, char *argv[])
           XBT_INFO("WARNING FLOW[%d] is limited by latency!!", id);
         }
 #endif
-        XBT_INFO
-            ("===> Estimated Bw of FLOW[%d] : %f ;  message from %s to %s  with remaining : %f",
-             id, (gl_data_size[id] - remaining) / elapsed_time,
-             masternames[id], slavenames[id], remaining);
+        XBT_INFO ("===> Estimated Bw of FLOW[%d] : %f ;  message from %s to %s  with remaining : %f",
+             id, (gl_data_size[id] - remaining) / elapsed_time, masternames[id], slavenames[id], remaining);
         if(remaining==0) {
           MSG_task_destroy(gl_task_array[id]);
           gl_task_array[id]=NULL;
@@ -162,43 +139,26 @@ int slave(int argc, char *argv[])
   if(bool_printed==2 && gl_task_array[trace_id]) MSG_task_destroy(gl_task_array[trace_id]);
 
   return 0;
-}                               /* end_of_slave */
+}
 
-/** Test function */
-msg_error_t test_all(const char *platform_file,
-                     const char *application_file)
+int main(int argc, char *argv[])
 {
   msg_error_t res = MSG_OK;
+  bool_printed = 0;
 
-  {                             /*  Simulation setting */
-    MSG_create_environment(platform_file);
-  }
+  MSG_init(&argc, argv);
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+             "\tExample: %s platform.xml deployment.xml\n", argv[0], argv[0]);
+
+  MSG_create_environment(argv[1]);
 
   TRACE_declare_mark("endmark");
 
-  {                             /*   Application deployment */
-    MSG_function_register("master", master);
-    MSG_function_register("slave", slave);
+  MSG_function_register("master", master);
+  MSG_function_register("slave", slave);
+  MSG_launch_application(argv[2]);
 
-    MSG_launch_application(application_file);
-  }
   res = MSG_main();
-  return res;
-}                               /* end_of_test_all */
-
-/** Main function */
-int main(int argc, char *argv[])
-{
-  msg_error_t res = MSG_OK;
-  bool_printed = 0;
-
-  MSG_init(&argc, argv);
-  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
-            "\tExample: %s platform.xml deployment.xml\n", 
-            argv[0], argv[0]);
-   
-  res = test_all(argv[1], argv[2]);
 
   return res != MSG_OK;
 }
-   
index 1e322b4..feb2564 100644 (file)
@@ -4,15 +4,9 @@
 /* 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 <stdio.h>
 #include "simgrid/msg.h"            /* Yeah! If you want to use msg, you need to include simgrid/msg.h */
-#include "xbt/sysdep.h"         /* calloc, printf */
 
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 /** @addtogroup MSG_examples
  * 
@@ -25,14 +19,8 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
  * 
  * - <b>msg/icomms/peer.c</b>: basic example of async functions (@ref MSG_task_isend, @ref MSG_task_irecv, @ref MSG_comm_wait)
  */
-int sender(int argc, char *argv[]);
-int receiver(int argc, char *argv[]);
 
-msg_error_t test_all(const char *platform_file,
-                     const char *application_file);
-
-/** Sender function  */
-int sender(int argc, char *argv[])
+static int sender(int argc, char *argv[])
 {
   long number_of_tasks = xbt_str_parse_int(argv[1], "Invalid amount of tasks: %s");
   double task_comp_size = xbt_str_parse_double(argv[2], "Invalid compute size: %s");
@@ -41,8 +29,7 @@ int sender(int argc, char *argv[])
   double sleep_start_time = xbt_str_parse_double(argv[5], "Invalid sleep start time: %s");
   double sleep_test_time = xbt_str_parse_double(argv[6], "Invalid test time: %s");
 
-  XBT_INFO("sleep_start_time : %f , sleep_test_time : %f", sleep_start_time,
-        sleep_test_time);
+  XBT_INFO("sleep_start_time : %f , sleep_test_time : %f", sleep_start_time, sleep_test_time);
 
   msg_comm_t comm = NULL;
   int i;
@@ -55,9 +42,7 @@ int sender(int argc, char *argv[])
     sprintf(mailbox, "receiver-%ld", i % receivers_count);
     sprintf(sprintf_buffer, "Task_%d", i);
 
-    task =
-        MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size,
-                        NULL);
+    task = MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size, NULL);
     comm = MSG_task_isend(task, mailbox);
     XBT_INFO("Send to receiver-%ld Task_%d", i % receivers_count, i);
 
@@ -69,7 +54,6 @@ int sender(int argc, char *argv[])
       };
     }
     MSG_comm_destroy(comm);
-
   }
 
   for (i = 0; i < receivers_count; i++) {
@@ -86,15 +70,13 @@ int sender(int argc, char *argv[])
       };
     }
     MSG_comm_destroy(comm);
-
   }
 
   XBT_INFO("Goodbye now!");
   return 0;
-}                               /* end_of_sender */
+}
 
-/** Receiver function  */
-int receiver(int argc, char *argv[])
+static int receiver(int argc, char *argv[])
 {
   msg_task_t task = NULL;
   XBT_ATTRIB_UNUSED msg_error_t res;
@@ -103,13 +85,11 @@ int receiver(int argc, char *argv[])
   msg_comm_t res_irecv;
   double sleep_start_time = xbt_str_parse_double(argv[2], "Invalid sleep start parameter: %s");
   double sleep_test_time = xbt_str_parse_double(argv[3], "Invalid sleep test parameter: %s");
-  XBT_INFO("sleep_start_time : %f , sleep_test_time : %f", sleep_start_time,
-        sleep_test_time);
+  XBT_INFO("sleep_start_time : %f , sleep_test_time : %f", sleep_start_time, sleep_test_time);
 
   XBT_ATTRIB_UNUSED int read;
   read = sscanf(argv[1], "%d", &id);
-  xbt_assert(read,
-              "Invalid argument %s\n", argv[1]);
+  xbt_assert(read, "Invalid argument %s\n", argv[1]);
 
   MSG_process_sleep(sleep_start_time);
 
@@ -142,40 +122,25 @@ int receiver(int argc, char *argv[])
   }
   XBT_INFO("I'm done. See you!");
   return 0;
-}                               /* end_of_receiver */
-
-/** Test function */
-msg_error_t test_all(const char *platform_file,
-                     const char *application_file)
-{
-  msg_error_t res = MSG_OK;
-
-  {                             /*  Simulation setting */
-    MSG_create_environment(platform_file);
-  }
-  {                             /*   Application deployment */
-    MSG_function_register("sender", sender);
-    MSG_function_register("receiver", receiver);
-    MSG_launch_application(application_file);
-  }
-  res = MSG_main();
-
-  XBT_INFO("Simulation time %g", MSG_get_clock());
-  return res;
-}                               /* end_of_test_all */
-
+}
 
-/** Main function */
 int main(int argc, char *argv[])
 {
   msg_error_t res = MSG_OK;
 
   MSG_init(&argc, argv);
   xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
-           "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
-           argv[0], argv[0]);
+             "\tExample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]);
 
-  res = test_all(argv[1], argv[2]);
+  MSG_create_environment(argv[1]);
+
+  MSG_function_register("sender", sender);
+  MSG_function_register("receiver", receiver);
+  MSG_launch_application(argv[2]);
+
+  res = MSG_main();
+
+  XBT_INFO("Simulation time %g", MSG_get_clock());
 
   return res != MSG_OK;
 }
index a2cf462..73823ea 100644 (file)
@@ -4,29 +4,16 @@
 /* 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 <stdio.h>
-#include "simgrid/msg.h"            /* Yeah! If you want to use msg, you need to include simgrid/msg.h */
-#include "xbt/sysdep.h"         /* calloc, printf */
+#include "simgrid/msg.h"
 
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 /** @addtogroup MSG_examples
  * 
  * - <b>msg/icomms/peer2.c</b>: demonstrates the @ref MSG_comm_waitall function
  */
 
-int sender(int argc, char *argv[]);
-int receiver(int argc, char *argv[]);
-
-msg_error_t test_all(const char *platform_file,
-                     const char *application_file);
-
-/** Sender function  */
-int sender(int argc, char *argv[])
+static int sender(int argc, char *argv[])
 {
   long number_of_tasks = xbt_str_parse_int(argv[1], "Invalid amount of tasks: %s");
   double task_comp_size = xbt_str_parse_double(argv[2], "Invalid computational size: %s");
@@ -63,10 +50,9 @@ int sender(int argc, char *argv[])
   XBT_INFO("Goodbye now!");
   xbt_free(comm);
   return 0;
-}                               /* end_of_sender */
+}
 
-/** Receiver function  */
-int receiver(int argc, char *argv[])
+static int receiver(int argc, char *argv[])
 {
   msg_task_t task = NULL;
   XBT_ATTRIB_UNUSED msg_error_t res;
@@ -98,40 +84,24 @@ int receiver(int argc, char *argv[])
   }
   XBT_INFO("I'm done. See you!");
   return 0;
-}                               /* end_of_receiver */
-
-/** Test function */
-msg_error_t test_all(const char *platform_file,
-                     const char *application_file)
-{
-  msg_error_t res = MSG_OK;
-
-  {                             /*  Simulation setting */
-    MSG_create_environment(platform_file);
-  }
-  {                             /*   Application deployment */
-    MSG_function_register("sender", sender);
-    MSG_function_register("receiver", receiver);
-    MSG_launch_application(application_file);
-  }
-  res = MSG_main();
-
-  XBT_INFO("Simulation time %g", MSG_get_clock());
-  return res;
-}                               /* end_of_test_all */
-
+}
 
-/** Main function */
 int main(int argc, char *argv[])
 {
   msg_error_t res = MSG_OK;
 
   MSG_init(&argc, argv);
   xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
-           "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
-           argv[0], argv[0]);
+             "\tExample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]);
 
-  res = test_all(argv[1], argv[2]);
+  MSG_create_environment(argv[1]);
+  MSG_function_register("sender", sender);
+  MSG_function_register("receiver", receiver);
+  MSG_launch_application(argv[2]);
+
+  res = MSG_main();
+
+  XBT_INFO("Simulation time %g", MSG_get_clock());
 
   return res != MSG_OK;
 }
index a0fe6c6..818f891 100644 (file)
@@ -4,29 +4,16 @@
 /* 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 <stdio.h>
-#include "simgrid/msg.h"            /* Yeah! If you want to use msg, you need to include simgrid/msg.h */
-#include "xbt/sysdep.h"         /* calloc, printf */
-#include <math.h>
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
+#include "simgrid/msg.h"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 /** @addtogroup MSG_examples
  * 
  * - <b>msg/icomms/peer3.c</b>: demonstrates the @ref MSG_comm_waitany function
  */
 
-int sender(int argc, char *argv[]);
-int receiver(int argc, char *argv[]);
-
-msg_error_t test_all(const char *platform_file,
-                     const char *application_file);
-
-/** Sender function  */
-int sender(int argc, char *argv[])
+static int sender(int argc, char *argv[])
 {
   long number_of_tasks = xbt_str_parse_int(argv[1], "Invalid amount of tasks: %s");
   double task_comp_size = xbt_str_parse_double(argv[2], "Invalid computational size: %s");
@@ -54,8 +41,7 @@ int sender(int argc, char *argv[])
                         task_comm_size / coef, NULL);
     comm = MSG_task_isend(task, mailbox);
     xbt_dynar_push_as(d, msg_comm_t, comm);
-    XBT_INFO("Send to receiver-%ld %s comm_size %f", i % receivers_count,
-          sprintf_buffer, task_comm_size / coef);
+    XBT_INFO("Send to receiver-%ld %s comm_size %f", i % receivers_count, sprintf_buffer, task_comm_size / coef);
   }
   /* Here we are waiting for the completion of all communications */
 
@@ -81,13 +67,11 @@ int sender(int argc, char *argv[])
 
   XBT_INFO("Goodbye now!");
   return 0;
-}                               /* end_of_sender */
+}
 
-/** Receiver function  */
-int receiver(int argc, char *argv[])
+static int receiver(int argc, char *argv[])
 {
   int id = -1;
-  int i;
   char mailbox[80];
   xbt_dynar_t comms = xbt_dynar_new(sizeof(msg_comm_t), NULL);
   int tasks = xbt_str_parse_int(argv[2], "Invalid amount of tasks: %s");
@@ -99,7 +83,7 @@ int receiver(int argc, char *argv[])
   sprintf(mailbox, "receiver-%d", id);
   MSG_process_sleep(10);
   msg_comm_t res_irecv;
-  for (i = 0; i < tasks; i++) {
+  for (int i = 0; i < tasks; i++) {
     XBT_INFO("Wait to receive task %d", i);
     task[i] = NULL;
     res_irecv = MSG_task_irecv(&task[i], mailbox);
@@ -129,40 +113,25 @@ int receiver(int argc, char *argv[])
   MSG_comm_destroy(res_irecv);
   XBT_INFO("I'm done. See you!");
   return 0;
-}                               /* end_of_receiver */
+}
 
-/** Test function */
-msg_error_t test_all(const char *platform_file,
-                     const char *application_file)
+int main(int argc, char *argv[])
 {
   msg_error_t res = MSG_OK;
 
-  {                             /*  Simulation setting */
-    MSG_create_environment(platform_file);
-  }
-  {                             /*   Application deployment */
-    MSG_function_register("sender", sender);
-    MSG_function_register("receiver", receiver);
-    MSG_launch_application(application_file);
-  }
-  res = MSG_main();
+  MSG_init(&argc, argv);
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+                  "\tExample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]);
 
-  XBT_INFO("Simulation time %g", MSG_get_clock());
-  return res;
-}                               /* end_of_test_all */
+  MSG_create_environment(argv[1]);
 
+  MSG_function_register("sender", sender);
+  MSG_function_register("receiver", receiver);
+  MSG_launch_application(argv[2]);
 
-/** Main function */
-int main(int argc, char *argv[])
-{
-  msg_error_t res = MSG_OK;
+  res = MSG_main();
+
+  XBT_INFO("Simulation time %g", MSG_get_clock());
 
-  MSG_init(&argc, argv);
-  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
-                  "\tExample: %s msg_platform.xml msg_deployment.xml\n",
-                  argv[0], argv[0]);
-   
-  res = test_all(argv[1], argv[2]);
-   
   return res != MSG_OK;
 }
index e42f2b6..c72e615 100644 (file)
 #define FILENAME3 "/home/doc/simgrid/examples/platforms/g5k_cabinets.xml"
 #define FILENAME4 "/home/doc/simgrid/examples/platforms/nancy.xml"
 
-#include <stdio.h>
-#include <stdlib.h>
 #include "simgrid/msg.h"
 
-int host(int argc, char *argv[]);
+XBT_LOG_NEW_DEFAULT_CATEGORY(io_file, "Messages specific for this io example");
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(io_file,
-                             "Messages specific for this io example");
-
-int host(int argc, char *argv[])
+static int host(int argc, char *argv[])
 {
   msg_file_t file = NULL;
   sg_size_t read,write;
@@ -65,32 +60,27 @@ int host(int argc, char *argv[])
 
   /* Write 100KB in file from the current position, i.e, end of file or 10MB */
   write = MSG_file_write(file, 100000);
-  XBT_INFO("\tHave written %llu in '%s'. Size now is: %llu",write,filename,
-           MSG_file_get_size(file));
+  XBT_INFO("\tHave written %llu in '%s'. Size now is: %llu",write,filename, MSG_file_get_size(file));
 
 
   XBT_INFO("\tCapacity of the storage element '%s' is stored on: %llu / %llu",
             filename, MSG_storage_get_used_size(st), MSG_storage_get_size(st));
 
   /* rewind to the beginning of the file */
-  XBT_INFO("\tComing back to the beginning of the stream for file '%s'",
-           filename);
+  XBT_INFO("\tComing back to the beginning of the stream for file '%s'", filename);
   MSG_file_seek(file, 0, SEEK_SET);
 
   /* Try to read 110KB */
   read = MSG_file_read(file, 110000);
-  XBT_INFO("\tHave read %llu from '%s' (of size %llu)",read,filename,
-      MSG_file_get_size(file));
+  XBT_INFO("\tHave read %llu from '%s' (of size %llu)",read,filename, MSG_file_get_size(file));
 
   /* rewind once again to the beginning of the file */
-  XBT_INFO("\tComing back to the beginning of the stream for file '%s'",
-           filename);
+  XBT_INFO("\tComing back to the beginning of the stream for file '%s'", filename);
   MSG_file_seek(file, 0, SEEK_SET);
 
   /* Write 110KB in file from the current position, i.e, end of file or 10MB */
   write = MSG_file_write(file, 110000);
-  XBT_INFO("\tHave written %llu in '%s'. Size now is: %llu", write,filename,
-      MSG_file_get_size(file));
+  XBT_INFO("\tHave written %llu in '%s'. Size now is: %llu", write,filename, MSG_file_get_size(file));
 
   XBT_INFO("\tCapacity of the storage element '%s' is stored on: %llu / %llu",
             filename, MSG_storage_get_used_size(st), MSG_storage_get_size(st));
@@ -98,28 +88,25 @@ int host(int argc, char *argv[])
   XBT_INFO("\tClose file '%s'",filename);
   MSG_file_close(file);
 
-
   return 0;
 }
 
 int main(int argc, char **argv)
 {
-  int i,res;
   MSG_init(&argc, argv);
   MSG_create_environment(argv[1]);
   xbt_dynar_t hosts =  MSG_hosts_as_dynar();
   MSG_function_register("host", host);
   unsigned long nb_hosts = xbt_dynar_length(hosts);
   XBT_INFO("Number of host '%lu'",nb_hosts);
-  for(i = 0 ; i<nb_hosts; i++)
-  {
+  for(int i = 0 ; i<nb_hosts; i++){
     char* name_host = bprintf("%d",i);
     MSG_process_create( name_host, host, NULL, xbt_dynar_get_as(hosts,i,msg_host_t) );
     free(name_host);
   }
   xbt_dynar_free(&hosts);
 
-  res = MSG_main();
+  int res = MSG_main();
   XBT_INFO("Simulation time %g", MSG_get_clock());
   return res != MSG_OK;
 }
index 34f7dc0..0426d20 100644 (file)
 
 #define FILENAME1 "/home/doc/simgrid/examples/platforms/g5k.xml"
 
-#include <stdio.h>
-#include <stdlib.h>
 #include "simgrid/msg.h"
 
-int host(int argc, char *argv[]);
+XBT_LOG_NEW_DEFAULT_CATEGORY(io_file, "Messages specific for this io example");
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(io_file,
-                             "Messages specific for this io example");
-
-int host(int argc, char *argv[])
+static int host(int argc, char *argv[])
 {
-  msg_file_t file = NULL;
-  sg_size_t write;
-
   // First open
   XBT_INFO("\tOpen file '%s'",FILENAME1);
-  file = MSG_file_open(FILENAME1, NULL);
+  msg_file_t file = MSG_file_open(FILENAME1, NULL);
 
   // Unlink the file
   XBT_INFO("\tUnlink file '%s'",MSG_file_get_name(file));
@@ -38,7 +30,7 @@ int host(int argc, char *argv[])
   file = MSG_file_open(FILENAME1, NULL);
 
   // Write into the new file
-  write = MSG_file_write(file,100000);  // Write for 100Ko
+  sg_size_t write = MSG_file_write(file,100000);  // Write for 100Ko
   XBT_INFO("\tHave written %llu on %s",write,MSG_file_get_name(file));
 
   // Write into the new file
@@ -54,7 +46,6 @@ int host(int argc, char *argv[])
 
 int main(int argc, char **argv)
 {
-  int res;
   MSG_init(&argc, argv);
   MSG_create_environment(argv[1]);
   xbt_dynar_t hosts =  MSG_hosts_as_dynar();
@@ -67,7 +58,7 @@ int main(int argc, char **argv)
 
   xbt_dynar_free(&hosts);
 
-  res = MSG_main();
+  int res = MSG_main();
   XBT_INFO("Simulation time %g", MSG_get_clock());
   return res != MSG_OK;
 }
index cc84983..bbb3ca0 100644 (file)
@@ -9,32 +9,21 @@
  * - <b>io/remote.c</b> Example of delegated I/O operations
  */
 
-#include <stdio.h>
-#include <stdlib.h>
 #include "simgrid/msg.h"
 
 #define INMEGA (1024*1024)
 
-int host(int argc, char *argv[]);
+XBT_LOG_NEW_DEFAULT_CATEGORY(remote_io, "Messages specific for this io example");
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(remote_io,
-                             "Messages specific for this io example");
-
-
-int host(int argc, char *argv[]){
-  msg_file_t file = NULL;
-  const char* filename;
-  sg_size_t read, write;
-
-  file = MSG_file_open(argv[1], NULL);
-  filename = MSG_file_get_name(file);
+static int host(int argc, char *argv[]){
+  msg_file_t file = MSG_file_open(argv[1], NULL);
+  const char *filename = MSG_file_get_name(file);
   XBT_INFO("Opened file '%s'",filename);
   MSG_file_dump(file);
 
   XBT_INFO("Try to read %llu from '%s'",MSG_file_get_size(file),filename);
-  read = MSG_file_read(file, MSG_file_get_size(file));
-  XBT_INFO("Have read %llu from '%s'. Offset is now at: %llu",read,filename,
-      MSG_file_tell(file));
+  sg_size_t read = MSG_file_read(file, MSG_file_get_size(file));
+  XBT_INFO("Have read %llu from '%s'. Offset is now at: %llu",read,filename, MSG_file_tell(file));
   XBT_INFO("Seek back to the begining of the stream...");
   MSG_file_seek(file, 0, SEEK_SET);
   XBT_INFO("Offset is now at: %llu", MSG_file_tell(file));
@@ -45,24 +34,20 @@ int host(int argc, char *argv[]){
     file = MSG_file_open(argv[2], NULL);
     filename = MSG_file_get_name(file);
     XBT_INFO("Opened file '%s'",filename);
-    XBT_INFO("Try to write %llu MiB to '%s'",
-        MSG_file_get_size(file)/1024,
-        filename);
-    write = MSG_file_write(file, MSG_file_get_size(file)*1024);
+    XBT_INFO("Try to write %llu MiB to '%s'", MSG_file_get_size(file)/1024, filename);
+    sg_size_t write = MSG_file_write(file, MSG_file_get_size(file)*1024);
     XBT_INFO("Have written %llu bytes to '%s'.",write,filename);
 
     msg_host_t src, dest;
     src= MSG_host_self();
     dest = MSG_host_by_name(argv[3]);
     if (xbt_str_parse_int(argv[5], "Argument 5 (move or copy) must be an int, not '%s'")) {
-      XBT_INFO("Move '%s' (of size %llu) from '%s' to '%s'", filename,
-           MSG_file_get_size(file), MSG_host_get_name(src),
-           argv[3]);
+      XBT_INFO("Move '%s' (of size %llu) from '%s' to '%s'", filename,MSG_file_get_size(file), MSG_host_get_name(src),
+               argv[3]);
       MSG_file_rmove(file, dest, argv[4]);
     } else {
-      XBT_INFO("Copy '%s' (of size %llu) from '%s' to '%s'", filename,
-           MSG_file_get_size(file), MSG_host_get_name(src),
-           argv[3]);
+      XBT_INFO("Copy '%s' (of size %llu) from '%s' to '%s'", filename, MSG_file_get_size(file), MSG_host_get_name(src),
+               argv[3]);
       MSG_file_rcopy(file, dest, argv[4]);
       MSG_file_close(file);
     }
@@ -71,13 +56,9 @@ int host(int argc, char *argv[]){
   return 0;
 }
 
-
-
 int main(int argc, char **argv)
 {
-  int res;
   unsigned int cur;
-  xbt_dynar_t storages;
   msg_storage_t st;
 
   MSG_init(&argc, argv);
@@ -85,19 +66,15 @@ int main(int argc, char **argv)
   MSG_function_register("host", host);
   MSG_launch_application(argv[2]);
 
-  storages = MSG_storages_as_dynar();
+  xbt_dynar_t storages = MSG_storages_as_dynar();
   xbt_dynar_foreach(storages, cur, st){
-    XBT_INFO("Init: %llu MiB used on '%s'",
-        MSG_storage_get_used_size(st)/INMEGA,
-        MSG_storage_get_name(st));
+    XBT_INFO("Init: %llu MiB used on '%s'", MSG_storage_get_used_size(st)/INMEGA, MSG_storage_get_name(st));
   }
 
-  res = MSG_main();
+  int res = MSG_main();
 
   xbt_dynar_foreach(storages, cur, st){
-    XBT_INFO("Init: %llu MiB used on '%s'",
-        MSG_storage_get_used_size(st)/INMEGA,
-        MSG_storage_get_name(st));
+    XBT_INFO("Init: %llu MiB used on '%s'", MSG_storage_get_used_size(st)/INMEGA, MSG_storage_get_name(st));
   }
   xbt_dynar_free_container(&storages);
 
index ddae501..ce10c42 100644 (file)
@@ -24,8 +24,6 @@
 ******************************************************************************/
 
 #include "simgrid/msg.h"
-#include "xbt/log.h"
-#include "xbt/dict.h"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(storage,"Messages specific for this simulation");
 
@@ -59,7 +57,6 @@ static int host(int argc, char *argv[]){
   }
   xbt_dict_free(&storage_list);
 
-
   // Create a 200,000 bytes file named './tmp/data.txt' on /sd1
   char* file_name = xbt_strdup("/home/tmp/data.txt");
   msg_file_t file = NULL;
@@ -75,7 +72,6 @@ static int host(int argc, char *argv[]){
   XBT_INFO("Free size: %llu bytes", MSG_storage_get_free_size(storage));
   XBT_INFO("Used size: %llu bytes", MSG_storage_get_used_size(storage));
 
-
   // Now retrieve the size of created file and read it completely
   file_size = MSG_file_get_size(file);
   MSG_file_seek(file, 0, SEEK_SET);
@@ -116,7 +112,6 @@ static int host(int argc, char *argv[]){
   xbt_free(data);
   xbt_free(storage_name);
 
-
   // Dump disks contents
   XBT_INFO("*** Dump content of %s ***",MSG_host_get_name(MSG_host_self()));
   xbt_dict_t contents = NULL;
@@ -137,10 +132,8 @@ static int host(int argc, char *argv[]){
   return 1;
 }
 
-
 int main(int argc, char *argv[])
 {
-
   MSG_init(&argc, argv);
   MSG_create_environment(argv[1]);
   MSG_function_register("host", host);
index f7e2195..6eae1ee 100644 (file)
@@ -9,8 +9,6 @@
 #include "task.h"
 
 #include "simgrid/msg.h"
-#include "xbt/log.h"
-#include "xbt/asserts.h"
 /** @addtogroup MSG_examples
   * <b>kademlia/kademlia.c: Kademlia protocol</b>
   * Implements the Kademlia protocol, using 32 bits identifiers.
index bc0c9e5..08aa37c 100644 (file)
@@ -6,10 +6,8 @@
 
 #include "node.h"
 #include "routing_table.h"
-
 #include "simgrid/msg.h"
-#include "xbt/log.h"
-#include "xbt/asserts.h"
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_kademlia_node, "Messages specific for this msg example");
 
 /** @brief Initialization of a node
index dae7c95..20757af 100644 (file)
@@ -7,8 +7,7 @@
 #include "routing_table.h"
 #include "node.h"
 #include "simgrid/msg.h"
-#include "xbt/log.h"
-#include "xbt/asserts.h"
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_kademlia_routing_table, "Messages specific for this msg example");
 
 /** @brief Initialization of a node routing table.  */
index 611b26d..b859965 100644 (file)
@@ -4,15 +4,9 @@
 /* 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 <stdio.h>
-#include "simgrid/msg.h"        /* Yeah! If you want to use msg, you need to include simgrid/msg.h */
-#include "xbt/sysdep.h"         /* calloc, printf */
+#include "simgrid/msg.h"
 
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 #define task_comp_size 50000000
 #define task_comm_size 1000000
@@ -25,7 +19,6 @@ static long my_random(long n)
   return n * (rand() / ((double)RAND_MAX + 1));
 }
 
-/** Emitter function  */
 static int master(int argc, char *argv[])
 {
   int i;
@@ -38,8 +31,7 @@ static int master(int argc, char *argv[])
     sprintf(mailbox, "slave-%ld", i % number_of_slaves);
     sprintf(sprintf_buffer, "Task_%d", i);
     task = MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size, NULL);
-    XBT_DEBUG("Sending \"%s\" (of %ld) to mailbox \"%s\"", task->name,
-          number_of_jobs, mailbox);
+    XBT_DEBUG("Sending \"%s\" (of %ld) to mailbox \"%s\"", task->name, number_of_jobs, mailbox);
 
     MSG_task_send(task, mailbox);
   }
@@ -55,9 +47,8 @@ static int master(int argc, char *argv[])
 
   XBT_DEBUG("Goodbye now!");
   return 0;
-}                               /* end_of_master */
+}
 
-/** Receiver function  */
 static int slave(int argc, char *argv[])
 {
   msg_task_t task = NULL;
@@ -80,9 +71,8 @@ static int slave(int argc, char *argv[])
     task = NULL;
   }
   return 0;
-}                               /* end_of_slave */                              /* end_of_test_all */
+}
 
-/** Main function */
 int main(int argc, char *argv[])
 {
   msg_error_t res = MSG_OK;
@@ -90,8 +80,7 @@ int main(int argc, char *argv[])
 
   MSG_init(&argc, argv);
   xbt_assert(argc > 3, "Usage: %s platform_file number_of_jobs number_of_slaves\n"
-            "\tExample: %s msg_platform.xml 10 5\n", 
-            argv[0], argv[0]);
+             "\tExample: %s msg_platform.xml 10 5\n", argv[0], argv[0]);
 
   MSG_function_register("master", master);
   MSG_function_register("slave", slave);
@@ -106,17 +95,11 @@ int main(int argc, char *argv[])
 
   msg_host_t *host_table =  xbt_dynar_to_array(host_dynar);
 
-  MSG_process_create( "master", master,
-                      NULL,
-                      host_table[my_random(number_max)]
-                      );
+  MSG_process_create("master", master, NULL, host_table[my_random(number_max)]);
 
   for(i = 0 ; i<number_of_slaves; i++) {
     char* name_host = bprintf("slave-%ld",i);
-      MSG_process_create( name_host, slave,
-                          NULL,
-                          host_table[my_random(number_max)]
-                          );
+      MSG_process_create( name_host, slave, NULL, host_table[my_random(number_max)]);
       free(name_host);
   }
   xbt_free(host_table);
index 2b1b372..070d75a 100644 (file)
@@ -4,25 +4,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 <stdio.h>
-#include "simgrid/msg.h"        /* Yeah! If you want to use msg, you need to include simgrid/msg.h */
-#include "xbt/sysdep.h"         /* calloc, printf */
+#include "simgrid/msg.h"
 
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
-
-int master(int argc, char *argv[]);
-int slave(int argc, char *argv[]);
-msg_error_t test_all(const char *platform_file,
-                     const char *application_file);
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 #define FINALIZE ((void*)221297)        /* a magic number to tell people to stop working */
 
-/** Emitter function  */
-int master(int argc, char *argv[])
+static int master(int argc, char *argv[])
 {
   int slaves_count = 0;
   msg_host_t *slaves = NULL;
@@ -59,31 +47,26 @@ int master(int argc, char *argv[])
   XBT_INFO("Got %d task to process :", number_of_tasks);
 
   for (i = 0; i < number_of_tasks; i++) {
-    msg_task_t task = MSG_task_create("Task", task_comp_size, task_comm_size,
-                                    xbt_new0(double, 1));
-    msg_error_t a;
+    msg_task_t task = MSG_task_create("Task", task_comp_size, task_comm_size, xbt_new0(double, 1));
     *((double *) task->data) = MSG_get_clock();
 
-    a = MSG_task_send_with_timeout(task,MSG_host_get_name(slaves[i % slaves_count]),10.0);
+    msg_error_t a = MSG_task_send_with_timeout(task,MSG_host_get_name(slaves[i % slaves_count]),10.0);
 
     if (a == MSG_OK) {
       XBT_INFO("Send completed");
     } else if (a == MSG_HOST_FAILURE) {
-      XBT_INFO
-          ("Gloups. The cpu on which I'm running just turned off!. See you!");
+      XBT_INFO("Gloups. The cpu on which I'm running just turned off!. See you!");
       free(task->data);
       MSG_task_destroy(task);
       free(slaves);
       return 0;
     } else if (a == MSG_TRANSFER_FAILURE) {
-      XBT_INFO
-          ("Mmh. Something went wrong with '%s'. Nevermind. Let's keep going!",
-              MSG_host_get_name(slaves[i % slaves_count]));
+      XBT_INFO("Mmh. Something went wrong with '%s'. Nevermind. Let's keep going!",
+               MSG_host_get_name(slaves[i % slaves_count]));
       free(task->data);
       MSG_task_destroy(task);
     } else if (a == MSG_TIMEOUT) {
-      XBT_INFO
-          ("Mmh. Got timeouted while speaking to '%s'. Nevermind. Let's keep going!",
+      XBT_INFO ("Mmh. Got timeouted while speaking to '%s'. Nevermind. Let's keep going!",
               MSG_host_get_name(slaves[i % slaves_count]));
       free(task->data);
       MSG_task_destroy(task);
@@ -93,27 +76,23 @@ int master(int argc, char *argv[])
     }
   }
 
-  XBT_INFO
-      ("All tasks have been dispatched. Let's tell everybody the computation is over.");
+  XBT_INFO("All tasks have been dispatched. Let's tell everybody the computation is over.");
   for (i = 0; i < slaves_count; i++) {
     msg_task_t task = MSG_task_create("finalize", 0, 0, FINALIZE);
     int a = MSG_task_send_with_timeout(task,MSG_host_get_name(slaves[i]),1.0);
     if (a == MSG_OK)
       continue;
     if (a == MSG_HOST_FAILURE) {
-      XBT_INFO
-          ("Gloups. The cpu on which I'm running just turned off!. See you!");
+      XBT_INFO("Gloups. The cpu on which I'm running just turned off!. See you!");
       MSG_task_destroy(task);
       free(slaves);
       return 0;
     } else if (a == MSG_TRANSFER_FAILURE) {
-      XBT_INFO("Mmh. Can't reach '%s'! Nevermind. Let's keep going!",
-          MSG_host_get_name(slaves[i]));
+      XBT_INFO("Mmh. Can't reach '%s'! Nevermind. Let's keep going!", MSG_host_get_name(slaves[i]));
       MSG_task_destroy(task);
     } else if (a == MSG_TIMEOUT) {
-      XBT_INFO
-          ("Mmh. Got timeouted while speaking to '%s'. Nevermind. Let's keep going!",
-              MSG_host_get_name(slaves[i % slaves_count]));
+      XBT_INFO("Mmh. Got timeouted while speaking to '%s'. Nevermind. Let's keep going!",
+               MSG_host_get_name(slaves[i % slaves_count]));
       MSG_task_destroy(task);
     } else {
       XBT_INFO("Hey ?! What's up ? ");
@@ -124,10 +103,9 @@ int master(int argc, char *argv[])
   XBT_INFO("Goodbye now!");
   free(slaves);
   return 0;
-}                               /* end_of_master */
+}
 
-/** Receiver function  */
-int slave(int argc, char *argv[])
+static int slave(int argc, char *argv[])
 {
   while (1) {
     msg_task_t task = NULL;
@@ -153,8 +131,7 @@ int slave(int argc, char *argv[])
         free(task->data);
         MSG_task_destroy(task);
       } else if (a == MSG_HOST_FAILURE) {
-        XBT_INFO
-            ("Gloups. The cpu on which I'm running just turned off!. See you!");
+        XBT_INFO("Gloups. The cpu on which I'm running just turned off!. See you!");
         free(task->data);
         MSG_task_destroy(task);
         return 0;
@@ -163,8 +140,7 @@ int slave(int argc, char *argv[])
         xbt_die("Unexpected behavior");
       }
     } else if (a == MSG_HOST_FAILURE) {
-      XBT_INFO
-          ("Gloups. The cpu on which I'm running just turned off!. See you!");
+      XBT_INFO("Gloups. The cpu on which I'm running just turned off!. See you!");
       return 0;
     } else if (a == MSG_TRANSFER_FAILURE) {
       XBT_INFO("Mmh. Something went wrong. Nevermind. Let's keep going!");
@@ -175,40 +151,25 @@ int slave(int argc, char *argv[])
   }
   XBT_INFO("I'm done. See you!");
   return 0;
-}                               /* end_of_slave */
+}
 
-/** Test function */
-msg_error_t test_all(const char *platform_file,
-                     const char *application_file)
+int main(int argc, char *argv[])
 {
   msg_error_t res = MSG_OK;
 
-  {                             /*  Simulation setting */
-    MSG_create_environment(platform_file);
-  }
-  {                             /*   Application deployment */
-    MSG_function_register("master", master);
-    MSG_function_register("slave", slave);
-    MSG_launch_application(application_file);
-  }
-  res = MSG_main();
+  MSG_init(&argc, argv);
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+             "\tExample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]);
 
-  XBT_INFO("Simulation time %g", MSG_get_clock());
-  return res;
-}                               /* end_of_test_all */
+  MSG_create_environment(argv[1]);
 
+  MSG_function_register("master", master);
+  MSG_function_register("slave", slave);
+  MSG_launch_application(argv[2]);
 
-/** Main function */
-int main(int argc, char *argv[])
-{
-  msg_error_t res = MSG_OK;
+  res = MSG_main();
 
-  MSG_init(&argc, argv);
-  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
-            "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
-            argv[0], argv[0]);
-  
-  res = test_all(argv[1], argv[2]);
+  XBT_INFO("Simulation time %g", MSG_get_clock());
 
   return res != MSG_OK;
 }
index 8628584..74e3858 100644 (file)
@@ -4,35 +4,21 @@
 /* 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 <stdio.h>
-#include "simgrid/msg.h"        /* Yeah! If you want to use msg, you need to include simgrid/msg.h */
-#include "xbt/sysdep.h"         /* calloc, printf */
+#include "simgrid/msg.h"
 
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 /** @addtogroup MSG_examples
  * 
- *  - <b>masterslave/masterslave_forwarder.c: Master/slaves
- *    example</b>. This good old example is also very simple. Its basic
- *    version is fully commented on this page: \ref MSG_ex_master_slave,
- *    but several variants can be found in the same directory. 
+ *  - <b>masterslave/masterslave_forwarder.c: Master/slaves example</b>. This good old example is also very simple. Its
+ *    basic version is fully commented on this page: \ref MSG_ex_master_slave, but several variants can be found in the
+ *    same directory.
  */
 
-
-int master(int argc, char *argv[]);
-int slave(int argc, char *argv[]);
-int forwarder(int argc, char *argv[]);
-msg_error_t test_all(const char *platform_file,
-                     const char *application_file);
-
 #define FINALIZE ((void*)221297)        /* a magic number to tell people to stop working */
 
 /** Emitter function  */
-int master(int argc, char *argv[])
+static int master(int argc, char *argv[])
 {
   int slaves_count = 0;
   msg_host_t *slaves = NULL;
@@ -57,9 +43,7 @@ int master(int argc, char *argv[])
 
     for (i = 0; i < number_of_tasks; i++) {
       sprintf(sprintf_buffer, "Task_%d", i);
-      todo[i] =
-          MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size,
-                          NULL);
+      todo[i] = MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size, NULL);
     }
   }
 
@@ -69,19 +53,16 @@ int master(int argc, char *argv[])
 
     for (i = 4; i < argc; i++) {
       slaves[i - 4] = MSG_host_by_name(argv[i]);
-      xbt_assert(slaves[i - 4] != NULL, "Unknown host %s. Stopping Now! ",
-                  argv[i]);
+      xbt_assert(slaves[i - 4] != NULL, "Unknown host %s. Stopping Now! ", argv[i]);
     }
   }
 
-  XBT_INFO("Got %d slaves and %d tasks to process", slaves_count,
-        number_of_tasks);
+  XBT_INFO("Got %d slaves and %d tasks to process", slaves_count, number_of_tasks);
   for (i = 0; i < slaves_count; i++)
     XBT_DEBUG("%s", MSG_host_get_name(slaves[i]));
 
   for (i = 0; i < number_of_tasks; i++) {
-    XBT_INFO("Sending \"%s\" to \"%s\"",
-          todo[i]->name, MSG_host_get_name(slaves[i % slaves_count]));
+    XBT_INFO("Sending \"%s\" to \"%s\"", todo[i]->name, MSG_host_get_name(slaves[i % slaves_count]));
     if (MSG_host_self() == slaves[i % slaves_count]) {
       XBT_INFO("Hey ! It's me ! :)");
     }
@@ -90,8 +71,7 @@ int master(int argc, char *argv[])
     XBT_INFO("Sent");
   }
 
-  XBT_INFO
-      ("All tasks have been dispatched. Let's tell everybody the computation is over.");
+  XBT_INFO("All tasks have been dispatched. Let's tell everybody the computation is over.");
   for (i = 0; i < slaves_count; i++) {
     msg_task_t finalize = MSG_task_create("finalize", 0, 0, FINALIZE);
     MSG_task_send(finalize, MSG_host_get_name(slaves[i]));
@@ -101,10 +81,9 @@ int master(int argc, char *argv[])
   free(slaves);
   free(todo);
   return 0;
-}                               /* end_of_master */
+}
 
-/** Receiver function  */
-int slave(int argc, char *argv[])
+static int slave(int argc, char *argv[])
 {
   msg_task_t task = NULL;
   XBT_ATTRIB_UNUSED int res;
@@ -126,10 +105,9 @@ int slave(int argc, char *argv[])
   }
   XBT_INFO("I'm done. See you!");
   return 0;
-}                               /* end_of_slave */
+}
 
-/** Forwarder function */
-int forwarder(int argc, char *argv[])
+static int forwarder(int argc, char *argv[])
 {
   int i;
   int slaves_count;
@@ -156,16 +134,13 @@ int forwarder(int argc, char *argv[])
     if (a == MSG_OK) {
       XBT_INFO("Received \"%s\"", MSG_task_get_name(task));
       if (MSG_task_get_data(task) == FINALIZE) {
-        XBT_INFO
-            ("All tasks have been dispatched. Let's tell everybody the computation is over.");
+        XBT_INFO("All tasks have been dispatched. Let's tell everybody the computation is over.");
         for (i = 0; i < slaves_count; i++)
-          MSG_task_send(MSG_task_create("finalize", 0, 0, FINALIZE),
-              MSG_host_get_name(slaves[i]));
+          MSG_task_send(MSG_task_create("finalize", 0, 0, FINALIZE), MSG_host_get_name(slaves[i]));
         MSG_task_destroy(task);
         break;
       }
-      XBT_INFO("Sending \"%s\" to \"%s\"",
-            MSG_task_get_name(task), MSG_host_get_name(slaves[i % slaves_count]));
+      XBT_INFO("Sending \"%s\" to \"%s\"", MSG_task_get_name(task), MSG_host_get_name(slaves[i % slaves_count]));
       MSG_task_send(task, MSG_host_get_name(slaves[i % slaves_count]));
       i++;
     } else {
@@ -177,41 +152,26 @@ int forwarder(int argc, char *argv[])
 
   XBT_INFO("I'm done. See you!");
   return 0;
-}                               /* end_of_forwarder */
+}
 
-/** Test function */
-msg_error_t test_all(const char *platform_file,
-                     const char *application_file)
+int main(int argc, char *argv[])
 {
   msg_error_t res = MSG_OK;
 
-  {                             /*  Simulation setting */
-    MSG_create_environment(platform_file);
-  }
-  {                             /*   Application deployment */
-    MSG_function_register("master", master);
-    MSG_function_register("slave", slave);
-    MSG_function_register("forwarder", forwarder);
-    MSG_launch_application(application_file);
-  }
-  res = MSG_main();
+  MSG_init(&argc, argv);
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+             "\tExample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]);
 
-  XBT_INFO("Simulation time %g", MSG_get_clock());
-  return res;
-}                               /* end_of_test_all */
+  MSG_create_environment(argv[1]);
 
+  MSG_function_register("master", master);
+  MSG_function_register("slave", slave);
+  MSG_function_register("forwarder", forwarder);
+  MSG_launch_application(argv[2]);
 
-/** Main function */
-int main(int argc, char *argv[])
-{
-  msg_error_t res = MSG_OK;
+  res = MSG_main();
 
-  MSG_init(&argc, argv);
-  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
-            "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
-            argv[0], argv[0]);
-  
-  res = test_all(argv[1], argv[2]);
+  XBT_INFO("Simulation time %g", MSG_get_clock());
 
   return res != MSG_OK;
 }
index 91e9914..365ebb3 100644 (file)
@@ -4,13 +4,9 @@
 /* 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/msg.h"        /* Yeah! If you want to use msg, you need to include simgrid/msg.h */
-#include "xbt/sysdep.h"         /* calloc */
+#include "simgrid/msg.h"
 
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 /** Lazy guy function. This process suspends itself asap.  */
 static int slave(int argc, char *argv[])
@@ -22,7 +18,7 @@ static int slave(int argc, char *argv[])
   MSG_task_execute(MSG_task_create("toto", 1e9, 0, NULL));
   XBT_INFO("Bye!");
   return 0;
-}                               /* end_of_lazy_guy */
+}
 
 static int master(int argc, char *argv[])
 {
@@ -40,37 +36,25 @@ static int master(int argc, char *argv[])
 
   XBT_INFO("OK, goodbye now.");
   return 0;
-}                               /* end_of_dram_master */
+}
 
-/** Test function */
-static msg_error_t test_all(const char *platform_file,
-                            const char *application_file)
+int main(int argc, char *argv[])
 {
   msg_error_t res = MSG_OK;
 
-  MSG_create_environment(platform_file);
+  MSG_init(&argc, argv);
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+             "\tExample: %s msg_platform.xml msg_deployment_suspend.xml\n", argv[0], argv[0]);
+
+  MSG_create_environment(argv[1]);
+
   MSG_function_register("master", master);
   MSG_function_register("slave", slave);
-  MSG_launch_application(application_file);
+  MSG_launch_application(argv[2]);
 
   res = MSG_main();
 
   XBT_INFO("Simulation time %g", MSG_get_clock());
-  return res;
-}                               /* end_of_test_all */
-
-
-/** Main function */
-int main(int argc, char *argv[])
-{
-  msg_error_t res = MSG_OK;
-
-  MSG_init(&argc, argv);
-  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
-            "\tExample: %s msg_platform.xml msg_deployment_suspend.xml\n", 
-            argv[0], argv[0]);
-
-  test_all(argv[1], argv[2]);
 
   return res != MSG_OK;
 }
index 8c4c100..8aed047 100644 (file)
@@ -4,21 +4,11 @@
 /* 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 <stdio.h>
-#include "simgrid/msg.h"        /* Yeah! If you want to use msg, you need to include simgrid/msg.h */
-#include "xbt/sysdep.h"
+#include "simgrid/msg.h"
 
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
-int master(int argc, char *argv[]);
-int slave(int argc, char *argv[]);
-
-/** Sender function  */
-int master(int argc, char *argv[])
+static int master(int argc, char *argv[])
 {
   long number_of_tasks = xbt_str_parse_int(argv[1], "Invalid amount of tasks: %s");
   double task_comp_size = xbt_str_parse_double(argv[2], "Invalid computational size: %s");
@@ -36,18 +26,14 @@ int master(int argc, char *argv[])
 
     sprintf(mailbox, "slave-%ld", i % slaves_count);
     sprintf(sprintf_buffer, "Task_%d", i);
-    task =
-        MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size,
-                        NULL);
+    task = MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size, NULL);
     if (number_of_tasks < 10000 || i % 10000 == 0)
-      XBT_INFO("Sending \"%s\" (of %ld) to mailbox \"%s\"", task->name,
-            number_of_tasks, mailbox);
+      XBT_INFO("Sending \"%s\" (of %ld) to mailbox \"%s\"", task->name, number_of_tasks, mailbox);
 
     MSG_task_send(task, mailbox);
   }
 
-  XBT_INFO
-      ("All tasks have been dispatched. Let's tell everybody the computation is over.");
+  XBT_INFO("All tasks have been dispatched. Let's tell everybody the computation is over.");
   for (i = 0; i < slaves_count; i++) {
     char mailbox[80];
 
@@ -56,12 +42,10 @@ int master(int argc, char *argv[])
     MSG_task_send(finalize, mailbox);
   }
 
-//  XBT_INFO("Goodbye now!");
   return 0;
-}                               /* end_of_master */
+}
 
-/** Receiver function  */
-int slave(int argc, char *argv[])
+static int slave(int argc, char *argv[])
 {
   msg_task_t task = NULL;
   XBT_ATTRIB_UNUSED int res;
@@ -91,32 +75,21 @@ int slave(int argc, char *argv[])
   }
   XBT_INFO("I'm done. See you!");
   return 0;
-}                               /* end_of_slave */
+}
 
-/** Main function */
 int main(int argc, char *argv[])
 {
-  msg_error_t res;
-  const char *platform_file;
-  const char *application_file;
-
   MSG_init(&argc, argv);
   xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
-            "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
-            argv[0], argv[0]);
-  
-  platform_file = argv[1];
-  application_file = argv[2];
-
-  {                             /*  Simulation setting */
-    MSG_create_environment(platform_file);
-  }
-  {                             /*   Application deployment */
-    MSG_function_register("master", master);
-    MSG_function_register("slave", slave);
-    MSG_launch_application(application_file);
-  }
-  res = MSG_main();
+             "\tExample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]);
+
+  MSG_create_environment(argv[1]);
+
+  MSG_function_register("master", master);
+  MSG_function_register("slave", slave);
+  MSG_launch_application(argv[2]);
+
+  msg_error_t res = MSG_main();
 
   XBT_INFO("Simulation time %g", MSG_get_clock());
 
index 9a6bd21..804affb 100644 (file)
@@ -4,20 +4,15 @@
 /* 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/msg.h"        /* core library */
-#include "xbt/sysdep.h"         /* calloc */
+#include "simgrid/msg.h"
 #include "xbt/synchro_core.h"
 
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 /** @addtogroup MSG_examples
  *  
- *  - <b>migration/migration.c</b> Demonstrates how to use the @ref
- *    MSG_process_migrate function to let processes change the host they 
- *    run on after their start. 
+ *  - <b>migration/migration.c</b> Demonstrates how to use the @ref MSG_process_migrate function to let processes
+ *    change the host they run on after their start.
  */
 
 xbt_mutex_t mutex = NULL;
@@ -28,10 +23,9 @@ static msg_process_t process_to_migrate = NULL;
 static int emigrant(int argc, char *argv[])
 {
   msg_task_t task;
-  XBT_INFO
-      ("I'll look for a new job on another machine where the grass is greener.");
+  XBT_INFO("I'll look for a new job on another machine where the grass is greener.");
   MSG_process_migrate(MSG_process_self(), MSG_host_by_name("Boivin"));
-  
+
   XBT_INFO("Yeah, found something to do");
   task = MSG_task_create("job", 98095000, 0, NULL);
   MSG_task_execute(task);
@@ -50,13 +44,11 @@ static int emigrant(int argc, char *argv[])
   XBT_INFO("I've been moved on this new host: %s", MSG_host_get_name(h));
   XBT_INFO("Uh, nothing to do here. Stopping now");
   return 0;
-}                               /* end_of_emigrant */
-
+}
 
 /* This function move the emigrant on Jacquelin */
 static int policeman(int argc, char *argv[])
 {
-
   xbt_mutex_acquire(mutex);
   XBT_INFO("Wait a bit before migrating the emigrant.");
   while (process_to_migrate == NULL) xbt_cond_wait(cond, mutex);
@@ -66,29 +58,22 @@ static int policeman(int argc, char *argv[])
   xbt_mutex_release(mutex);
 
   return 0;
-}                               /* end_of_policeman */
-
+}
 
-/** Main function */
 int main(int argc, char *argv[])
 {
   msg_error_t res = MSG_OK;
 
-  /* Argument checking */
   MSG_init(&argc, argv);
   xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
-            "\tExample: %s msg_platform.xml msg_deployment_suspend.xml\n", 
-            argv[0], argv[0]);
+            "\tExample: %s msg_platform.xml msg_deployment_suspend.xml\n", argv[0], argv[0]);
 
-  /* Simulation setting */
   MSG_create_environment(argv[1]);
 
-  /* Application deployment */
   MSG_function_register("emigrant", emigrant);
   MSG_function_register("policeman", policeman);
   MSG_launch_application(argv[2]);
 
-  /* Run the simulation */
   mutex = xbt_mutex_init();
   cond = xbt_cond_init();
   res = MSG_main();
index 42fa9d1..9d9a3f9 100644 (file)
@@ -4,14 +4,9 @@
 /* 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 <stdio.h>
-#include <stdlib.h>
 #include "simgrid/msg.h"
-#include "xbt/log.h"
-#include "xbt/asserts.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 
 /** @addtogroup MSG_examples
@@ -20,24 +15,14 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
  * 
  *  @subsection MSG_ex_PLS Packet level simulators
  * 
- *  These examples demonstrate how to use the bindings to classical
- *  Packet-Level Simulators (PLS), as explained in \ref pls. The most
- *  interesting is probably not the C files since they are unchanged
- *  from the other simulations, but the associated files, such as the
- *  platform files to see how to declare a platform to be used with
- *  the PLS bindings of SimGrid and the tesh files to see how to
- *  actually start a simulation in these settings.
+ *  These examples demonstrate how to use the bindings to classicalPacket-Level Simulators (PLS), as explained in
+ *  \ref pls. The most interesting is probably not the C files since they are unchanged from the other simulations,
+ *  but the associated files, such as the platform files to see how to declare a platform to be used with the PLS
+ *  bindings of SimGrid and the tesh files to see how to actually start a simulation in these settings.
  * 
  * - <b>ns3</b>: Simple ping-pong using ns3 instead of the SimGrid network models. 
- * 
  */
 
-int master(int argc, char *argv[]);
-int slave(int argc, char *argv[]);
-int timer(int argc, char *argv[]);
-msg_error_t test_all(const char *platform_file,
-                     const char *application_file);
-
 int timer_start; //set as 1 in the master process
 
 //keep a pointer to all surf running tasks.
@@ -53,8 +38,7 @@ int count_finished = 0;
 
 #define FINALIZE ((void*)221297)        /* a magic number to tell people to stop working */
 
-/** master */
-int master(int argc, char *argv[])
+static int master(int argc, char *argv[])
 {
   msg_task_t todo;
 
@@ -82,9 +66,7 @@ int master(int argc, char *argv[])
     gl_data_size[id] = task_comm_size;
   }
 
-  {                             /* Process organization */
-    MSG_host_by_name(slavename);
-  }
+  MSG_host_by_name(slavename);
 
   count_finished++;
   timer_start = 1 ;
@@ -98,11 +80,9 @@ int master(int argc, char *argv[])
   XBT_DEBUG ("Finished");
   xbt_free(id_alias);
   return 0;
-}                               /* end_of_master */
-
+}
 
-/** Timer function  */
-int timer(int argc, char *argv[])
+static int timer(int argc, char *argv[])
 {
   double sleep_time;
   double first_sleep;
@@ -120,81 +100,48 @@ int timer(int argc, char *argv[])
 
   do {
     XBT_DEBUG ("Get sleep");
-      MSG_process_sleep(sleep_time);
+    MSG_process_sleep(sleep_time);
   } while(timer_start);
 
   XBT_DEBUG ("Finished");
   return 0;
 }
 
-/** Receiver function  */
-int slave(int argc, char *argv[])
+static int slave(int argc, char *argv[])
 {
-
   msg_task_t task = NULL;
-  int a = MSG_OK;
-  int id = 0;
   char id_alias[10];
 
   xbt_assert(argc==2,"Strange number of arguments expected 1 got %d", argc - 1);
 
   XBT_DEBUG ("Slave started");
 
-  id = xbt_str_parse_int(argv[1], "Invalid id: %s");
+  int id = xbt_str_parse_int(argv[1], "Invalid id: %s");
   sprintf(id_alias, "%d", id);
 
-  a = MSG_task_receive(&(task), id_alias);
+  msg_error_t a = MSG_task_receive(&(task), id_alias);
 
   count_finished--;
   if(count_finished == 0){
       timer_start = 0;
   }
 
-
-
   if (a != MSG_OK) {
     XBT_INFO("Hey?! What's up?");
     xbt_die("Unexpected behavior.");
   }
 
   elapsed_time = MSG_get_clock() - start_time;
-  
-  XBT_INFO("FLOW[%d] : Receive %.0f bytes from %s to %s",
-      id,
-      MSG_task_get_bytes_amount(task),
-       masternames[id],
-       slavenames[id]);
+
+  XBT_INFO("FLOW[%d] : Receive %.0f bytes from %s to %s", id, MSG_task_get_bytes_amount(task), masternames[id],
+           slavenames[id]);
 //  MSG_task_execute(task);
   MSG_task_destroy(task);
 
   XBT_DEBUG ("Finished");
   return 0;
-}                               /* end_of_slave */
-
-/** Test function */
-msg_error_t test_all(const char *platform_file,
-                     const char *application_file)
-{
-  msg_error_t res = MSG_OK;
-
-  {                             /*  Simulation setting */
-    MSG_create_environment(platform_file);
-  }
-
-  TRACE_declare_mark("endmark");
-
-  {                             /*   Application deployment */
-    MSG_function_register("master", master);
-    MSG_function_register("slave", slave);
-    MSG_function_register("timer", timer);
-
-    MSG_launch_application(application_file);
-  }
-  res = MSG_main();
-  return res;
-}                               /* end_of_test_all */
+}
 
-/** Main function */
 int main(int argc, char *argv[])
 {
   msg_error_t res = MSG_OK;
@@ -202,11 +149,18 @@ int main(int argc, char *argv[])
 
   MSG_init(&argc, argv);
   xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
-            "\tExample: %s platform.xml deployment.xml\n", 
-            argv[0], argv[0]);
-   
+             "\tExample: %s platform.xml deployment.xml\n", argv[0], argv[0]);
+
+  MSG_create_environment(argv[1]);
+  TRACE_declare_mark("endmark");
 
-  res = test_all(argv[1], argv[2]);
+  MSG_function_register("master", master);
+  MSG_function_register("slave", slave);
+  MSG_function_register("timer", timer);
+
+  MSG_launch_application(argv[2]);
+
+  res = MSG_main();
 
   return res != MSG_OK;
 }
index e291efd..3308119 100644 (file)
@@ -16,7 +16,6 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example")
  *   interfaces, but it's not possible ATM).
  */
 
-
 static int runner(int argc, char *argv[])
 {
   /* Retrieve the list of all hosts as an array of hosts */
@@ -24,7 +23,8 @@ static int runner(int argc, char *argv[])
   int slaves_count = xbt_dynar_length(slaves_dynar);
   msg_host_t *slaves = xbt_dynar_to_array(slaves_dynar);
 
-  XBT_INFO("First, build a classical parallel task, with 1 Gflop to execute on each node, and 10MB to exchange between each pair");
+  XBT_INFO("First, build a classical parallel task, with 1 Gflop to execute on each node, "
+           "and 10MB to exchange between each pair");
   double *computation_amounts = xbt_new0(double, slaves_count);
   double *communication_amounts = xbt_new0(double, slaves_count * slaves_count);
 
index 37d443c..2b6efe9 100644 (file)
@@ -4,14 +4,10 @@
 /* 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 <stdio.h>
 #include <math.h>
 #include "simgrid/msg.h"
-#include "xbt/log.h"
-#include "xbt/asserts.h"
 
- XBT_LOG_NEW_DEFAULT_CATEGORY(msg_pastry,
-                             "Messages specific for this msg example");
+ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_pastry, "Messages specific for this msg example");
 
 /***************************************
  * PASTRY                              *
@@ -40,7 +36,6 @@ static int max_simulation_time = 1000;
 
 extern long int smx_total_comms;
 
-
 typedef struct s_node {
   int id;                                 //128bits generated random(2^128 -1)
   int known_id;
@@ -60,9 +55,7 @@ typedef struct s_state {
   int routing_table[LEVELS_COUNT][LEVEL_SIZE];
 } s_state_t, *state_t;
 
-/**
- * Types of tasks exchanged between nodes.
- */
+/** Types of tasks exchanged between nodes. */
 typedef enum {
   TASK_JOIN,
   TASK_JOIN_REPLY,
@@ -96,7 +89,6 @@ static int routing_next(node_t node, int dest);
 static void create(node_t node);
 static int join(node_t node);
 
-
 /**
  * \brief Gets the mailbox name of a host given its chord id.
  * \param node_id id of a node
index c9ef867..5d4f662 100644 (file)
@@ -8,7 +8,6 @@
 
 #include "simgrid/msg.h"
 #include "xbt/matrix.h"
-#include "xbt/log.h"
 #include "xbt/xbt_os_time.h"
 
 /** @addtogroup MSG_examples
index 7fab442..9d4e0a9 100644 (file)
@@ -4,9 +4,7 @@
 /* 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 <stdlib.h>
 #include "simgrid/msg.h"
-#include "xbt/log.h"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_semaphore_example, "Messages specific for this msg example");
 
index 820cc7e..0de9b4a 100644 (file)
@@ -17,7 +17,7 @@ static int sleeper(int argc, char *argv[])
 {
   XBT_INFO("Hello! I go to sleep.");
   MSG_process_on_exit(my_onexit, NULL);
-   
+
   MSG_process_sleep(xbt_str_parse_int(argv[1], "sleeper process expects an integer parameter but got %s"));
   XBT_INFO("Done sleeping.");
   return 0;
index 696da86..680bcd6 100644 (file)
@@ -51,7 +51,7 @@ public:
   /** The Actor that is currently running */
   static Actor *current();
   /** Retrieves the actor that have the given PID (or NULL if not existing) */
-  static Actor *byPid(int pid);
+  //static Actor *byPid(int pid); not implemented
 
   /** Retrieves the name of that actor */
   const char*getName();
index c1b403c..dc95bd2 100644 (file)
@@ -244,8 +244,8 @@ XBT_PUBLIC(void*) SIMIX_host_self_get_data(void);
 XBT_PUBLIC(int) SIMIX_process_count(void);
 XBT_PUBLIC(smx_process_t) SIMIX_process_self(void);
 XBT_PUBLIC(const char*) SIMIX_process_self_get_name(void);
-XBT_PUBLIC(void) SIMIX_process_self_set_data(smx_process_t self, void *data);
-XBT_PUBLIC(void*) SIMIX_process_self_get_data(smx_process_t self);
+XBT_PUBLIC(void) SIMIX_process_self_set_data(void *data);
+XBT_PUBLIC(void*) SIMIX_process_self_get_data(void);
 XBT_PUBLIC(smx_context_t) SIMIX_process_get_context(smx_process_t);
 XBT_PUBLIC(void) SIMIX_process_set_context(smx_process_t p,smx_context_t c);
 XBT_PUBLIC(int) SIMIX_process_has_pending_comms(smx_process_t process);
index 4605e69..771db26 100644 (file)
@@ -779,7 +779,7 @@ XBT_PUBLIC_DATA(xbt_dict_t) watched_hosts_lib;
 XBT_PUBLIC_DATA(AS_t) surf_AS_get_routing_root(void);
 XBT_PUBLIC_DATA(const char *) surf_AS_get_name(AS_t as);
 XBT_PUBLIC_DATA(AS_t) surf_AS_get_by_name(const char * name);
-XBT_PUBLIC_DATA(xbt_dict_t) surf_AS_get_routing_sons(AS_t as);
+XBT_PUBLIC_DATA(xbt_dict_t) surf_AS_get_children(AS_t as);
 XBT_PUBLIC_DATA(xbt_dynar_t) surf_AS_get_hosts(AS_t as);
 XBT_PUBLIC_DATA(void) surf_AS_get_graph(AS_t as, xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges);
 
index d780d3c..e2a09f4 100644 (file)
@@ -58,7 +58,7 @@ static void create_hierarchy(AS_t current_comp,
   xbt_dict_cursor_t cursor = NULL;
   char *key;
   AS_t elem;
-  xbt_dict_t routing_sons = surf_AS_get_routing_sons(current_comp);
+  xbt_dict_t routing_sons = surf_AS_get_children(current_comp);
 
   if (xbt_dict_is_empty(routing_sons)) {
     // I am no AS
index 7e96951..a045b2f 100644 (file)
@@ -39,36 +39,63 @@ const char* to_cstr(RegionType region)
   }
 }
 
-void data_deleter::operator()(void* p) const
+buffer::buffer(std::size_t size, Type type) : size_(size), type_(type)
 {
   switch(type_) {
-  case Free:
-    std::free(p);
+  case Type::Malloc:
+    data_ = malloc(size_);
     break;
-  case Munmap:
-    munmap(p, size_);
+  case Type::Mmap:
+    data_ = mmap(nullptr, size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_POPULATE, -1, 0);
+    if (data_ == MAP_FAILED) {
+      data_ = nullptr;
+      size_ = 0;
+      type_ = Type::Malloc;
+      throw std::bad_alloc();
+    }
+    break;
+  default:
+    abort();
+  }
+}
+
+void buffer::clear() noexcept
+{
+  switch(type_) {
+  case Type::Malloc:
+    std::free(data_);
     break;
+  case Type::Mmap:
+    if (munmap(data_, size_) != 0)
+      abort();
+    break;
+  default:
+    abort();
   }
+  data_ = nullptr;
+  size_ = 0;
+  type_ = Type::Malloc;
 }
 
 RegionSnapshot dense_region(
   RegionType region_type,
   void *start_addr, void* permanent_addr, size_t size)
 {
-  simgrid::mc::RegionSnapshot::flat_data_ptr data;
-  if (!_sg_mc_ksm)
-    data = simgrid::mc::RegionSnapshot::flat_data_ptr((char*) std::malloc(size));
-  else {
-    char* ptr = (char*) mmap(nullptr, size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_POPULATE, -1, 0);
-    if (ptr == MAP_FAILED)
-      throw std::bad_alloc();
-    simgrid::mc::data_deleter deleter(
-      simgrid::mc::data_deleter::Munmap, size);
-    data = simgrid::mc::RegionSnapshot::flat_data_ptr(ptr, deleter);
-  }
+  simgrid::mc::buffer::Type buffer_type;
+  if (_sg_mc_ksm)
+    // We use mmap to allocate the memory in order to madvise it.
+    // We don't want to madvise the main heap.
+    // Moreover we get aligned pgaes which is merge-friendly.
+    buffer_type = simgrid::mc::buffer::Type::Mmap;
+  else
+    buffer_type = simgrid::mc::buffer::Type::Malloc;
+
+  simgrid::mc::buffer data(size, buffer_type);
+
   mc_model_checker->process().read_bytes(data.get(), size,
     remote(permanent_addr),
     simgrid::mc::ProcessIndexDisabled);
+
   if (_sg_mc_ksm)
     // Mark the region as mergeable *after* we have written into it.
     // There no point to let KSM do the hard work before that.
@@ -79,7 +106,7 @@ RegionSnapshot dense_region(
   region.flat_data(std::move(data));
 
   XBT_DEBUG("New region : type : %s, data : %p (real addr %p), size : %zu",
-            to_cstr(region_type), region.flat_data(), permanent_addr, size);
+            to_cstr(region_type), region.flat_data().get(), permanent_addr, size);
   return std::move(region);
 }
 
index a003191..f1007ac 100644 (file)
@@ -37,22 +37,53 @@ enum class StorageType {
   Privatized = 3
 };
 
-class data_deleter {
+class buffer {
 public:
-  enum Type {
-    Free,
-    Munmap
+  enum class Type {
+    Malloc,
+    Mmap
   };
 private:
-  Type type_;
+  void* data_ = nullptr;
   std::size_t size_;
+  Type type_ = Type::Malloc;
 public:
-  data_deleter() : type_(Free) {}
-  data_deleter(Type type, std::size_t size) : type_(type), size_(size) {}
-  void operator()(void* p) const;
-};
+  buffer() {}
+  buffer(std::size_t size, Type type = Type::Malloc);
+  buffer(void* data, std::size_t size, Type type = Type::Malloc) :
+    data_(data), size_(size), type_(type) {}
+  void clear() noexcept;
+  ~buffer() noexcept { clear(); }
+
+  // No copy
+  buffer(buffer const& buffer) = delete;
+  buffer& operator=(buffer const& buffer) = delete;
+
+  // Move
+  buffer(buffer&& that) noexcept
+    : data_(that.data_), size_(that.size_), type_(that.type_)
+  {
+    that.data_ = nullptr;
+    that.size_ = 0;
+    that.type_ = Type::Malloc;
+  }
+  buffer& operator=(buffer&& that) noexcept
+  {
+    clear();
+    data_ = that.data_;
+    size_ = that.size_;
+    type_ = that.type_;
+    that.data_ = nullptr;
+    that.size_ = 0;
+    that.type_ = Type::Malloc;
+    return *this;
+  }
 
-typedef std::unique_ptr<char[], data_deleter> unique_data_ptr;
+  void* get()              { return data_; }
+  const void* get()  const { return data_; }
+  std::size_t size() const { return size_; }
+  Type type()        const { return type_; }
+};
 
 /** A copy/snapshot of a given memory region
  *
@@ -77,8 +108,6 @@ public:
   static const RegionType UnknownRegion = RegionType::Unknown;
   static const RegionType HeapRegion = RegionType::Heap;
   static const RegionType DataRegion = RegionType::Data;
-public:
-  typedef unique_data_ptr flat_data_ptr;
 private:
   RegionType region_type_;
   StorageType storage_type_;
@@ -101,7 +130,7 @@ private:
    * */
   void *permanent_addr_;
 
-  flat_data_ptr flat_data_;
+  buffer flat_data_;
   ChunkedData page_numbers_;
   std::vector<RegionSnapshot> privatized_regions_;
 public:
@@ -160,7 +189,7 @@ public:
     storage_type_ = StorageType::NoData;
     privatized_regions_.clear();
     page_numbers_.clear();
-    flat_data_.reset();
+    flat_data_.clear();
     object_info_ = nullptr;
     start_addr_ = nullptr;
     size_ = 0;
@@ -170,24 +199,25 @@ public:
   void clear_data()
   {
     storage_type_ = StorageType::NoData;
-    flat_data_.reset();
+    flat_data_.clear();
     page_numbers_.clear();
     privatized_regions_.clear();
   }
   
-  void flat_data(flat_data_ptr data)
+  void flat_data(buffer data)
   {
     storage_type_ = StorageType::Flat;
     flat_data_ = std::move(data);
     page_numbers_.clear();
     privatized_regions_.clear();
   }
-  const char* flat_data() const { return flat_data_.get(); }
+  const buffer& flat_data() const { return flat_data_; }
+  buffer& flat_data()             { return flat_data_; }
 
   void page_data(ChunkedData page_data)
   {
     storage_type_ = StorageType::Chunked;
-    flat_data_.reset();
+    flat_data_.clear();
     page_numbers_ = std::move(page_data);
     privatized_regions_.clear();
   }
@@ -196,7 +226,7 @@ public:
   void privatized_data(std::vector<RegionSnapshot> data)
   {
     storage_type_ = StorageType::Privatized;
-    flat_data_.reset();
+    flat_data_.clear();
     page_numbers_.clear();
     privatized_regions_ = std::move(data);
   }
index baf90a2..07fa867 100644 (file)
@@ -66,7 +66,7 @@ static void restore(mc_mem_region_t region)
     break;
 
   case simgrid::mc::StorageType::Flat:
-    mc_model_checker->process().write_bytes(region->flat_data(),
+    mc_model_checker->process().write_bytes(region->flat_data().get(),
       region->size(), region->permanent_address());
     break;
 
index 4c1e7df..00ead0e 100644 (file)
@@ -30,8 +30,6 @@
 #include "xbt/mmalloc.h"
 #include "src/xbt/mmalloc/mmprivate.h"
 
-#include "src/xbt/probes.h"
-
 using simgrid::mc::remote;
 
 extern "C" {
@@ -288,7 +286,6 @@ static int compare_global_variables(simgrid::mc::ObjectInformation* object_info,
                                 (char *) current_var.address, snapshot2, r2,
                                 bvariable_type, 0);
     if (res == 1) {
-      XBT_TRACE3(mc, global_diff, -1, -1, current_var->name);
       XBT_VERB("Global variable %s (%p) is different between snapshots",
                current_var.name.c_str(),
                (char *) current_var.address);
@@ -344,7 +341,6 @@ static int compare_local_variables(int process_index,
 
       if (res == 1) {
         // TODO, fix current_varX->subprogram->name to include name if DW_TAG_inlined_subprogram
-        XBT_TRACE3(mc, local_diff, -1, -1, current_var1->name);
         XBT_VERB
             ("Local variable %s (%p - %p) in frame %s "
              "is different between snapshots",
@@ -391,7 +387,6 @@ int snapshot_compare(void *state1, void *state2)
   if (_sg_mc_hash) {
     hash_result = (s1->hash != s2->hash);
     if (hash_result) {
-      XBT_TRACE2(mc, hash_diff, num1, num2);
       XBT_VERB("(%d - %d) Different hash : 0x%" PRIx64 "--0x%" PRIx64, num1,
                num2, s1->hash, s2->hash);
 #ifndef MC_DEBUG
@@ -404,7 +399,6 @@ int snapshot_compare(void *state1, void *state2)
 
   /* Compare enabled processes */
   if (s1->enabled_processes != s2->enabled_processes) {
-      //XBT_TRACE3(mc, state_diff, num1, num2, "Different enabled processes");
       XBT_VERB("(%d - %d) Different enabled processes", num1, num2);
       // return 1; ??
   }
@@ -428,7 +422,6 @@ int snapshot_compare(void *state1, void *state2)
       XBT_VERB("(%d - %d) Different size used in stacks : %zu - %zu", num1,
                num2, size_used1, size_used2);
 #endif
-      XBT_TRACE3(mc, state_diff, num1, num2, "Different stack size");
       return 1;
 #endif
     }
@@ -451,7 +444,6 @@ int snapshot_compare(void *state1, void *state2)
     errors++;
 #else
 #ifdef MC_VERBOSE
-    XBT_TRACE3(mc, state_diff, num1, num2, "Different heap information");
     XBT_VERB("(%d - %d) Different heap information", num1, num2);
 #endif
 
@@ -478,7 +470,6 @@ int snapshot_compare(void *state1, void *state2)
     else diff_local =
         compare_local_variables(stack1->process_index, s1, s2, stack1, stack2);
     if (diff_local > 0) {
-      XBT_TRACE3(mc, state_diff, num1, num2, "Different local variables");
 #ifdef MC_DEBUG
       XBT_DEBUG("(%d - %d) Different local variables between stacks %d", num1,
                 num2, cursor + 1);
@@ -525,7 +516,6 @@ int snapshot_compare(void *state1, void *state2)
         s1, s2);
 
     if (is_diff != 0) {
-      XBT_TRACE3(mc, state_diff, num1, num2, "Different global variables");
 #ifdef MC_DEBUG
       XBT_DEBUG("(%d - %d) Different global variables in %s",
         num1, num2, name.c_str());
@@ -543,7 +533,6 @@ int snapshot_compare(void *state1, void *state2)
 
   /* Compare heap */
   if (mmalloc_compare_heap(s1, s2) > 0) {
-    XBT_TRACE3(mc, state_diff, num1, num2, "Different heap");
 
 #ifdef MC_DEBUG
     XBT_DEBUG("(%d - %d) Different heap (mmalloc_compare)", num1, num2);
index 45db54c..a1e7399 100644 (file)
@@ -55,7 +55,7 @@ void* mc_translate_address_region(uintptr_t addr, mc_mem_region_t region, int pr
   case simgrid::mc::StorageType::Flat:
     {
       uintptr_t offset = (uintptr_t) addr - (uintptr_t) region->start().address();
-      return (void *) ((uintptr_t) region->flat_data() + offset);
+      return (void *) ((uintptr_t) region->flat_data().get() + offset);
     }
 
   case simgrid::mc::StorageType::Chunked:
@@ -243,7 +243,7 @@ const void* MC_region_read(
     xbt_die("Storage type not supported");
 
   case simgrid::mc::StorageType::Flat:
-    return (char*) region->flat_data() + offset;
+    return (char*) region->flat_data().get() + offset;
 
   case simgrid::mc::StorageType::Chunked:
     {
index d070253..067eb5f 100644 (file)
@@ -60,7 +60,7 @@ msg_as_t MSG_environment_as_get_by_name(const char * name) {
 }
 
 xbt_dict_t MSG_environment_as_get_routing_sons(msg_as_t as) {
-  xbt_dict_t res = surf_AS_get_routing_sons(as);
+  xbt_dict_t res = surf_AS_get_children(as);
   return res;
 }
 
index cf71980..b49ab64 100644 (file)
@@ -44,8 +44,7 @@ msg_error_t MSG_parallel_task_execute(msg_task_t task)
 {
   xbt_ex_t e;
   simdata_task_t simdata = task->simdata;
-  msg_process_t self = SIMIX_process_self();
-  simdata_process_t p_simdata = (simdata_process_t) SIMIX_process_self_get_data(self);
+  simdata_process_t p_simdata = (simdata_process_t) SIMIX_process_self_get_data();
   e_smx_state_t comp_state;
   msg_error_t status = MSG_OK;
 
@@ -297,7 +296,7 @@ static XBT_INLINE msg_comm_t MSG_task_isend_internal(msg_task_t task, const char
   /* Prepare the task to send */
   t_simdata = task->simdata;
   t_simdata->sender = process;
-  t_simdata->source = ((simdata_process_t) SIMIX_process_self_get_data(process))->m_host;
+  t_simdata->source = ((simdata_process_t) SIMIX_process_self_get_data())->m_host;
 
   if (t_simdata->isused != 0) {
     if (msg_global->debug_multiple_use){
index 74d330d..cb67a3f 100644 (file)
@@ -154,14 +154,14 @@ msg_error_t MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, msg_task_t task,
   msg_error_t ret = MSG_OK;
   simdata_task_t t_simdata = NULL;
   msg_process_t process = MSG_process_self();
-  simdata_process_t p_simdata = (simdata_process_t) SIMIX_process_self_get_data(process);
+  simdata_process_t p_simdata = (simdata_process_t) SIMIX_process_self_get_data();
 
   int call_end = TRACE_msg_task_put_start(task);    //must be after CHECK_HOST()
 
   /* Prepare the task to send */
   t_simdata = task->simdata;
   t_simdata->sender = process;
-  t_simdata->source = ((simdata_process_t) SIMIX_process_self_get_data(process))->m_host;
+  t_simdata->source = ((simdata_process_t) SIMIX_process_self_get_data())->m_host;
 
   if (t_simdata->isused != 0) {
     if (msg_global->debug_multiple_use){
index 5ce8704..7ddd2c4 100644 (file)
@@ -34,8 +34,8 @@ void MSG_process_cleanup_from_SIMIX(smx_process_t smx_proc)
   // get the MSG process from the SIMIX process
   if (smx_proc == SIMIX_process_self()) {
     /* avoid a SIMIX request if this function is called by the process itself */
-    msg_proc = (simdata_process_t) SIMIX_process_self_get_data(smx_proc);
-    SIMIX_process_self_set_data(smx_proc, NULL);
+    msg_proc = (simdata_process_t) SIMIX_process_self_get_data();
+    SIMIX_process_self_set_data(NULL);
   } else {
     msg_proc = (simdata_process_t) simcall_process_get_data(smx_proc);
     simcall_process_set_data(smx_proc, NULL);
@@ -294,7 +294,7 @@ msg_host_t MSG_process_get_host(msg_process_t process)
 {
   simdata_process_t simdata;
   if (process == NULL) {
-    simdata = (simdata_process_t) SIMIX_process_self_get_data(SIMIX_process_self());
+    simdata = (simdata_process_t) SIMIX_process_self_get_data();
   }
   else {
     simdata = (simdata_process_t) simcall_process_get_data(process);
diff --git a/src/probes.tp b/src/probes.tp
deleted file mode 100644 (file)
index 6ccc0aa..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-TRACEPOINT_EVENT(
-  mc,
-  state_diff,
-  TP_ARGS(
-    int, state1,
-    int, state2,
-    char*, message
-  ),
-  TP_FIELDS(
-    ctf_integer(int, state1, state1)
-    ctf_integer(int, state2, state2)
-    ctf_string(message, message)
-  )
-)
-TRACEPOINT_LOGLEVEL(mc, state_diff, TRACE_INFO)
-
-TRACEPOINT_EVENT(
-  mc,
-  hash_diff,
-  TP_ARGS(
-    int, state1,
-    int, state2
-  ),
-  TP_FIELDS(
-    ctf_integer(int, state1, state1)
-    ctf_integer(int, state2, state2)
-  )
-)
-TRACEPOINT_LOGLEVEL(mc, hash_diff, TRACE_INFO)
-
-TRACEPOINT_EVENT(
-  mc,
-  global_diff,
-  TP_ARGS(
-    int, state1,
-    int, state2,
-    char*, variable
-  ),
-  TP_FIELDS(
-    ctf_integer(int, state1, state1)
-    ctf_integer(int, state2, state2)
-    ctf_string(variable, variable)
-  )
-)
-TRACEPOINT_LOGLEVEL(mc, global_diff, TRACE_INFO)
-
-TRACEPOINT_EVENT(
-  mc,
-  local_diff,
-  TP_ARGS(
-    int, state1,
-    int, state2,
-    char*, variable
-  ),
-  TP_FIELDS(
-    ctf_integer(int, state1, state1)
-    ctf_integer(int, state2, state2)
-    ctf_string(variable, variable)
-  )
-)
-TRACEPOINT_LOGLEVEL(mc, local_diff, TRACE_INFO)
index daf355b..4e7594c 100644 (file)
 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_actor,"S4U actors");
 
 /* C main function of a actor, running this->main */
-static int s4u_actor_runner(int argc, char **argv) {
-
-  smx_process_t smx_proc = SIMIX_process_self();
-  simgrid::s4u::Actor *actor = (simgrid::s4u::Actor*) SIMIX_process_self_get_data(smx_proc);
+static int s4u_actor_runner(int argc, char **argv)
+{
+  simgrid::s4u::Actor *actor = (simgrid::s4u::Actor*) SIMIX_process_self_get_data();
   int res = actor->main(argc,argv);
   return res;
 }
@@ -45,16 +44,14 @@ int s4u::Actor::main(int argc, char **argv) {
   fprintf(stderr,"Error: You should override the method main(int, char**) in Actor class %s\n",getName());
   return 0;
 }
-s4u::Actor *s4u::Actor::current() {
+s4u::Actor *s4u::Actor::current()
+{
   smx_process_t smx_proc = SIMIX_process_self();
-  simgrid::s4u::Actor* res = (simgrid::s4u::Actor*) SIMIX_process_self_get_data(smx_proc);
+  simgrid::s4u::Actor* res = (simgrid::s4u::Actor*) SIMIX_process_self_get_data();
   if (res == NULL) // The smx_process was not created by S4U (but by deployment?). Embed it in a S4U object
     res = new Actor(smx_proc);
   return res;
 }
-s4u::Actor *s4u::Actor::byPid(int pid) {
-  return (simgrid::s4u::Actor*) SIMIX_process_self_get_data(SIMIX_process_from_PID(pid));
-}
 
 void s4u::Actor::setAutoRestart(bool autorestart) {
   simcall_process_auto_restart_set(p_smx_process,autorestart);
index f61113a..99063d9 100644 (file)
@@ -768,9 +768,9 @@ int SIMIX_process_get_PPID(smx_process_t self){
     return self->ppid;
 }
 
-void* SIMIX_process_self_get_data(smx_process_t self)
+void* SIMIX_process_self_get_data()
 {
-  xbt_assert(self == SIMIX_process_self(), "This is not the current process");
+  smx_process_t self = SIMIX_process_self();
 
   if (!self) {
     return NULL;
@@ -778,9 +778,9 @@ void* SIMIX_process_self_get_data(smx_process_t self)
   return SIMIX_process_get_data(self);
 }
 
-void SIMIX_process_self_set_data(smx_process_t self, void *data)
+void SIMIX_process_self_set_data(void *data)
 {
-  xbt_assert(self == SIMIX_process_self(), "This is not the current process");
+  smx_process_t self = SIMIX_process_self();
 
   SIMIX_process_set_data(self, data);
 }
index e9ef952..de9a238 100644 (file)
@@ -214,7 +214,7 @@ int smpi_global_size(void)
 
 smpi_process_data_t smpi_process_data(void)
 {
-  simdata_process_t simdata = static_cast<simdata_process_t>(SIMIX_process_self_get_data(SIMIX_process_self()));
+  simdata_process_t simdata = static_cast<simdata_process_t>(SIMIX_process_self_get_data());
   return static_cast<smpi_process_data_t>(simdata->data);
 }
 
index fc53997..d53c5d2 100644 (file)
@@ -130,12 +130,12 @@ static void recursiveGraphExtraction (simgrid::surf::As *rc, container_t contain
     return;
   }
   XBT_DEBUG ("Graph extraction for routing_component = %s", rc->name_);
-  if (!xbt_dict_is_empty(rc->sons_)){
+  if (!xbt_dict_is_empty(rc->children_)){
     xbt_dict_cursor_t cursor = NULL;
     AS_t rc_son;
     char *child_name;
     //bottom-up recursion
-    xbt_dict_foreach(surf_AS_get_routing_sons(rc), cursor, child_name, rc_son) {
+    xbt_dict_foreach(surf_AS_get_children(rc), cursor, child_name, rc_son) {
       container_t child_container = (container_t) xbt_dict_get (
         container->children, surf_AS_get_name(rc_son));
       recursiveGraphExtraction (rc_son, child_container, filter);
@@ -446,12 +446,12 @@ int instr_platform_traced ()
 static void recursiveXBTGraphExtraction (xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges,
     AS_t rc, container_t container)
 {
-  if (!xbt_dict_is_empty(surf_AS_get_routing_sons(rc))){
+  if (!xbt_dict_is_empty(surf_AS_get_children(rc))){
     xbt_dict_cursor_t cursor = NULL;
     AS_t rc_son;
     char *child_name;
     //bottom-up recursion
-    xbt_dict_foreach(surf_AS_get_routing_sons(rc), cursor, child_name, rc_son) {
+    xbt_dict_foreach(surf_AS_get_children(rc), cursor, child_name, rc_son) {
       container_t child_container = (container_t) xbt_dict_get (
         container->children, surf_AS_get_name(rc_son));
       recursiveXBTGraphExtraction (graph, nodes, edges, rc_son, child_container);
index 1ef547b..9b64a4e 100644 (file)
@@ -34,13 +34,19 @@ namespace surf {
   {}
   As::~As()
   {
-    xbt_dict_free(&sons_);
+    xbt_dict_cursor_t cursor = NULL;
+    char *key;
+    AS_t elem;
+    xbt_dict_foreach(children_, cursor, key, elem) {
+      delete (As*)elem;
+    }
+
+
+    xbt_dict_free(&children_);
     xbt_dynar_free(&vertices_);
     xbt_dynar_free(&upDownLinks);
-    if (nullptr != bypassRoutes_)
-      for (auto &kv : *bypassRoutes_)
-        delete kv.second;
-    delete bypassRoutes_;
+    for (auto &kv : bypassRoutes_)
+      delete kv.second;
     xbt_free(name_);
     delete netcard_;
   }
@@ -67,15 +73,15 @@ namespace surf {
   {
     // If never set a bypass route return NULL without any further computations
     XBT_DEBUG("generic_get_bypassroute from %s to %s", src->name(), dst->name());
-    if (bypassRoutes_ == nullptr)
+    if (bypassRoutes_.empty())
       return nullptr;
 
     std::vector<Link*> *bypassedRoute = nullptr;
 
     if(dst->containingAS() == this && src->containingAS() == this ){
       char *route_name = bprintf("%s#%s", src->name(), dst->name());
-      if (bypassRoutes_->find(route_name) != bypassRoutes_->end()) {
-        bypassedRoute = bypassRoutes_->at(route_name);
+      if (bypassRoutes_.find(route_name) != bypassRoutes_.end()) {
+        bypassedRoute = bypassRoutes_.at(route_name);
         XBT_DEBUG("Found a bypass route with %zu links",bypassedRoute->size());
       }
       free(route_name);
@@ -128,8 +134,8 @@ namespace surf {
           char *route_name = bprintf("%s#%s",
               (*(As **) (xbt_dynar_get_ptr(path_src, i)))->name_,
               (*(As **) (xbt_dynar_get_ptr(path_dst, max)))->name_);
-          if (bypassRoutes_->find(route_name) != bypassRoutes_->end())
-            bypassedRoute = bypassRoutes_->at(route_name);
+          if (bypassRoutes_.find(route_name) != bypassRoutes_.end())
+            bypassedRoute = bypassRoutes_.at(route_name);
           xbt_free(route_name);
         }
         if (bypassedRoute)
@@ -138,8 +144,8 @@ namespace surf {
           char *route_name = bprintf("%s#%s",
               (*(As **) (xbt_dynar_get_ptr(path_src, max)))->name_,
               (*(As **) (xbt_dynar_get_ptr(path_dst, i)))->name_);
-          if (bypassRoutes_->find(route_name) != bypassRoutes_->end())
-            bypassedRoute = bypassRoutes_->at(route_name);
+          if (bypassRoutes_.find(route_name) != bypassRoutes_.end())
+            bypassedRoute = bypassRoutes_.at(route_name);
           xbt_free(route_name);
         }
         if (bypassedRoute)
@@ -154,8 +160,8 @@ namespace surf {
             (*(As **) (xbt_dynar_get_ptr(path_src, max)))->name_,
             (*(As **) (xbt_dynar_get_ptr(path_dst, max)))->name_);
 
-        if (bypassRoutes_->find(route_name) != bypassRoutes_->end())
-          bypassedRoute = bypassRoutes_->at(route_name);
+        if (bypassRoutes_.find(route_name) != bypassRoutes_.end())
+          bypassedRoute = bypassRoutes_.at(route_name);
         xbt_free(route_name);
       }
       if (bypassedRoute)
@@ -172,9 +178,6 @@ namespace surf {
     const char *src = e_route->src;
     const char *dst = e_route->dst;
 
-    if(bypassRoutes_ == nullptr)
-      bypassRoutes_ = new std::map<std::string, std::vector<Link*>*>();
-
     char *route_name = bprintf("%s#%s", src, dst);
 
     /* Argument validity checks */
@@ -183,13 +186,12 @@ namespace surf {
           src, e_route->gw_src->name(), dst, e_route->gw_dst->name());
       xbt_assert(!e_route->link_list->empty(), "Bypass route between %s@%s and %s@%s cannot be empty.",
           src, e_route->gw_src->name(), dst, e_route->gw_dst->name());
-      xbt_assert(bypassRoutes_->find(route_name) == bypassRoutes_->end(),
-          "The bypass route between %s@%s and %s@%s already exists.",
+      xbt_assert(bypassRoutes_.find(route_name) == bypassRoutes_.end(), "The bypass route between %s@%s and %s@%s already exists.",
           src, e_route->gw_src->name(), dst, e_route->gw_dst->name());
     } else {
       XBT_DEBUG("Load bypassRoute from %s to %s", src, dst);
-      xbt_assert(!e_route->link_list->empty(),                            "Bypass route between %s and %s cannot be empty.",    src, dst);
-      xbt_assert(bypassRoutes_->find(route_name) == bypassRoutes_->end(), "The bypass route between %s and %s already exists.", src, dst);
+      xbt_assert(!e_route->link_list->empty(),                          "Bypass route between %s and %s cannot be empty.",    src, dst);
+      xbt_assert(bypassRoutes_.find(route_name) == bypassRoutes_.end(), "The bypass route between %s and %s already exists.", src, dst);
     }
 
     /* Build a copy that will be stored in the dict */
@@ -198,7 +200,7 @@ namespace surf {
       newRoute->push_back(link);
 
     /* Store it */
-    bypassRoutes_->insert({route_name, newRoute});
+    bypassRoutes_.insert({route_name, newRoute});
     xbt_free(route_name);
   }
 
@@ -334,7 +336,7 @@ void routing_AS_begin(sg_platf_AS_cbarg_t AS)
     netcard->setId(-1);
   } else if (current_routing != NULL && routing_platf->root_ != NULL) {
 
-    xbt_assert(!xbt_dict_get_or_null(current_routing->sons_, AS->id),
+    xbt_assert(!xbt_dict_get_or_null(current_routing->children_, AS->id),
                "The AS \"%s\" already exists", AS->id);
     /* it is a part of the tree */
     new_as->father_ = current_routing;
@@ -342,8 +344,7 @@ void routing_AS_begin(sg_platf_AS_cbarg_t AS)
     if (current_routing->hierarchy_ == SURF_ROUTING_NULL)
       current_routing->hierarchy_ = SURF_ROUTING_RECURSIVE;
     /* add to the sons dictionary */
-    xbt_dict_set(current_routing->sons_, AS->id,
-                 (void *) new_as, NULL);
+    xbt_dict_set(current_routing->children_, AS->id, (void *) new_as, NULL);
     /* add to the father element list */
     netcard->setId(current_routing->addComponent(netcard));
   } else {
@@ -366,11 +367,6 @@ void routing_AS_begin(sg_platf_AS_cbarg_t AS)
  *
  * Once you've declared all the content of your AS, you have to close
  * it with this call. Your AS is not usable until you call this function.
- *
- * @fixme: this call is not as robust as wanted: bad things WILL happen
- * if you call it twice for the same AS, or if you forget calling it, or
- * even if you add stuff to a closed AS
- *
  */
 void routing_AS_end()
 {
@@ -379,8 +375,6 @@ void routing_AS_end()
   current_routing = current_routing->father_;
 }
 
-/* Aux Business methods */
-
 /**
  * \brief Get the AS father and the first elements of the chain
  *
@@ -391,9 +385,7 @@ void routing_AS_end()
  * father in the chain
  */
 static void elements_father(sg_netcard_t src, sg_netcard_t dst,
-                            AS_t * res_father,
-                            AS_t * res_src,
-                            AS_t * res_dst)
+    AS_t * res_father, AS_t * res_src, AS_t * res_dst)
 {
   xbt_assert(src && dst, "bad parameters for \"elements_father\" method");
 #define ROUTING_HIERARCHY_MAXDEPTH 16     /* increase if it is not enough */
@@ -542,7 +534,7 @@ static xbt_dynar_t _recursiveGetOneLinkRoutes(As *rc)
   char *key;
   xbt_dict_cursor_t cursor = NULL;
   AS_t rc_child;
-  xbt_dict_foreach(rc->sons_, cursor, key, rc_child) {
+  xbt_dict_foreach(rc->children_, cursor, key, rc_child) {
     xbt_dynar_t onelink_child = _recursiveGetOneLinkRoutes(rc_child);
     if (onelink_child)
       xbt_dynar_merge(&ret,&onelink_child);
@@ -727,126 +719,6 @@ void sg_platf_new_peer(sg_platf_peer_cbarg_t peer)
   free(link_down);
 }
 
-// static void routing_parse_Srandom(void)
-// {
-//   double mean, std, min, max, seed;
-//   char *random_id = A_surfxml_random_id;
-//   char *random_radical = A_surfxml_random_radical;
-//   char *rd_name = NULL;
-//   char *rd_value;
-//   mean = surf_parse_get_double(A_surfxml_random_mean);
-//   std = surf_parse_get_double(A_surfxml_random_std___deviation);
-//   min = surf_parse_get_double(A_surfxml_random_min);
-//   max = surf_parse_get_double(A_surfxml_random_max);
-//   seed = surf_parse_get_double(A_surfxml_random_seed);
-
-//   double res = 0;
-//   int i = 0;
-//   random_data_t random = xbt_new0(s_random_data_t, 1);
-//   char *tmpbuf;
-
-//   xbt_dynar_t radical_elements;
-//   unsigned int iter;
-//   char *groups;
-//   int start, end;
-//   xbt_dynar_t radical_ends;
-
-//   switch (A_surfxml_random_generator) {
-//   case AU_surfxml_random_generator:
-//   case A_surfxml_random_generator_NONE:
-//     random->generator = NONE;
-//     break;
-//   case A_surfxml_random_generator_DRAND48:
-//     random->generator = DRAND48;
-//     break;
-//   case A_surfxml_random_generator_RAND:
-//     random->generator = RAND;
-//     break;
-//   case A_surfxml_random_generator_RNGSTREAM:
-//     random->generator = RNGSTREAM;
-//     break;
-//   default:
-//     surf_parse_error("Invalid random generator");
-//     break;
-//   }
-//   random->seed = seed;
-//   random->min = min;
-//   random->max = max;
-
-//   /* Check user stupidities */
-//   if (max < min)
-//     THROWF(arg_error, 0, "random->max < random->min (%f < %f)", max, min);
-//   if (mean < min)
-//     THROWF(arg_error, 0, "random->mean < random->min (%f < %f)", mean, min);
-//   if (mean > max)
-//     THROWF(arg_error, 0, "random->mean > random->max (%f > %f)", mean, max);
-
-//   /* normalize the mean and standard deviation before storing */
-//   random->mean = (mean - min) / (max - min);
-//   random->std = std / (max - min);
-
-//   if (random->mean * (1 - random->mean) < random->std * random->std)
-//     THROWF(arg_error, 0, "Invalid mean and standard deviation (%f and %f)",
-//            random->mean, random->std);
-
-//   XBT_DEBUG
-//       ("id = '%s' min = '%f' max = '%f' mean = '%f' std_deviatinon = '%f' generator = '%d' seed = '%ld' radical = '%s'",
-//        random_id, random->min, random->max, random->mean, random->std,
-//        (int)random->generator, random->seed, random_radical);
-
-//   if (!random_value)
-//     random_value = xbt_dict_new_homogeneous(free);
-
-//   if (!strcmp(random_radical, "")) {
-//     res = random_generate(random);
-//     rd_value = bprintf("%f", res);
-//     xbt_dict_set(random_value, random_id, rd_value, NULL);
-//   } else {
-//     radical_elements = xbt_str_split(random_radical, ",");
-//     xbt_dynar_foreach(radical_elements, iter, groups) {
-//       radical_ends = xbt_str_split(groups, "-");
-//       switch (xbt_dynar_length(radical_ends)) {
-//       case 1:
-//         xbt_assert(!xbt_dict_get_or_null(random_value, random_id),
-//                    "Custom Random '%s' already exists !", random_id);
-//         res = random_generate(random);
-//         tmpbuf =
-//             bprintf("%s%d", random_id,
-//                     atoi(xbt_dynar_getfirst_as(radical_ends, char *)));
-//         xbt_dict_set(random_value, tmpbuf, bprintf("%f", res), NULL);
-//         xbt_free(tmpbuf);
-//         break;
-
-//       case 2:
-//         start = surf_parse_get_int(xbt_dynar_get_as(radical_ends, 0, char *));
-//         end = surf_parse_get_int(xbt_dynar_get_as(radical_ends, 1, char *));
-//         for (i = start; i <= end; i++) {
-//           xbt_assert(!xbt_dict_get_or_null(random_value, random_id),
-//                      "Custom Random '%s' already exists !", bprintf("%s%d",
-//                                                                     random_id,
-//                                                                     i));
-//           res = random_generate(random);
-//           tmpbuf = bprintf("%s%d", random_id, i);
-//           xbt_dict_set(random_value, tmpbuf, bprintf("%f", res), NULL);
-//           xbt_free(tmpbuf);
-//         }
-//         break;
-//       default:
-//         XBT_CRITICAL("Malformed radical");
-//         break;
-//       }
-//       res = random_generate(random);
-//       rd_name = bprintf("%s_router", random_id);
-//       rd_value = bprintf("%f", res);
-//       xbt_dict_set(random_value, rd_name, rd_value, NULL);
-
-//       xbt_dynar_free(&radical_ends);
-//     }
-//     free(rd_name);
-//     xbt_dynar_free(&radical_elements);
-//   }
-// }
-
 static void check_disk_attachment()
 {
   xbt_lib_cursor_t cursor;
@@ -870,26 +742,6 @@ void routing_register_callbacks()
   instr_routing_define_callbacks();
 }
 
-/**
- * \brief Recursive function for finalize
- *
- * \param rc the source host name
- *
- * This fuction is call by "finalize". It allow to finalize the
- * AS or routing components. It delete all the structures.
- */
-static void finalize_rec(simgrid::surf::As *as) {
-  xbt_dict_cursor_t cursor = NULL;
-  char *key;
-  AS_t elem;
-
-  xbt_dict_foreach(as->sons_, cursor, key, elem) {
-    finalize_rec(elem);
-  }
-
-  delete as;;
-}
-
 /** \brief Frees all memory allocated by the routing module */
 void routing_exit(void) {
   delete routing_platf;
@@ -904,8 +756,7 @@ namespace surf {
   }
   RoutingPlatf::~RoutingPlatf()
   {
-    xbt_dynar_free(&lastRoute_);
-    finalize_rec(root_);
+    delete root_;
   }
 
 }
@@ -919,8 +770,7 @@ const char *surf_AS_get_name(simgrid::surf::As *as) {
   return as->name_;
 }
 
-static simgrid::surf::As *surf_AS_recursive_get_by_name(
-  simgrid::surf::As *current, const char * name)
+static simgrid::surf::As *surf_AS_recursive_get_by_name(simgrid::surf::As *current, const char * name)
 {
   xbt_dict_cursor_t cursor = NULL;
   char *key;
@@ -930,7 +780,7 @@ static simgrid::surf::As *surf_AS_recursive_get_by_name(
   if(!strcmp(current->name_, name))
     return current;
 
-  xbt_dict_foreach(current->sons_, cursor, key, elem) {
+  xbt_dict_foreach(current->children_, cursor, key, elem) {
     tmp = surf_AS_recursive_get_by_name(elem, name);
     if(tmp != NULL ) {
         break;
@@ -947,9 +797,9 @@ simgrid::surf::As *surf_AS_get_by_name(const char * name)
   return as;
 }
 
-xbt_dict_t surf_AS_get_routing_sons(simgrid::surf::As *as)
+xbt_dict_t surf_AS_get_children(simgrid::surf::As *as)
 {
-  return as->sons_;
+  return as->children_;
 }
 
 xbt_dynar_t surf_AS_get_hosts(simgrid::surf::As *as)
index 07afc8d..bd09517 100644 (file)
@@ -68,12 +68,12 @@ public:
   char *name_ = nullptr;
   NetCard *netcard_ = nullptr; // Our representative in the father AS
   As *father_ = nullptr;
-  xbt_dict_t sons_ = xbt_dict_new_homogeneous(NULL); // sub-ASes
+  xbt_dict_t children_ = xbt_dict_new_homogeneous(NULL); // sub-ASes
   xbt_dynar_t vertices_ = xbt_dynar_new(sizeof(char*),NULL); // our content, as known to our graph routing algorithm (maps vertexId -> vertex)
 
 private:
   bool sealed_ = false; // We cannot add more content when sealed
-  std::map<std::string, std::vector<Link*>*> *bypassRoutes_ = nullptr;
+  std::map<std::string, std::vector<Link*>*> bypassRoutes_;
 
 public:
   /**
@@ -140,7 +140,7 @@ private:
 };
 
 /** @ingroup SURF_routing_interface
- * @brief Link of lenght 1, alongside with its source and destination. This is mainly usefull in the ns3 bindings
+ * @brief Link of length 1, alongside with its source and destination. This is mainly useful in the ns3 bindings
  */
 class Onelink {
 public:
@@ -160,7 +160,6 @@ public:
   ~RoutingPlatf();
   As *root_ = nullptr;
   Link *loopback_;
-  xbt_dynar_t lastRoute_ = xbt_dynar_new(sizeof(Link*),NULL);
   xbt_dynar_t getOneLinkRoutes(void);
   void getRouteAndLatency(NetCard *src, NetCard *dst, std::vector<Link*> * links, double *latency);
 };
index 5c00da3..cd85779 100644 (file)
@@ -91,6 +91,36 @@ xbt_edge_t new_xbt_graph_edge(xbt_graph_t graph, xbt_node_t s, xbt_node_t d, xbt
 namespace simgrid {
 namespace surf {
 
+  xbt_dynar_t AsRoutedGraph::getOneLinkRoutes()
+  {
+    xbt_dynar_t ret = xbt_dynar_new(sizeof(Onelink*), xbt_free_f);
+    sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t,1);
+    route->link_list = new std::vector<Link*>();
+
+    int table_size = (int)xbt_dynar_length(vertices_);
+    for(int src=0; src < table_size; src++) {
+      for(int dst=0; dst< table_size; dst++) {
+        route->link_list->clear();
+        NetCard *src_elm = xbt_dynar_get_as(vertices_, src, NetCard*);
+        NetCard *dst_elm = xbt_dynar_get_as(vertices_, dst, NetCard*);
+        this->getRouteAndLatency(src_elm, dst_elm,route, NULL);
+
+        if (route->link_list->size() == 1) {
+          Link *link = route->link_list->at(0);
+          Onelink *onelink;
+          if (hierarchy_ == SURF_ROUTING_BASE)
+            onelink = new Onelink(link, src_elm, dst_elm);
+          else if (hierarchy_ == SURF_ROUTING_RECURSIVE)
+            onelink = new Onelink(link, route->gw_src, route->gw_dst);
+          else
+            onelink = new Onelink(link, NULL, NULL);
+          xbt_dynar_push(ret, &onelink);
+        }
+      }
+    }
+    return ret;
+  }
+
 void AsRoutedGraph::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)
 {
   int src, dst;
index 9d5c7db..5a2feac 100644 (file)
@@ -21,6 +21,8 @@ public:
   AsRoutedGraph(const char*name);
   ~AsRoutedGraph();
 
+  xbt_dynar_t getOneLinkRoutes() override;
+
   virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) override;
   virtual sg_platf_route_cbarg_t newExtendedRoute(e_surf_routing_hierarchy_t hierarchy, sg_platf_route_cbarg_t routearg, int change_order);
 protected:
index fcaac99..1c5c486 100644 (file)
@@ -138,36 +138,6 @@ void AsDijkstra::newRoute(int src_id, int dst_id, sg_platf_route_cbarg_t e_route
   xbt_graph_new_edge(routeGraph_, src, dst, e_route);
 }
 
-xbt_dynar_t AsDijkstra::getOneLinkRoutes()
-{
-  xbt_dynar_t ret = xbt_dynar_new(sizeof(Onelink*), xbt_free_f);
-  sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t,1);
-  route->link_list = new std::vector<Link*>();
-
-  int table_size = (int)xbt_dynar_length(vertices_);
-  for(int src=0; src < table_size; src++) {
-    for(int dst=0; dst< table_size; dst++) {
-      route->link_list->clear();
-      NetCard *src_elm = xbt_dynar_get_as(vertices_, src, NetCard*);
-      NetCard *dst_elm = xbt_dynar_get_as(vertices_, dst, NetCard*);
-      this->getRouteAndLatency(src_elm, dst_elm,route, NULL);
-
-      if (route->link_list->size() == 1) {
-        Link *link = route->link_list->at(0);
-        Onelink *onelink;
-        if (hierarchy_ == SURF_ROUTING_BASE)
-          onelink = new Onelink(link, src_elm, dst_elm);
-        else if (hierarchy_ == SURF_ROUTING_RECURSIVE)
-          onelink = new Onelink(link, route->gw_src, route->gw_dst);
-        else
-          onelink = new Onelink(link, NULL, NULL);
-        xbt_dynar_push(ret, &onelink);
-      }
-    }
-  }
-  return ret;
-}
-
 void AsDijkstra::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t route, double *lat)
 {
   getRouteCheckParams(src, dst);
index ae5e000..849c682 100644 (file)
@@ -57,8 +57,6 @@ public:
      * will have a loopback attached to it.
      */
   void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t route, double *lat) override;
-  void getRouteAndLatency(sg_platf_route_cbarg_t route, double *lat); // FIXME: this function is dangerously not overriding because of diverging prototype
-  xbt_dynar_t getOneLinkRoutes() override;
   void addRoute(sg_platf_route_cbarg_t route) override;
 
   xbt_graph_t routeGraph_ = nullptr;     /* xbt_graph */
index c902ac3..5bfe3df 100644 (file)
@@ -39,41 +39,8 @@ AsFloyd::~AsFloyd(){
   xbt_free(costTable_);
 }
 
-/* Business methods */
-xbt_dynar_t AsFloyd::getOneLinkRoutes()
-{
-  xbt_dynar_t ret = xbt_dynar_new(sizeof(Onelink*), xbt_free_f);
-  sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
-  route->link_list = new std::vector<Link*>();
-
-  int table_size = xbt_dynar_length(vertices_);
-  for(int src=0; src < table_size; src++) {
-    for(int dst=0; dst< table_size; dst++) {
-      route->link_list->clear();
-      NetCard *src_elm = xbt_dynar_get_as(vertices_, src, NetCard*);
-      NetCard *dst_elm = xbt_dynar_get_as(vertices_, dst, NetCard*);
-      this->getRouteAndLatency(src_elm, dst_elm, route, NULL);
-
-      if (route->link_list->size() == 1) {
-        void *link = route->link_list->at(0);
-        Onelink *onelink;
-        if (hierarchy_ == SURF_ROUTING_BASE)
-          onelink = new Onelink(link, src_elm, dst_elm);
-        else if (hierarchy_ == SURF_ROUTING_RECURSIVE)
-          onelink = new Onelink(link, route->gw_src, route->gw_dst);
-        else
-          onelink = new Onelink(link, NULL, NULL);
-        xbt_dynar_push(ret, &onelink);
-      }
-    }
-  }
-
-  return ret;
-}
-
 void AsFloyd::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t route, double *lat)
 {
-
   size_t table_size = xbt_dynar_length(vertices_);
 
   getRouteCheckParams(src, dst);
index 67f1f6d..e5258f8 100644 (file)
@@ -27,7 +27,6 @@ public:
   ~AsFloyd();
 
   void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override;
-  xbt_dynar_t getOneLinkRoutes() override;
   void addRoute(sg_platf_route_cbarg_t route) override;
   void Seal() override;
 
index 7d52469..1180fe0 100644 (file)
@@ -61,48 +61,10 @@ AsFull::~AsFull(){
   }
 }
 
-xbt_dynar_t AsFull::getOneLinkRoutes()
-{
-  xbt_dynar_t ret = xbt_dynar_new(sizeof(Onelink*), xbt_free_f);
-
-  int src, dst;
-  int table_size = xbt_dynar_length(vertices_);
-
-  for(src=0; src < table_size; src++) {
-    for(dst=0; dst< table_size; dst++) {
-      sg_platf_route_cbarg_t route = TO_ROUTE_FULL(src,dst);
-      if (route) {
-        if (route->link_list->size() == 1) {
-          Link *link = route->link_list->at(0);
-          Onelink *onelink;
-          if (hierarchy_ == SURF_ROUTING_BASE) {
-          NetCard *tmp_src = xbt_dynar_get_as(vertices_, src, sg_netcard_t);
-            tmp_src->setId(src);
-          NetCard *tmp_dst = xbt_dynar_get_as(vertices_, dst, sg_netcard_t);
-          tmp_dst->setId(dst);
-            onelink = new Onelink(link, tmp_src, tmp_dst);
-          } else if (hierarchy_ == SURF_ROUTING_RECURSIVE)
-            onelink = new Onelink(link, route->gw_src, route->gw_dst);
-          else
-            onelink = new Onelink(link, NULL, NULL);
-          xbt_dynar_push(ret, &onelink);
-          XBT_DEBUG("Push route from '%d' to '%d'",
-              src,
-              dst);
-        }
-      }
-    }
-  }
-  return ret;
-}
-
 void AsFull::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t res, double *lat)
 {
   XBT_DEBUG("full_get_route_and_latency from %s[%d] to %s[%d]",
-      src->name(),
-      src->id(),
-      dst->name(),
-      dst->id());
+      src->name(), src->id(), dst->name(), dst->id());
 
   /* set utils vars */
   size_t table_size = xbt_dynar_length(vertices_);
index 30dd1cb..0abbae3 100644 (file)
@@ -28,7 +28,6 @@ public:
   ~AsFull();
 
   void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override;
-  xbt_dynar_t getOneLinkRoutes() override;
   void addRoute(sg_platf_route_cbarg_t route) override;
 
   sg_platf_route_cbarg_t *routingTable_ = nullptr;
index 3ab9c59..3795d69 100644 (file)
@@ -28,6 +28,7 @@ public:
   AsVivaldi(const char *name);
   ~AsVivaldi() {};
 
+  xbt_dynar_t getOneLinkRoutes() override {return NULL;};
   void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override;
 };
 
diff --git a/src/xbt/probes.h b/src/xbt/probes.h
deleted file mode 100644 (file)
index 187e4cd..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Copyright (c) 2014. 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. */
-
-#ifdef USE_UST
-#  include <lttng/tracepoint.h>
-#  include "simgrid_ust.h"
-#  define XBT_TRACE0 tracepoint
-#  define XBT_TRACE1 tracepoint
-#  define XBT_TRACE2 tracepoint
-#  define XBT_TRACE3 tracepoint
-#  define XBT_TRACE4 tracepoint
-#  define XBT_TRACE5 tracepoint
-#  define XBT_TRACE6 tracepoint
-#  define XBT_TRACE7 tracepoint
-#  define XBT_TRACE8 tracepoint
-#  define XBT_TRACE9 tracepoint
-#  define XBT_TRACE10 tracepoint
-#  define XBT_TRACE11 tracepoint
-#  define XBT_TRACE12 tracepoint
-#elif USE_SDT
-#  include <sys/sdt.h>
-#  define XBT_TRACE0  DTRACE_PROBE0
-#  define XBT_TRACE1  DTRACE_PROBE1
-#  define XBT_TRACE2  DTRACE_PROBE2
-#  define XBT_TRACE3  DTRACE_PROBE3
-#  define XBT_TRACE4  DTRACE_PROBE4
-#  define XBT_TRACE5  DTRACE_PROBE5
-#  define XBT_TRACE6  DTRACE_PROBE6
-#  define XBT_TRACE7  DTRACE_PROBE7
-#  define XBT_TRACE8  DTRACE_PROBE8
-#  define XBT_TRACE9  DTRACE_PROBE9
-#  define XBT_TRACE10  DTRACE_PROBE10
-#  define XBT_TRACE11  DTRACE_PROBE11
-#  define XBT_TRACE12  DTRACE_PROBE12
-#else
-#  define XBT_TRACE0(...)
-#  define XBT_TRACE1(...)
-#  define XBT_TRACE2(...)
-#  define XBT_TRACE3(...)
-#  define XBT_TRACE4(...)
-#  define XBT_TRACE5(...)
-#  define XBT_TRACE6(...)
-#  define XBT_TRACE7(...)
-#  define XBT_TRACE8(...)
-#  define XBT_TRACE9(...)
-#  define XBT_TRACE10(...)
-#  define XBT_TRACE11(...)
-#  define XBT_TRACE12(...)
-#endif
index a02f7d3..bc04b32 100644 (file)
@@ -17,7 +17,6 @@ set(EXTRA_DIST
   src/include/xbt/wine_dbghelp.h
   src/msg/msg_private.h
   src/portable.h
-  src/probes.tp
   src/simdag/dax.dtd
   src/simdag/dax_dtd.c
   src/simdag/dax_dtd.h
@@ -108,7 +107,6 @@ set(EXTRA_DIST
   src/xbt/mmalloc/mmorecore.c
   src/xbt/mmalloc/mmprivate.h
   src/xbt/mmalloc/mrealloc.c
-  src/xbt/probes.h
   src/xbt/win32_ucontext.c
   tools/tesh/generate_tesh
   tools/lualib.patch
@@ -1144,7 +1142,6 @@ set(CMAKE_SOURCE_FILES
   tools/cmake/Modules/FindLuaSimgrid.cmake
   tools/cmake/Modules/FindNS3.cmake
   tools/cmake/Modules/FindRngStream.cmake
-  tools/cmake/Modules/FindRubySimgrid.cmake
   tools/cmake/Modules/FindSimGrid.cmake
   tools/cmake/Modules/FindValgrind.cmake
   tools/cmake/Option.cmake
@@ -1251,23 +1248,6 @@ set(generated_src_files
   src/xbt/automaton/parserPromela.tab.hacc
   )
 
-if(enable_ust)
-  set(simgrid_sources ${CMAKE_CURRENT_BINARY_DIR}/src/simgrid_ust.c ${simgrid_sources})
-  ADD_CUSTOM_COMMAND(
-    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/src/simgrid_ust.c
-    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/src/simgrid_ust.h
-    COMMAND lttng-gen-tp -o simgrid_ust.c -o simgrid_ust.h ${CMAKE_CURRENT_SOURCE_DIR}/src/probes.tp
-    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/src/
-    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/probes.tp
-  )
-  ADD_CUSTOM_TARGET(simgrid_ust
-    DEPENDS
-      ${CMAKE_CURRENT_BINARY_DIR}/src/simgrid_ust.c
-      ${CMAKE_CURRENT_BINARY_DIR}/src/simgrid_ust.h
-    )
-  set(generated_src_files ${CMAKE_CURRENT_BINARY_DIR}/src/simgrid_ust.c ${generated_src_files})
-endif()
-
 foreach(file ${generated_src_files})
   set_source_files_properties(${file} PROPERTIES GENERATED true)
 endforeach(file ${generated_src_files})
index 995dd7f..91aa064 100644 (file)
@@ -8,10 +8,6 @@
 add_library(simgrid SHARED ${simgrid_sources})
 set_target_properties(simgrid PROPERTIES VERSION ${libsimgrid_version})
 
-if(enable_ust)
-  ADD_DEPENDENCIES(simgrid simgrid_ust)
-endif()
-
 add_dependencies(simgrid maintainer_files)
 
 if(enable_model-checking)
@@ -108,12 +104,6 @@ if(HAVE_BACKTRACE_IN_LIBEXECINFO)
   SET(SIMGRID_DEP "${SIMGRID_DEP} -lexecinfo")
 endif(HAVE_BACKTRACE_IN_LIBEXECINFO)
 
-# Dependencies from USR
-###################################
-if(enable_ust)
-  set(SIMGRID_DEP "${SIMGRID_DEP} -llttng-ust")
-endif()
-
 # Compute the dependencies of SMPI
 ##################################
 if(enable_smpi AND APPLE)
diff --git a/tools/cmake/Modules/FindRubySimgrid.cmake b/tools/cmake/Modules/FindRubySimgrid.cmake
deleted file mode 100644 (file)
index 9228fd8..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-include(FindRuby)
-
-if(RUBY_EXECUTABLE)
-  message(STATUS "Found ruby:  ${RUBY_EXECUTABLE}")
-endif()
-
-message(STATUS "Looking for ruby.h")
-if(RUBY_INCLUDE_DIR)
-  message(STATUS "Looking for ruby.h - found")
-else()
-  message(STATUS "Looking for ruby.h - not found")
-endif()
-
-message(STATUS "Looking for confi.h")
-if(RUBY_CONFIG_INCLUDE_DIR)
-  message(STATUS "Looking for config.h - found")
-else()
-  message(STATUS "Looking for config.h - not found")
-endif()
-
-message(STATUS "Looking for lib ruby")
-if(RUBY_LIBRARY)
-  message(STATUS "Looking for lib ruby - found")
-else()
-  message(STATUS "Looking for lib ruby - not found")
-endif()
-
-if(RUBY_LIBRARY)
-  set(LIB_RUBY_VERSION "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.${RUBY_VERSION_PATCH}")
-  message(STATUS "Lib ruby version: ${LIB_RUBY_VERSION}")
-  if(RUBY_VERSION_MAJOR MATCHES "1" AND RUBY_VERSION_MINOR MATCHES "9")
-    string(REGEX MATCH "ruby.*[0-9]" RUBY_LIBRARY_NAME ${RUBY_LIBRARY})
-    if(NOT RUBY_LIBRARY_NAME)
-      set(RUBY_LIBRARY_NAME ruby)
-    endif()
-    string(REGEX REPLACE "/libruby.*$" "" RUBY_LIBRARY ${RUBY_LIBRARY})
-    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${RUBY_CONFIG_INCLUDE_DIR} ") #path to config.h
-    string(COMPARE EQUAL "${RUBY_INCLUDE_DIR}" "${RUBY_CONFIG_INCLUDE_DIR}" operation)
-    if(NOT operation)
-      SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${RUBY_INCLUDE_DIR} ") #path to ruby.h
-    endif()
-    ADD_DEFINITIONS("-I${CMAKE_HOME_DIRECTORY}/src/bindings/ruby -I${CMAKE_HOME_DIRECTORY}/src/simix")
-    SET(HAVE_RUBY 1)
-  else()
-    message(STATUS "Warning: Ruby bindings need version 1.9.x, but found version ${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.x")
-    SET(HAVE_RUBY 0)
-  endif()
-else()
-  SET(HAVE_RUBY 0)
-endif()
-
-if(NOT RUBY_EXECUTABLE)
-  message(STATUS "Warning: you are missing the ruby executable, so you can compile and build examples but can't execute them!")
-endif()
\ No newline at end of file
index 6b554a4..540753a 100644 (file)
@@ -19,16 +19,6 @@ option(enable_compile_warnings "Whether compilation warnings should be turned in
 option(enable_maintainer_mode "Whether flex and flexml files should be rebuilt." off)
 option(enable_tracing "Tracing simulations for visualization." on)
 option(enable_latency_bound_tracking "" off)
-
-option(enable_ust "Enable userspace static tracepoint (lttng-ust)." off)
-if(enable_sdt)
-  add_definitions(-DUSE_SDT)
-endif()
-  
-option(enable_sdt "Enable statically defined tracepoint (strace/systemtap)." off)
-if(enable_ust)
-  add_definitions(-DUSE_UST)
-endif()
     
 option(enable_coverage "Whether coverage should be enabled." off)
 mark_as_advanced(enable_coverage)
index 46446cb..1487401 100755 (executable)
@@ -1,59 +1,53 @@
-#!/usr/bin/env ruby
+#!/usr/bin/env python
 # Wrapper around the real `as` which adds filtering capabilities.
 
-require "tempfile"
-require "fileutils"
-
-def wrapped_as(argv)
-
-  args=[]
-  input=nil
-
-  i = 0
-  while i<argv.size
-    case argv[i]
-    when "-o", "-I"
-      args.push(argv[i])
-      args.push(argv[i+1])
-      i = i + 1
-    when /^-/
-      args.push(argv[i])
-    else
-      if input
-        exit 1
-      else
-        input = argv[i]
-      end
-    end
+import os
+import re
+import subprocess
+import sys
+import tempfile
+
+# Process the arguments:
+# * build the argument array for calling the real assembler;
+# * get the input file name.
+args = []
+input_filename = None
+args.append('as')
+i = 1
+while i < len(sys.argv):
+    if sys.argv[i] == '-o' or sys.argv[i] == '-I':
+        args.append(sys.argv[i])
+        if i + 1 >= len(sys.argv):
+            sys.stderr.write("Missing argument\n")
+            sys.exit(1)
+        args.append(sys.argv[i + 1])
+        i = i + 1
+    elif re.match('^-', sys.argv[i][0]):
+        args.append(sys.argv[i])
+    elif input_filename:
+        sys.stdout.write("Too many input files\n")
+        sys.exit(1)
+    else:
+        input_filename = sys.argv[i]
     i = i + 1
-  end
-
-  if input==nil
-    # We dont handle pipe yet:
-    exit 1
-  end
-
-  # Generate temp file
-  tempfile = Tempfile.new("as-filter")
-  tempfile.close
-  script = File.dirname($0) + "/clean-stack-filter"
-  unless system([script, script], 0 => input, 1 => tempfile.path)
-    status=$?.exitstatus
-    FileUtils.rm tempfile
-    exit status
-  end
-  args.push(tempfile.path)
-
-  # Call the real assembler:
-  res = system("as", *args)
-  status = if res != nil
-             $?.exitstatus
-           else
-             1
-           end
-  FileUtils.rm tempfile
-  exit status
-
-end
-
-wrapped_as(ARGV)
+if input_filename == None:
+    sys.stderr.write("Missing input file\n")
+    sys.exit(1)
+
+temp_file, temp_filename = tempfile.mkstemp(suffix=".s", prefix="as_wrapper")
+try:
+    # Generate temporary file with modified assembly code:
+    script_file = os.path.join(
+        os.path.dirname(sys.argv[0]), "clean-stack-filter")
+    input_file = os.open(input_filename, os.O_RDONLY)
+    status = subprocess.call([script_file], stdin=input_file, stdout=temp_file)
+    os.close(input_file)
+    if status != 0:
+        sys.stderr.write("Filtering the assembly code failed.\n")
+        sys.exit(status)
+
+    # Call the real assembler on this modified assembly code:
+    args.append(temp_filename)
+    sys.exit(subprocess.call(args))
+finally:
+    os.remove(temp_filename)