Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 14 Apr 2016 07:06:07 +0000 (09:06 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 14 Apr 2016 07:06:07 +0000 (09:06 +0200)
doc/Doxyfile.in
examples/msg/process-kill/process-kill.c
examples/msg/process-kill/process-kill.tesh

index 6399984..982db2c 100644 (file)
@@ -702,6 +702,7 @@ INPUT +=                 @CMAKE_HOME_DIRECTORY@/examples/msg/app-pingpong/app-pi
                          @CMAKE_HOME_DIRECTORY@/examples/msg/icomms/peer2.c \
                          @CMAKE_HOME_DIRECTORY@/examples/msg/icomms/peer3.c \
                          @CMAKE_HOME_DIRECTORY@/examples/msg/process-suspend/process-suspend.c \
+                         @CMAKE_HOME_DIRECTORY@/examples/msg/process-kill/process-kill.c \
                          @CMAKE_HOME_DIRECTORY@/examples/msg/process-migration/process-migration.c \
                          @CMAKE_HOME_DIRECTORY@/examples/msg/task-priority/task-priority.c \
                          @CMAKE_HOME_DIRECTORY@/examples/msg/properties \
index d33e372..ed6c622 100644 (file)
@@ -6,31 +6,34 @@
 
 #include "simgrid/msg.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_process_kill, "Messages specific for this msg example");
+/** @addtogroup MSG_examples
+ *
+ *  - <b>Process Killing: process-kill/process-kill.c</b>. Processes can also be killed by another if needed thanks to
+ *    the @ref MSG_process_kill function.
+ */
 
 static int victim(int argc, char *argv[])
 {
   XBT_INFO("Hello!");
   XBT_INFO("Suspending myself");
-  MSG_process_suspend(MSG_process_self());
-  XBT_INFO("OK, OK. Let's work");
+  MSG_process_suspend(MSG_process_self()); /** - First suspend itself */
+  XBT_INFO("OK, OK. Let's work");          /** - Then is resumed and start to execute a task */
   MSG_task_execute(MSG_task_create("work", 1e9, 0, NULL));
-  XBT_INFO("Bye!");
+  XBT_INFO("Bye!");  /** - But will never reach the end of it */
   return 0;
 }
 
 static int killer(int argc, char *argv[])
 {
-  msg_process_t poor_victim = NULL;
-
-  XBT_INFO("Hello!");
-  poor_victim = MSG_process_create("victim", victim, NULL, MSG_host_by_name("Fafard"));
+  XBT_INFO("Hello!");         /** - First start a @ref victim process */
+  msg_process_t poor_victim = MSG_process_create("victim", victim, NULL, MSG_host_by_name("Fafard"));
   MSG_process_sleep(10.0);
 
-  XBT_INFO("Resume process");
+  XBT_INFO("Resume process"); /** - Resume it from its suspended state */
   MSG_process_resume(poor_victim);
 
-  XBT_INFO("Kill process");
+  XBT_INFO("Kill process");   /** - and then kill it */
   MSG_process_kill(poor_victim);
 
   XBT_INFO("OK, goodbye now.");
@@ -44,15 +47,14 @@ int main(int argc, char *argv[])
   MSG_init(&argc, argv);
   xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
 
-  MSG_create_environment(argv[1]);
-
+  MSG_create_environment(argv[1]);   /** - Load the platform description */
+  /** - Create and deploy @ref killer process */
   MSG_function_register("killer", killer);
   MSG_function_register("victim", victim);
   MSG_process_create("killer", killer, NULL, MSG_host_by_name("Tremblay"));
 
-  res = MSG_main();
+  res = MSG_main();                 /** - Run the simulation */
 
   XBT_INFO("Simulation time %g", MSG_get_clock());
-
   return res != MSG_OK;
 }
index 4aad9c1..44e14d3 100644 (file)
@@ -2,11 +2,11 @@
 
 p Testing a MSG_process_kill function
 
-$ $SG_TEST_EXENV ${bindir:=.}/process-kill ${srcdir:=.}/small_platform.xml --log=surf_maxmin.thres:error
-> [Tremblay:killer:(1) 0.000000] [msg_test/INFO] Hello!
-> [Fafard:victim:(2) 0.000000] [msg_test/INFO] Hello!
-> [Fafard:victim:(2) 0.000000] [msg_test/INFO] Suspending myself
-> [Tremblay:killer:(1) 10.000000] [msg_test/INFO] Resume process
-> [Tremblay:killer:(1) 10.000000] [msg_test/INFO] Kill process
-> [Tremblay:killer:(1) 10.000000] [msg_test/INFO] OK, goodbye now.
-> [10.000000] [msg_test/INFO] Simulation time 10
+$ $SG_TEST_EXENV ${bindir:=.}/process-kill ${srcdir:=.}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [  0.000000] (1:killer@Tremblay) Hello!
+> [  0.000000] (2:victim@Fafard) Hello!
+> [  0.000000] (2:victim@Fafard) Suspending myself
+> [ 10.000000] (1:killer@Tremblay) Resume process
+> [ 10.000000] (1:killer@Tremblay) Kill process
+> [ 10.000000] (1:killer@Tremblay) OK, goodbye now.
+> [ 10.000000] (0:maestro@) Simulation time 10