Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorPierre Veyre <pierre.veyre@cc.in2p3.fr>
Tue, 11 Mar 2014 12:35:19 +0000 (13:35 +0100)
committerPierre Veyre <pierre.veyre@cc.in2p3.fr>
Tue, 11 Mar 2014 12:35:19 +0000 (13:35 +0100)
17 files changed:
examples/msg/suspend/suspend.c
examples/msg/suspend/suspend.tesh
include/simgrid/simix.h
src/msg/msg_private.h
src/msg/msg_process.c
src/simix/smx_deployment.c
src/simix/smx_host.c
src/simix/smx_network.c
src/simix/smx_process.c
src/simix/smx_process_private.h
src/simix/smx_smurf.c
src/simix/smx_smurf_private.h
teshsuite/msg/CMakeLists.txt
teshsuite/msg/process.c
teshsuite/msg/process.tesh
teshsuite/msg/process_d.xml [moved from teshsuite/msg/process.xml with 75% similarity]
teshsuite/msg/process_p.xml [new file with mode: 0644]

index 1ce043b..b12fbf4 100644 (file)
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
                              "Messages specific for this msg example");
 
+#define SLEEP(duration)                                 \
+  if (MSG_process_sleep(duration) != MSG_OK)            \
+    xbt_die("What's going on??? I failed to sleep!");   \
+  else                                                  \
+    (void)0
+
 /** @addtogroup MSG_examples
  * 
  * - <b>suspend/suspend.c</b>: Demonstrates how to suspend and resume processes using @ref MSG_process_suspend and @ref MSG_process_resume.
@@ -23,6 +29,15 @@ static int lazy_guy(int argc, char *argv[])
   XBT_INFO("Nobody's watching me ? Let's go to sleep.");
   MSG_process_suspend(MSG_process_self());
   XBT_INFO("Uuuh ? Did somebody call me ?");
+
+  XBT_INFO("Going to sleep...");
+  SLEEP(10.0);
+  XBT_INFO("Mmm... waking up.");
+
+  XBT_INFO("Going to sleep one more time...");
+  SLEEP(10.0);
+  XBT_INFO("Waking up once for all!");
+
   XBT_INFO("Mmmh, goodbye now.");
   return 0;
 }                               /* end_of_lazy_guy */
@@ -36,9 +51,26 @@ static int dream_master(int argc, char *argv[])
   XBT_INFO("Let's create a lazy guy.");
   lazy = MSG_process_create("Lazy", lazy_guy, NULL, MSG_host_self());
   XBT_INFO("Let's wait a little bit...");
-  MSG_process_sleep(10.0);
+  SLEEP(10.0);
   XBT_INFO("Let's wake the lazy guy up! >:) BOOOOOUUUHHH!!!!");
   MSG_process_resume(lazy);
+
+  SLEEP(5.0);
+  XBT_INFO("Suspend the lazy guy while he's sleeping...");
+  MSG_process_suspend(lazy);
+  XBT_INFO("Let him finish his siesta.");
+  SLEEP(10.0);
+  XBT_INFO("Wake up, lazy guy!");
+  MSG_process_resume(lazy);
+
+  SLEEP(5.0);
+  XBT_INFO("Suspend again the lazy guy while he's sleeping...");
+  MSG_process_suspend(lazy);
+  XBT_INFO("This time, don't let him finish his siesta.");
+  SLEEP(2.0);
+  XBT_INFO("Wake up, lazy guy!");
+  MSG_process_resume(lazy);
+
   XBT_INFO("OK, goodbye now.");
   return 0;
 }                               /* end_of_dram_master */
index d6177b1..8a6014f 100644 (file)
@@ -7,8 +7,18 @@ $ $SG_TEST_EXENV suspend/suspend ${srcdir:=.}/msg_platform.xml ${srcdir:=.}/susp
 > [  0.000000] (1:dream_master@Jacquelin) Let's create a lazy guy.
 > [  0.000000] (1:dream_master@Jacquelin) Let's wait a little bit...
 > [  0.000000] (2:Lazy@Jacquelin) Nobody's watching me ? Let's go to sleep.
-> [ 10.000000] (0:@) Simulation time 10
 > [ 10.000000] (1:dream_master@Jacquelin) Let's wake the lazy guy up! >:) BOOOOOUUUHHH!!!!
