Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
properly closing host containers on simulation trace file
authorschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 13 Apr 2010 14:00:11 +0000 (14:00 +0000)
committerschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 13 Apr 2010 14:00:11 +0000 (14:00 +0000)
details:
- this fix the end time of trace files

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7548 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/instr/interface.c
src/instr/private.h
src/instr/surf_instr.c
src/msg/global.c

index 1c5cf1a..6e13062 100644 (file)
@@ -105,7 +105,6 @@ int TRACE_start_with_mask(const char *filename, int mask) {
 
 int TRACE_end() {
   if (!IS_TRACING) return 1;
-  __TRACE_surf_finalize();
   FILE *file = TRACE_paje_end();
   fclose (file);
   return 0;
index f79dca7..d537b55 100644 (file)
@@ -117,6 +117,8 @@ void TRACE_surf_link_set_latency (double date, char *resource, double latency);
 void TRACE_surf_routing_full_parse_end (char *link_name, int src, int dst);
 void TRACE_surf_missing_link (void);
 void TRACE_surf_define_host_id (const char *name, int host_id);
+void TRACE_msg_clean (void);
+
 //for tracing gtnets
 void TRACE_surf_gtnets_communicate (void *action, int src, int dst);
 int TRACE_surf_gtnets_get_src (void *action);
index d1e9b31..0660513 100644 (file)
@@ -22,6 +22,7 @@ static xbt_dict_t hosts_id;
 static xbt_dict_t created_links;
 static xbt_dict_t link_bandwidth;
 static xbt_dict_t link_latency;
+static xbt_dict_t host_containers;
 //static xbt_dict_t platform_variable_last_value; /* to control the amount of add/sub variables events*/
 //static xbt_dict_t platform_variable_last_time; /* to control the amount of add/sub variables events*/
 
@@ -43,6 +44,7 @@ void __TRACE_surf_init (void)
   link_bandwidth = xbt_dict_new();
   link_latency = xbt_dict_new();
   platform_variables = xbt_dict_new();
+  host_containers = xbt_dict_new();
 
   //platform_variable_last_value = xbt_dict_new();
   //platform_variable_last_time = xbt_dict_new();
@@ -299,7 +301,10 @@ void TRACE_surf_net_link_new (char *name, double bw, double lat)
 void TRACE_surf_cpu_new (char *name, double power)
 {
   if (!IS_TRACING) return;
-  if (IS_TRACING_PLATFORM) pajeCreateContainer (SIMIX_get_clock(), name, "HOST", "platform", name);
+  if (IS_TRACING_PLATFORM){
+       pajeCreateContainer (SIMIX_get_clock(), name, "HOST", "platform", name);
+       xbt_dict_set (host_containers, xbt_strdup(name), xbt_strdup("1"), xbt_free);
+  }
   __TRACE_surf_set_resource_variable (SIMIX_get_clock(), "power", name, power);
 }
 
@@ -414,4 +419,18 @@ void TRACE_surf_missing_link (void)
   THROW0(tracing_error, TRACE_ERROR_COMPLEX_ROUTES, "Tracing failed");
 }
 
+void TRACE_msg_clean (void)
+{
+  __TRACE_surf_finalize();
+
+  xbt_dict_cursor_t cursor = NULL;
+  unsigned int cursor_ar = 0;
+  char *key, *value;
+
+  /* get all host from host_containers */
+  xbt_dict_foreach(host_containers, cursor, key, value) {
+    if (IS_TRACING_PLATFORM) pajeDestroyContainer (MSG_get_clock(), "HOST", key);
+  }
+}
+
 #endif
index 9f23a8b..f49fac8 100644 (file)
@@ -183,6 +183,9 @@ MSG_error_t MSG_clean(void)
   m_host_t h = NULL;
   m_process_t p = NULL;
 
+#ifdef HAVE_TRACING
+  TRACE_msg_clean ();
+#endif
 
   while ((p = xbt_fifo_pop(msg_global->process_list))) {
     MSG_process_kill(p);