Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix copyright headers
[simgrid.git] / src / instr / msg_process_instr.c
index 2b3bfe1..86875a4 100644 (file)
@@ -1,14 +1,8 @@
-/*
- * msg_process_instr.c
- *
- *  Created on: Feb 24, 2010
- *      Author: Lucas Schnorr
- *     License: 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.
- *
- *     Copyright (c) 2009 The SimGrid team.
- */
+/* Copyright (c) 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. */
 
 #include "instr/private.h"
 
@@ -21,9 +15,10 @@ void __TRACE_msg_process_init (void)
   process_containers = xbt_dict_new();
 }
 
-//return 1 if presence must be updated
-int __TRACE_msg_process_location (m_process_t process)
+void __TRACE_msg_process_location (m_process_t process)
 {
+  if (!(IS_TRACING_PROCESSES || IS_TRACING_VOLUME)) return;
+
   char name[200], alias[200];
   m_host_t host = MSG_process_get_host (process);
   TRACE_process_container (process, name, 200);
@@ -31,15 +26,23 @@ int __TRACE_msg_process_location (m_process_t process)
 
   //check if process_alias container is already created
   if (!xbt_dict_get_or_null (process_containers, alias)){
-    if (IS_TRACING_PROCESSES) pajeCreateContainer (MSG_get_clock(), alias, "PROCESS", MSG_host_get_name(host), name);
-    if (IS_TRACING_PROCESSES) pajePushState (MSG_get_clock(), "presence", alias, "presence");
+    pajeCreateContainer (MSG_get_clock(), alias, "PROCESS", MSG_host_get_name(host), name);
+    if (IS_TRACING_PROCESSES) pajeSetState (MSG_get_clock(), "category", alias, process->category);
     xbt_dict_set (process_containers, xbt_strdup(alias), xbt_strdup("1"), xbt_free);
-    return 0;
-  }else{
-    return 1;
   }
 }
 
+void __TRACE_msg_process_present (m_process_t process)
+{
+  if (!IS_TRACING_PROCESSES) return;
+
+  //updating presence state of this process location
+  char alias[200];
+  m_host_t host = MSG_process_get_host (process);
+  TRACE_process_alias_container (process, host, alias, 200);
+  pajePushState (MSG_get_clock(), "presence", alias, "presence");
+}
+
 /*
  * TRACE_msg_set_process_category: tracing interface function
  */
@@ -53,6 +56,7 @@ void TRACE_msg_set_process_category (m_process_t process, const char *category)
 
   //create container of type "PROCESS" to indicate location
   __TRACE_msg_process_location (process);
+  __TRACE_msg_process_present (process);
 
   //create container of type "process" to indicate behavior
   char name[200];
@@ -66,16 +70,15 @@ void TRACE_msg_set_process_category (m_process_t process, const char *category)
  */
 void TRACE_msg_process_change_host (m_process_t process, m_host_t old_host, m_host_t new_host)
 {
-  if (!IS_TRACING_PROCESSES || !IS_TRACED(process)) return;
+  if (!(IS_TRACING_PROCESSES || IS_TRACING_VOLUME) || !IS_TRACED(process)) return;
 
+  //disabling presence in old_host (__TRACE_msg_process_not_present)
   char alias[200];
   TRACE_process_alias_container (process, old_host, alias, 200);
   if (IS_TRACING_PROCESSES) pajePopState (MSG_get_clock(), "presence", alias);
 
-  if (__TRACE_msg_process_location (process)) {
-     TRACE_process_alias_container (process, new_host, alias, 200);
-     if (IS_TRACING_PROCESSES) pajePushState (MSG_get_clock(), "presence", alias, "presence");
-  }
+  __TRACE_msg_process_location (process);
+  __TRACE_msg_process_present (process);
 }
 
 void TRACE_msg_process_kill (m_process_t process)