-> [ 10.000000] (1:dream_master@Jacquelin) OK, goodbye now.
 > [ 10.000000] (2:Lazy@Jacquelin) Uuuh ? Did somebody call me ?
-> [ 10.000000] (2:Lazy@Jacquelin) Mmmh, goodbye now.
+> [ 10.000000] (2:Lazy@Jacquelin) Going to sleep...
+> [ 15.000000] (1:dream_master@Jacquelin) Suspend the lazy guy while he's sleeping...
+> [ 15.000000] (1:dream_master@Jacquelin) Let him finish his siesta.
+> [ 25.000000] (1:dream_master@Jacquelin) Wake up, lazy guy!
+> [ 25.000000] (2:Lazy@Jacquelin) Mmm... waking up.
+> [ 25.000000] (2:Lazy@Jacquelin) Going to sleep one more time...
+> [ 30.000000] (1:dream_master@Jacquelin) Suspend again the lazy guy while he's sleeping...
+> [ 30.000000] (1:dream_master@Jacquelin) This time, don't let him finish his siesta.
+> [ 32.000000] (1:dream_master@Jacquelin) Wake up, lazy guy!
+> [ 32.000000] (1:dream_master@Jacquelin) OK, goodbye now.
+> [ 35.000000] (0:@) Simulation time 35
+> [ 35.000000] (2:Lazy@Jacquelin) Waking up once for all!
+> [ 35.000000] (2:Lazy@Jacquelin) Mmmh, goodbye now.
index 623f761..da13e26 100644 (file)
@@ -110,7 +110,8 @@ typedef void (*smx_creation_func_t) ( /* process */ smx_process_t*,
                                       /* argc */ int,
                                       /* argv */ char**,
                                       /* props */ xbt_dict_t,
-                                      /* auto_restart */ int);
+                                      /* auto_restart */ int,
+                                      /* parent_process */ smx_process_t);
 
 
 /******************************* Networking ***********************************/
index 1d2eb8f..5644882 100644 (file)
@@ -146,8 +146,10 @@ void __MSG_file_destroy(msg_file_priv_t host);
 void MSG_process_cleanup_from_SIMIX(smx_process_t smx_proc);
 void MSG_process_create_from_SIMIX(smx_process_t *process, const char *name,
                                    xbt_main_func_t code, void *data,
-                                   const char *hostname, double kill_time,  int argc,
-                                   char **argv, xbt_dict_t properties, int auto_restart);
+                                   const char *hostname, double kill_time,
+                                   int argc, char **argv,
+                                   xbt_dict_t properties, int auto_restart,
+                                   smx_process_t parent_process);
 void MSG_comm_copy_data_from_SIMIX(smx_action_t comm, void* buff, size_t buff_size);
 
 void _MSG_action_init(void);
index 6fbe364..6a64e9d 100644 (file)
@@ -56,9 +56,11 @@ void MSG_process_cleanup_from_SIMIX(smx_process_t smx_proc)
 
 /* This function creates a MSG process. It has the prototype enforced by SIMIX_function_register_process_create */
 void MSG_process_create_from_SIMIX(smx_process_t* process, const char *name,
-                                    xbt_main_func_t code, void *data,
-                                    const char *hostname, double kill_time, int argc, char **argv,
-                                    xbt_dict_t properties, int auto_restart)
+                                   xbt_main_func_t code, void *data,
+                                   const char *hostname, double kill_time,
+                                   int argc, char **argv,
+                                   xbt_dict_t properties, int auto_restart,
+                                   smx_process_t parent_process)
 {
   msg_host_t host = MSG_get_host_by_name(hostname);
   msg_process_t p = MSG_process_create_with_environment(name, code, data,
index 894de3c..d1fcee1 100644 (file)
@@ -80,7 +80,7 @@ static void parse_process(sg_platf_process_cbarg_t process)
                                             process->argc,
                                             (char**)(process->argv),
                                             current_property_set,
-                                            auto_restart);
+                                            auto_restart, NULL);
     else
       simcall_process_create(&process_created, (char*)(process->argv)[0], parse_code, NULL, sg_host_name(host), kill_time, process->argc,
           (char**)process->argv, current_property_set,auto_restart);
