Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
adding test example to trace process migration using the mask TRACE_PROCESS
authorschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 21 Apr 2010 08:38:08 +0000 (08:38 +0000)
committerschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 21 Apr 2010 08:38:08 +0000 (08:38 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7625 48e7efb5-ca39-0410-a469-dd3cf9ba447f

buildtools/Cmake/src/CMakeTest.txt
examples/msg/tracing/CMakeLists.txt
examples/msg/tracing/procmig-deploy.xml [new file with mode: 0644]
examples/msg/tracing/procmig.c [new file with mode: 0644]
examples/msg/tracing/procmig.tesh [new file with mode: 0644]

index 5447151..8bfb8f0 100644 (file)
@@ -135,6 +135,7 @@ ADD_TEST(msg-masterslave_cpu_ti     ${PROJECT_DIRECTORY}/tools/tesh/tesh --cd ${PROJ
 IF(HAVE_TRACING)
   ADD_TEST(tracing-ms ${PROJECT_DIRECTORY}/tools/tesh/tesh --cd ${PROJECT_DIRECTORY}/examples/msg tracing/ms.tesh)
   ADD_TEST(tracing-categories ${PROJECT_DIRECTORY}/tools/tesh/tesh --cd ${PROJECT_DIRECTORY}/examples/msg tracing/categories.tesh)
+  ADD_TEST(tracing-process-migration ${PROJECT_DIRECTORY}/tools/tesh/tesh --cd ${PROJECT_DIRECTORY}/examples/msg tracing/procmig.tesh)
 ENDIF(HAVE_TRACING)
 
 
index e5f6d7b..23663d9 100644 (file)
@@ -5,7 +5,9 @@ set(LIBRARY_OUTPUT_PATH "${PROJECT_DIRECTORY}/lib")
 
 add_executable(ms ${PROJECT_DIRECTORY}/examples/msg/tracing/ms.c)
 add_executable(categories ${PROJECT_DIRECTORY}/examples/msg/tracing/categories.c)
+add_executable(procmig ${PROJECT_DIRECTORY}/examples/msg/tracing/procmig.c)
 
 ### Add definitions for compile
 target_link_libraries(ms simgrid m -fprofile-arcs)
 target_link_libraries(categories simgrid m -fprofile-arcs)
+target_link_libraries(procmig simgrid m -fprofile-arcs)
diff --git a/examples/msg/tracing/procmig-deploy.xml b/examples/msg/tracing/procmig-deploy.xml
new file mode 100644 (file)
index 0000000..ff128dd
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "simgrid.dtd">
+<platform version="2">
+  <process host="Fafard" function="emigrant"/>
+</platform>
diff --git a/examples/msg/tracing/procmig.c b/examples/msg/tracing/procmig.c
new file mode 100644 (file)
index 0000000..e72866f
--- /dev/null
@@ -0,0 +1,78 @@
+/*     $Id$     */
+
+/* Copyright (c) 2009 The SimGrid team. All rights reserved.                */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "msg/msg.h"            /* core library */
+#include "xbt/sysdep.h"         /* calloc */
+
+/* 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");
+
+/** The guy we will move from host to host. It move alone and then is moved by policeman back  */
+static int emigrant(int argc, char *argv[])
+{
+  INFO0("Setting process category");
+  TRACE_msg_set_process_category (MSG_process_self(), "emigrant");
+  MSG_process_sleep (2);
+  INFO0("Migrating to Tremblay");
+  MSG_process_change_host(MSG_get_host_by_name("Tremblay"));
+  MSG_process_sleep (2);
+  INFO0("Migrating to Jupiter");
+  MSG_process_change_host(MSG_get_host_by_name("Jupiter"));
+  MSG_process_sleep (2);
+  INFO0("Migrating to Fafard");
+  MSG_process_change_host(MSG_get_host_by_name("Fafard"));
+  MSG_process_sleep (2);
+  INFO0("Migrating to Ginette");
+  MSG_process_change_host(MSG_get_host_by_name("Ginette"));
+  MSG_process_sleep (2);
+  INFO0("Migrating to Bourassa");
+  MSG_process_change_host(MSG_get_host_by_name("Bourassa"));
+  MSG_process_sleep (2);
+  return 0;
+}
+
+/** Main function */
+int main(int argc, char *argv[])
+{
+  MSG_error_t res = MSG_OK;
+
+  //starting the simulation trace
+  TRACE_start_with_mask ("procmig.trace", TRACE_PROCESS);
+  TRACE_category ("emigrant");
+
+  /* Argument checking */
+  MSG_global_init(&argc, argv);
+  if (argc < 3) {
+    CRITICAL1("Usage: %s platform_file deployment_file\n", argv[0]);
+    CRITICAL1("example: %s msg_platform.xml msg_deployment_suspend.xml\n",
+              argv[0]);
+    exit(1);
+  }
+
+  /* Simulation setting */
+  MSG_create_environment(argv[1]);
+
+  /* Application deployment */
+  MSG_function_register("emigrant", emigrant);
+  MSG_launch_application(argv[2]);
+
+  /* Run the simulation */
+  res = MSG_main();
+  INFO1("Simulation time %g", MSG_get_clock());
+  if (res == MSG_OK)
+    res = MSG_clean();
+
+  //ending the simulation trace
+  TRACE_end();
+
+  if (res == MSG_OK)
+    return 0;
+  else
+    return 1;
+}                               /* end_of_main */
diff --git a/examples/msg/tracing/procmig.tesh b/examples/msg/tracing/procmig.tesh
new file mode 100644 (file)
index 0000000..735cf09
--- /dev/null
@@ -0,0 +1,12 @@
+#! ./tesh
+
+p Tracing processes
+
+$ $SG_TEST_EXENV tracing/procmig$EXEEXT ${srcdir:=.}/tracing/platform.xml ${srcdir:=.}/tracing/procmig-deploy.xml
+> [Fafard:emigrant:(1) 0.000000] [msg_test/INFO] Setting process category
+> [Fafard:emigrant:(1) 2.000000] [msg_test/INFO] Migrating to Tremblay
+> [Tremblay:emigrant:(1) 4.000000] [msg_test/INFO] Migrating to Jupiter
+> [Jupiter:emigrant:(1) 6.000000] [msg_test/INFO] Migrating to Fafard
+> [Fafard:emigrant:(1) 8.000000] [msg_test/INFO] Migrating to Ginette
+> [Ginette:emigrant:(1) 10.000000] [msg_test/INFO] Migrating to Bourassa
+> [12.000000] [msg_test/INFO] Simulation time 12