Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Do not request status if not requested by caller.
[simgrid.git] / src / msg / m_process.c
index 2af1ec4..cfdd557 100644 (file)
@@ -1,8 +1,5 @@
-/*     $Id$      */
-
-/* Copyright (c) 2002-2007 Arnaud Legrand.                                  */
-/* Copyright (c) 2007 Bruno Donassolo.                                      */
-/* All rights reserved.                                                     */
+/* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. 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. */
@@ -34,6 +31,9 @@ void __MSG_process_cleanup(void *arg)
 {
   /* arg is a pointer to a simix process, we can get the msg process with the field data */
   m_process_t proc = ((smx_process_t) arg)->data;
+#ifdef HAVE_TRACING
+  TRACE_msg_process_end(proc);
+#endif
   xbt_fifo_remove(msg_global->process_list, proc);
   SIMIX_process_cleanup(arg);
   if (proc->name) {
@@ -56,8 +56,9 @@ void *_MSG_process_create_from_SIMIX(const char *name,
                                      xbt_dict_t properties)
 {
   m_host_t host = MSG_get_host_by_name(hostname);
-  return (void *) MSG_process_create_with_environment(name, code, data, host,
-                                                      argc, argv, properties);
+  return (void *) MSG_process_create_with_environment(name, code, data,
+                                                      host, argc, argv,
+                                                      properties);
 }
 
 /** \ingroup m_process_management
@@ -185,6 +186,9 @@ m_process_t MSG_process_create_with_environment(const char *name,
 
 void _MSG_process_kill_from_SIMIX(void *p)
 {
+#ifdef HAVE_TRACING
+  TRACE_msg_process_kill((m_process_t) p);
+#endif
   MSG_process_kill((m_process_t) p);
 }
 
@@ -197,19 +201,23 @@ void MSG_process_kill(m_process_t process)
 {
   simdata_process_t p_simdata = process->simdata;
 
+#ifdef HAVE_TRACING
+  TRACE_msg_process_kill(process);
+#endif
+
   DEBUG3("Killing %s(%d) on %s",
          process->name, p_simdata->PID, p_simdata->m_host->name);
 
   if (p_simdata->waiting_task && p_simdata->waiting_task->simdata->comm) {
-      SIMIX_communication_cancel(p_simdata->waiting_task->simdata->comm);
+    SIMIX_communication_cancel(p_simdata->waiting_task->simdata->comm);
   }
+
   if (p_simdata->waiting_action) {
     DEBUG1("Canceling waiting task %s",
            SIMIX_action_get_name(p_simdata->waiting_action));
     SIMIX_action_cancel(p_simdata->waiting_action);
-   }
-  
+  }
+
   xbt_fifo_remove(msg_global->process_list, process);
   SIMIX_process_kill(process->simdata->s_process);
 
@@ -227,6 +235,9 @@ MSG_error_t MSG_process_change_host(m_host_t host)
   m_process_t process = MSG_process_self();
   m_host_t now = process->simdata->m_host;
   process->simdata->m_host = host;
+#ifdef HAVE_TRACING
+  TRACE_msg_process_change_host(process, now, host);
+#endif
   SIMIX_process_change_host(process->simdata->s_process, now->name,
                             host->name);
   return MSG_OK;
@@ -417,6 +428,10 @@ MSG_error_t MSG_process_suspend(m_process_t process)
                && (process->simdata)), "Invalid parameters");
   CHECK_HOST();
 
+#ifdef HAVE_TRACING
+  TRACE_msg_process_suspend(process);
+#endif
+
   SIMIX_process_suspend(process->simdata->s_process);
   MSG_RETURN(MSG_OK);
 }
@@ -434,6 +449,10 @@ MSG_error_t MSG_process_resume(m_process_t process)
                && (process->simdata)), "Invalid parameters");
   CHECK_HOST();
 
+#ifdef HAVE_TRACING
+  TRACE_msg_process_resume(process);
+#endif
+
   SIMIX_process_resume(process->simdata->s_process);
   MSG_RETURN(MSG_OK);
 }