index 40f3c73..83c4cf7 100644 (file)
@@ -53,7 +53,7 @@ void SIMIX_host_on(smx_host_t h)
   xbt_assert((host != NULL), "Invalid parameters");
 
   if (surf_resource_get_state(surf_workstation_resource_priv(h))==SURF_RESOURCE_OFF) {
-       surf_resource_set_state(surf_workstation_resource_priv(h), SURF_RESOURCE_ON);
+    surf_resource_set_state(surf_workstation_resource_priv(h), SURF_RESOURCE_ON);
     unsigned int cpt;
     smx_process_arg_t arg;
     xbt_dynar_foreach(host->boot_processes,cpt,arg) {
@@ -70,19 +70,19 @@ void SIMIX_host_on(smx_host_t h)
                                               arg->argc,
                                               arg->argv,
                                               arg->properties,
-                                              arg->auto_restart);
-      }
-      else {
+                                              arg->auto_restart,
+                                              NULL);
+      else {
         simcall_process_create(&process,
-                                              arg->argv[0],
-                                              arg->code,
-                                              NULL,
-                                              arg->hostname,
-                                              arg->kill_time,
-                                              arg->argc,
-                                              arg->argv,
-                                              arg->properties,
-                                              arg->auto_restart);
+                               arg->argv[0],
+                               arg->code,
+                               NULL,
+                               arg->hostname,
+                               arg->kill_time,
+                               arg->argc,
+                               arg->argv,
+                               arg->properties,
+                               arg->auto_restart);
       }
     }
   }
@@ -391,7 +391,8 @@ void SIMIX_host_restart_processes(smx_host_t host)
                                             arg->argc,
                                             arg->argv,
                                             arg->properties,
-                                            arg->auto_restart);
+                                            arg->auto_restart,
+                                            NULL);
     } else {
       simcall_process_create(&process,
                              arg->argv[0],
@@ -462,7 +463,7 @@ smx_action_t SIMIX_host_execute(const char *name,
     }
   }
 
-  XBT_DEBUG("Create execute action %p", action);
+  XBT_DEBUG("Create execute action %p: %s", action, action->name);
 
   return action;
 }
