Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] categories declaration must be after environment creation
[simgrid.git] / examples / msg / tracing / procmig.c
index c9ebc99..e43c83c 100644 (file)
@@ -17,23 +17,23 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
 static int emigrant(int argc, char *argv[])
 {
   INFO0("Setting process category");
-  TRACE_msg_set_process_category (MSG_process_self(), "emigrant");
-  MSG_process_sleep (2);
+  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);
+  MSG_process_sleep(2);
   INFO0("Migrating to Jupiter");
   MSG_process_change_host(MSG_get_host_by_name("Jupiter"));
-  MSG_process_sleep (2);
+  MSG_process_sleep(2);
   INFO0("Migrating to Fafard");
   MSG_process_change_host(MSG_get_host_by_name("Fafard"));
-  MSG_process_sleep (2);
+  MSG_process_sleep(2);
   INFO0("Migrating to Ginette");
   MSG_process_change_host(MSG_get_host_by_name("Ginette"));
-  MSG_process_sleep (2);
+  MSG_process_sleep(2);
   INFO0("Migrating to Bourassa");
   MSG_process_change_host(MSG_get_host_by_name("Bourassa"));
-  MSG_process_sleep (2);
+  MSG_process_sleep(2);
   return 0;
 }
 
@@ -51,13 +51,12 @@ int main(int argc, char *argv[])
     exit(1);
   }
 
-  //starting the simulation trace
-  TRACE_start ();
-  TRACE_category ("emigrant");
-
   /* Simulation setting */
   MSG_create_environment(argv[1]);
 
+  /* declaring tracing category for the process (after environment creation) */
+  TRACE_category_with_color ("emigrant", "1 0 0");
+
   /* Application deployment */
   MSG_function_register("emigrant", emigrant);
   MSG_launch_application(argv[2]);
@@ -68,9 +67,6 @@ int main(int argc, char *argv[])
   if (res == MSG_OK)
     res = MSG_clean();
 
-  //ending the simulation trace
-  TRACE_end();
-
   if (res == MSG_OK)
     return 0;
   else