index 9797825..fc3f4b8 100644 (file)
@@ -361,7 +361,7 @@ void SIMIX_pre_comm_send(smx_simcall_t simcall, smx_rdv_t rdv,
   smx_action_t comm = SIMIX_comm_isend(simcall->issuer, rdv, task_size, rate,
                                       src_buff, src_buff_size, match_fun, NULL,
                                       data, 0);
-  simcall->mc_value = 0;
+  SIMCALL_SET_MC_VALUE(simcall, 0);
   SIMIX_pre_comm_wait(simcall, comm, timeout);
 }
 smx_action_t SIMIX_pre_comm_isend(smx_simcall_t simcall, smx_rdv_t rdv,
@@ -456,7 +456,7 @@ void SIMIX_pre_comm_recv(smx_simcall_t simcall, smx_rdv_t rdv,
 {
   smx_action_t comm = SIMIX_comm_irecv(simcall->issuer, rdv, dst_buff,
                                       dst_buff_size, match_fun, data, rate);
-  simcall->mc_value = 0;
+  SIMCALL_SET_MC_VALUE(simcall, 0);
   SIMIX_pre_comm_wait(simcall, comm, timeout);
 }
 
@@ -604,7 +604,7 @@ void SIMIX_pre_comm_wait(smx_simcall_t simcall, smx_action_t action, double time
   simcall->issuer->waiting_action = action;
 
   if (MC_is_active()) {
-    int idx = simcall->mc_value;
+    int idx = SIMCALL_GET_MC_VALUE(simcall);
     if (idx == 0) {
       action->state = SIMIX_DONE;
     } else {
@@ -668,7 +668,7 @@ void SIMIX_pre_comm_testany(smx_simcall_t simcall, xbt_dynar_t actions)
   simcall_comm_testany__set__result(simcall, -1);
 
   if (MC_is_active()){
-    int idx = simcall->mc_value;
+    int idx = SIMCALL_GET_MC_VALUE(simcall);
     if(idx == -1){
       SIMIX_simcall_answer(simcall);
     }else{
@@ -698,7 +698,7 @@ void SIMIX_pre_comm_waitany(smx_simcall_t simcall, xbt_dynar_t actions)
   unsigned int cursor = 0;
 
   if (MC_is_active()){
-    int idx = simcall->mc_value;
+    int idx = SIMCALL_GET_MC_VALUE(simcall);
     action = xbt_dynar_get_as(actions, idx, smx_action_t);
     xbt_fifo_push(action->simcalls, simcall);
     simcall_comm_waitany__set__result(simcall, idx);
index 0f70809..8378a66 100644 (file)
@@ -137,18 +137,12 @@ void SIMIX_create_maestro_process()
   /* Create maestro process and intilialize it */
   maestro = xbt_new0(s_smx_process_t, 1);
   maestro->pid = simix_process_maxpid++;
+  maestro->ppid = -1;
   maestro->name = (char *) "";
   maestro->running_ctx = xbt_new(xbt_running_ctx_t, 1);
   XBT_RUNNING_CTX_INITIALIZE(maestro->running_ctx);
   maestro->context = SIMIX_context_new(NULL, 0, NULL, NULL, maestro);
   maestro->simcall.issuer = maestro;
-
-  if (SIMIX_process_self()) {
-    maestro->ppid = SIMIX_process_get_PID(SIMIX_process_self());
-  } else {
-    maestro->ppid = -1;
-  }
-
   simix_global->maestro_process = maestro;
   return;
 }
@@ -185,17 +179,17 @@ void SIMIX_process_stop(smx_process_t arg) {
 smx_process_t SIMIX_process_create_from_wrapper(smx_process_arg_t args) {
 
   smx_process_t process;
-  simix_global->create_process_function(
-      &process,
-      args->name,
-      args->code,
-      args->data,
-      args->hostname,
-      args->kill_time,
-      args->argc,
-      args->argv,
-      args->properties,
-      args->auto_restart);
+  simix_global->create_process_function(&process,
+                                        args->name,
+                                        args->code,
+                                        args->data,
+                                        args->hostname,
+                                        args->kill_time,
+                                        args->argc,
+                                        args->argv,
+                                        args->properties,
+                                        args->auto_restart,
+                                        NULL);
   xbt_free(args);
   return process;
 }
@@ -211,9 +205,9 @@ void SIMIX_pre_process_create(smx_simcall_t simcall,
                           int argc, char **argv,
                           xbt_dict_t properties,
                           int auto_restart){
-  SIMIX_process_create_with_parent(process, name, code, data, hostname,
-                              kill_time, argc, argv, properties, auto_restart,
-                              simcall->issuer);
+  SIMIX_process_create(process, name, code, data, hostname,
+                       kill_time, argc, argv, properties, auto_restart,
+                       simcall->issuer);
 }
 /**
  * \brief Internal function to create a process.
@@ -232,21 +226,9 @@ void SIMIX_process_create(smx_process_t *process,
                           double kill_time,
                           int argc, char **argv,
                           xbt_dict_t properties,
-                          int auto_restart) {
-  SIMIX_process_create_with_parent(process, name, code, data, hostname,
-                                   kill_time, argc, argv, properties, auto_restart, NULL);
-}
-
-void SIMIX_process_create_with_parent(smx_process_t *process,
-                                 const char *name,
-                                 xbt_main_func_t code,
-                                 void *data,
-                                 const char *hostname,
-                                 double kill_time,
-                                 int argc, char **argv,
-                                 xbt_dict_t properties,
-                                 int auto_restart,
-                                 smx_process_t parent_process) {
+                          int auto_restart,
+                          smx_process_t parent_process)
+{
   *process = NULL;
   smx_host_t host = SIMIX_host_get_by_name(hostname);
 
@@ -760,7 +742,13 @@ void SIMIX_post_process_sleep(smx_action_t action)
     }
     simcall_process_sleep__set__result(simcall, state);
     simcall->issuer->waiting_action = NULL;
-    SIMIX_simcall_answer(simcall);
+    if (simcall->issuer->suspended) {
+      XBT_DEBUG("Wait! This process is suspended and can't wake up now.");
+      simcall->issuer->suspended = 0;
+      SIMIX_pre_process_suspend(simcall, simcall->issuer);
+    } else {
+      SIMIX_simcall_answer(simcall);
+    }
   }
 
   SIMIX_process_sleep_destroy(action);
@@ -784,6 +772,7 @@ void SIMIX_process_sleep_suspend(smx_action_t action)
 
 void SIMIX_process_sleep_resume(smx_action_t action)
 {
+  XBT_DEBUG("Action state is %d on process_sleep_resume.", action->state);
   xbt_assert(action->type == SIMIX_ACTION_SLEEP);
   surf_action_resume(action->sleep.surf_sleep);
 }
@@ -816,10 +805,11 @@ void SIMIX_process_yield(smx_process_t self)
     SIMIX_process_stop(self);
   }
 
-  if(self->suspended) {
+  if (self->suspended) {
+    XBT_DEBUG("Hey! I'm suspended.");
     xbt_assert(!self->doexception, "Gloups! This exception may be lost by subsequent calls.");
     self->suspended = 0;
-    SIMIX_process_suspend(self,self);
+    SIMIX_process_suspend(self, self);
   }
 
   if (self->doexception) {
@@ -962,19 +952,19 @@ smx_process_t SIMIX_process_restart(smx_process_t process, smx_process_t issuer)
                                           arg.argc,
                                           arg.argv,
                                           arg.properties,
-                                          arg.auto_restart);
-  }
-  else {
+                                          arg.auto_restart,
+                                          NULL);
+  else {
     simcall_process_create(&new_process,
-                                          arg.argv[0],
-                                          arg.code,
-                                          arg.data,
-                                          arg.hostname,
-                                          arg.kill_time,
-                                          arg.argc,
-                                          arg.argv,
-                                          arg.properties,
-                                          arg.auto_restart);
+                           arg.argv[0],
+                           arg.code,
+                           arg.data,
+                           arg.hostname,
+                           arg.kill_time,
+                           arg.argc,
+                           arg.argv,
+                           arg.properties,
+                           arg.auto_restart);
 
   }
   return new_process;
index 0d24943..eb269f9 100644 (file)
@@ -70,17 +70,8 @@ void SIMIX_process_create(smx_process_t *process,
                           double kill_time,
                           int argc, char **argv,
                           xbt_dict_t properties,
-                          int auto_restart);
-void SIMIX_process_create_with_parent(smx_process_t *process,
-                                 const char *name,
-                                 xbt_main_func_t code,
-                                 void *data,
-                                 const char *hostname,
-                                 double kill_time,
-                                 int argc, char **argv,
-                                 xbt_dict_t properties,
-                                 int auto_restart,
-                                 smx_process_t parent_process);
+                          int auto_restart,
+                          smx_process_t parent_process);
 void SIMIX_process_runall(void);
 void SIMIX_process_kill(smx_process_t process, smx_process_t issuer);
 void SIMIX_process_killall(smx_process_t issuer, int reset_pid);
index b76914f..515446b 100644 (file)
@@ -56,7 +56,7 @@ void SIMIX_simcall_answer(smx_simcall_t simcall)
 void SIMIX_simcall_pre(smx_simcall_t simcall, int value)
 {
   XBT_DEBUG("Handling simcall %p: %s", simcall, SIMIX_simcall_name(simcall->call));
-  simcall->mc_value = value;
+  SIMCALL_SET_MC_VALUE(simcall, value);
   if (simcall->issuer->context->iwannadie && simcall->call != SIMCALL_PROCESS_CLEANUP)
     return;
   switch (simcall->call) {
index f14c89d..dbd5f92 100644 (file)
@@ -58,7 +58,9 @@ union u_smx_scalar {
 typedef struct s_smx_simcall {
   e_smx_simcall_t call;
   smx_process_t issuer;
+#ifdef HAVE_MC
   int mc_value;
+#endif
   union u_smx_scalar args[10];
   union u_smx_scalar result;
   //FIXME: union u_smx_scalar retval;
@@ -72,6 +74,14 @@ typedef struct s_smx_simcall {
   };
 } s_smx_simcall_t, *smx_simcall_t;
 
+#if HAVE_MC
+#define SIMCALL_SET_MC_VALUE(simcall, value) ((simcall)->mc_value = (value))
+#define SIMCALL_GET_MC_VALUE(simcall) ((simcall)->mc_value)
+#else
+#define SIMCALL_SET_MC_VALUE(simcall, value) ((void)0)
+#define SIMCALL_GET_MC_VALUE(simcall) 0
+#endif
+
 #include "simcalls_generated_res_getter_setter.h"
 #include "simcalls_generated_args_getter_setter.h"
 
index 983748b..670d9dc 100644 (file)
@@ -23,32 +23,33 @@ endif()
 set(tesh_files
   ${tesh_files}
   ${CMAKE_CURRENT_SOURCE_DIR}/get_sender.tesh
-  ${CMAKE_CURRENT_SOURCE_DIR}/pid.tesh
   ${CMAKE_CURRENT_SOURCE_DIR}/host_on_off.tesh
-  ${CMAKE_CURRENT_SOURCE_DIR}/task_destroy_cancel.tesh
+  ${CMAKE_CURRENT_SOURCE_DIR}/pid.tesh
   ${CMAKE_CURRENT_SOURCE_DIR}/process.tesh
+  ${CMAKE_CURRENT_SOURCE_DIR}/task_destroy_cancel.tesh
   PARENT_SCOPE
   )
 set(xml_files
   ${xml_files}
   ${CMAKE_CURRENT_SOURCE_DIR}/get_sender_d.xml
   ${CMAKE_CURRENT_SOURCE_DIR}/get_sender_p.xml
-  ${CMAKE_CURRENT_SOURCE_DIR}/pid_d.xml
-  ${CMAKE_CURRENT_SOURCE_DIR}/pid_p.xml
   ${CMAKE_CURRENT_SOURCE_DIR}/host_on_off_d.xml
   ${CMAKE_CURRENT_SOURCE_DIR}/host_on_off_p.xml
+  ${CMAKE_CURRENT_SOURCE_DIR}/pid_d.xml
+  ${CMAKE_CURRENT_SOURCE_DIR}/pid_p.xml
+  ${CMAKE_CURRENT_SOURCE_DIR}/process_d.xml
+  ${CMAKE_CURRENT_SOURCE_DIR}/process_p.xml
   ${CMAKE_CURRENT_SOURCE_DIR}/task_destroy_cancel_d.xml
   ${CMAKE_CURRENT_SOURCE_DIR}/task_destroy_cancel_p.xml
-  ${CMAKE_CURRENT_SOURCE_DIR}/process.xml
   PARENT_SCOPE
   )
 set(teshsuite_src
   ${teshsuite_src}
   ${CMAKE_CURRENT_SOURCE_DIR}/get_sender.c
-  ${CMAKE_CURRENT_SOURCE_DIR}/pid.c
   ${CMAKE_CURRENT_SOURCE_DIR}/host_on_off.c
-  ${CMAKE_CURRENT_SOURCE_DIR}/task_destroy_cancel.c
+  ${CMAKE_CURRENT_SOURCE_DIR}/pid.c
   ${CMAKE_CURRENT_SOURCE_DIR}/process.c
+  ${CMAKE_CURRENT_SOURCE_DIR}/task_destroy_cancel.c
   PARENT_SCOPE
   )
 set(bin_files
index e01112b..e999b4b 100644 (file)
@@ -24,27 +24,30 @@ int master(int argc, char *argv[])
   msg_process_t process = NULL;
   MSG_process_sleep(1);
   xbt_swag_foreach(process, process_list) {
-       XBT_INFO("Process(pid=%d, ppid=%d, name=%s)", MSG_process_get_PID(process), MSG_process_get_PPID(process), MSG_process_get_name(process));
-    if (MSG_process_self_PID()!=MSG_process_get_PID(process))
+    XBT_INFO("Process(pid=%d, ppid=%d, name=%s)",
+             MSG_process_get_PID(process), MSG_process_get_PPID(process),
+             MSG_process_get_name(process));
+    if (MSG_process_self_PID() != MSG_process_get_PID(process))
       MSG_process_kill(process);
   }
-  process = MSG_process_create("slave from master", slave, NULL, MSG_host_self());
+  process = MSG_process_create("slave from master",
+                               slave, NULL, MSG_host_self());
   MSG_process_sleep(2);
 
   XBT_INFO("Suspend Process(pid=%d)", MSG_process_get_PID(process));
   MSG_process_suspend(process);
 
-  XBT_INFO("Process(pid=%d) is %ssuspended"
-                 ,MSG_process_get_PID(process)
-                 ,(MSG_process_is_suspended(process)) ? "" : "not ");
+  XBT_INFO("Process(pid=%d) is %ssuspended",
+           MSG_process_get_PID(process),
+           (MSG_process_is_suspended(process)) ? "" : "not ");
   MSG_process_sleep(2);
 
   XBT_INFO("Resume Process(pid=%d)", MSG_process_get_PID(process));
   MSG_process_resume(process);
 
-  XBT_INFO("Process(pid=%d) is %ssuspended"
-                 ,MSG_process_get_PID(process)
-                 ,(MSG_process_is_suspended(process)) ? "" : "not ");
+  XBT_INFO("Process(pid=%d) is %ssuspended",
+           MSG_process_get_PID(process),
+           (MSG_process_is_suspended(process)) ? "" : "not ");
   MSG_process_sleep(2);
   MSG_process_kill(process);
 
@@ -56,11 +59,12 @@ int master(int argc, char *argv[])
 int slave(int argc, char *argv[])
 {
   MSG_process_sleep(.5);
-  XBT_INFO("Slave started (PID:%d, PPID:%d)", MSG_process_self_PID(), MSG_process_self_PPID());
+  XBT_INFO("Slave started (PID:%d, PPID:%d)",
+           MSG_process_self_PID(), MSG_process_self_PPID());
   while(1){
-       XBT_INFO("Plop i am %ssuspended", (MSG_process_is_suspended(MSG_process_self())) ? "" : "not ");
+    XBT_INFO("Plop i am %ssuspended",
+             (MSG_process_is_suspended(MSG_process_self())) ? "" : "not ");
     MSG_process_sleep(1);
-    //MSG_process_suspend(MSG_process_self());
   }
   XBT_INFO("I'm done. See you!");
   return 0;
@@ -74,13 +78,13 @@ int main(int argc, char *argv[])
   const char *application_file;
 
   MSG_init(&argc, argv);
-  if (argc < 2) {
+  if (argc != 3) {
     printf("Usage: %s platform_file deployment_file\n", argv[0]);
     printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
     exit(1);
   }
   platform_file = argv[1];
-  application_file = argv[1];
+  application_file = argv[2];
 
   /* MSG_config("workstation/model","KCCFLN05"); */
   {                             /*  Simulation setting */
index 90a2575..728b65c 100644 (file)
@@ -1,5 +1,5 @@
 
-$ msg/process ${srcdir:=.}/msg/process.xml
+$ msg/process ${srcdir:=.}/msg/process_p.xml ${srcdir:=.}/msg/process_d.xml
 > [Tremblay:slave:(2) 0.500000] [msg_test/INFO] Slave started (PID:2, PPID:0)
 > [Tremblay:slave:(2) 0.500000] [msg_test/INFO] Plop i am not suspended
 > [Tremblay:master:(1) 1.000000] [msg_test/INFO] Process(pid=1, ppid=0, name=master)
@@ -11,7 +11,7 @@ $ msg/process ${srcdir:=.}/msg/process.xml
 > [Tremblay:master:(1) 3.000000] [msg_test/INFO] Process(pid=3) is suspended
 > [Tremblay:master:(1) 5.000000] [msg_test/INFO] Resume Process(pid=3)
 > [Tremblay:master:(1) 5.000000] [msg_test/INFO] Process(pid=3) is not suspended
-> [Tremblay:slave from master:(3) 5.500000] [msg_test/INFO] Plop i am not suspended
-> [Tremblay:slave from master:(3) 6.500000] [msg_test/INFO] Plop i am not suspended
+> [Tremblay:slave from master:(3) 5.000000] [msg_test/INFO] Plop i am not suspended
+> [Tremblay:slave from master:(3) 6.000000] [msg_test/INFO] Plop i am not suspended
 > [Tremblay:master:(1) 7.000000] [msg_test/INFO] Goodbye now!
 > [7.000000] [msg_test/INFO] Simulation time 7
similarity index 75%
rename from teshsuite/msg/process.xml
rename to teshsuite/msg/process_d.xml
index f0c3dae..ee058c5 100644 (file)
@@ -1,16 +1,11 @@
 <?xml version='1.0'?>
 <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 <platform version="3">
-  <!-- The hosts -->
-  <AS  id="AS0"  routing="Full">
-   <host id="Tremblay" power="98.095Mf"/>
-  </AS>
-
   <!-- The master process (with some arguments) -->
   <process host="Tremblay" function="master">
   </process>
-  
+
   <!-- The slave processes (with mailbox to listen on as argument) -->
   <process host="Tremblay" function="slave">
   </process>
- </platform>
\ No newline at end of file
+</platform>
\ No newline at end of file
diff --git a/teshsuite/msg/process_p.xml b/teshsuite/msg/process_p.xml
new file mode 100644 (file)
index 0000000..90e976a
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+<platform version="3">
+  <!-- The hosts -->
+  <AS  id="AS0"  routing="Full">
+   <host id="Tremblay" power="98.095Mf"/>
+  </AS>
+</platform>
\ No newline at end of file