Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] debug messages for tracing data structures (creation and destruction)
[simgrid.git] / src / instr / instr_routing.c
index 9c38de1..8113389 100644 (file)
@@ -17,31 +17,6 @@ extern xbt_dict_t defined_types; /* from instr_interface.c */
 static int platform_created = 0;            /* indicate whether the platform file has been traced */
 static xbt_dynar_t currentContainer = NULL; /* push and pop, used only in creation */
 
-static void instr_routing_parse_start_AS (void);
-static void instr_routing_parse_end_AS (void);
-static void instr_routing_parse_start_link (void);
-static void instr_routing_parse_end_link (void);
-static void instr_routing_parse_start_host (void);
-static void instr_routing_parse_end_host (void);
-static void instr_routing_parse_start_router (void);
-static void instr_routing_parse_end_router (void);
-static void instr_routing_parse_end_platform (void);
-
-void instr_routing_define_callbacks ()
-{
-  if (!TRACE_is_active())
-    return;
-  surfxml_add_callback(STag_surfxml_AS_cb_list, &instr_routing_parse_start_AS);
-  surfxml_add_callback(ETag_surfxml_AS_cb_list, &instr_routing_parse_end_AS);
-  surfxml_add_callback(STag_surfxml_link_cb_list, &instr_routing_parse_start_link);
-  surfxml_add_callback(ETag_surfxml_link_cb_list, &instr_routing_parse_end_link);
-  surfxml_add_callback(STag_surfxml_host_cb_list, &instr_routing_parse_start_host);
-  surfxml_add_callback(ETag_surfxml_host_cb_list, &instr_routing_parse_end_host);
-  surfxml_add_callback(STag_surfxml_router_cb_list, &instr_routing_parse_start_router);
-  surfxml_add_callback(ETag_surfxml_router_cb_list, &instr_routing_parse_end_router);
-  surfxml_add_callback(ETag_surfxml_platform_cb_list, &instr_routing_parse_end_platform);
-}
-
 static container_t findChild (container_t root, container_t a1)
 {
   if (root == a1) return root;
@@ -92,12 +67,15 @@ static void linkContainers (const char *a1, const char *a2)
   snprintf (link_typename, INSTR_DEFAULT_STR_SIZE, "%s-%s", a1_type->name, a2_type->name);
   type_t link_type = getLinkType (link_typename, container->type, a1_type, a2_type);
 
+  //register EDGE types for triva configuration
+  xbt_dict_set (trivaEdgeTypes, link_type->name, xbt_strdup("1"), xbt_free);
+
   //create the link
   static long long counter = 0;
   char key[INSTR_DEFAULT_STR_SIZE];
   snprintf (key, INSTR_DEFAULT_STR_SIZE, "%lld", counter++);
-  pajeStartLink(SIMIX_get_clock(), link_type->id, container->id, "G", a1_container->id, key);
-  pajeEndLink(SIMIX_get_clock(), link_type->id, container->id, "G", a2_container->id, key);
+  new_pajeStartLink(SIMIX_get_clock(), container, link_type, a1_container, "G", key);
+  new_pajeEndLink(SIMIX_get_clock(), container, link_type, a2_container, "G", key);
 }
 
 static void recursiveGraphExtraction (container_t container)
@@ -226,8 +204,8 @@ static void instr_routing_parse_start_link ()
 
   type_t bandwidth = getVariableType ("bandwidth", NULL, new->type);
   type_t latency = getVariableType ("latency", NULL, new->type);
-  pajeSetVariable (0, bandwidth->id, new->id, A_surfxml_link_bandwidth);
-  pajeSetVariable (0, latency->id, new->id, A_surfxml_link_latency);
+  new_pajeSetVariable (0, new, bandwidth, atof(A_surfxml_link_bandwidth));
+  new_pajeSetVariable (0, new, latency, atof(A_surfxml_link_latency));
   if (TRACE_uncategorized()){
     getVariableType ("bandwidth_used", "0.5 0.5 0.5", new->type);
   }
@@ -243,7 +221,7 @@ static void instr_routing_parse_start_host ()
   container_t new = newContainer (A_surfxml_host_id, INSTR_HOST, father);
 
   type_t power = getVariableType ("power", NULL, new->type);
-  pajeSetVariable (0, power->id, new->id, A_surfxml_host_power);
+  new_pajeSetVariable (0, new, power, atof(A_surfxml_host_power));
   if (TRACE_uncategorized()){
     getVariableType ("power_used", "0.5 0.5 0.5", new->type);
   }
@@ -291,65 +269,19 @@ static void instr_routing_parse_end_platform ()
   platform_created = 1;
 }
 
-/*
- * Support functions
- */
-int instr_link_is_traced (const char *name)
-{
-  if (getContainerByName(name)){
-    return 1;
-  } else {
-    return 0;
-  }
-}
-
-char *instr_variable_type (const char *name, const char *resource)
-{
-  container_t container = getContainerByName(resource);
-  xbt_dict_cursor_t cursor = NULL;
-  type_t type;
-  char *type_name;
-  xbt_dict_foreach(container->type->children, cursor, type_name, type) {
-    if (strcmp (name, type->name) == 0) return type->id;
-  }
-  return NULL;
-}
-
-char *instr_resource_type (const char *resource_name)
-{
-  return getContainerByName(resource_name)->id;
-}
-
-static void recursiveDestroyContainer (container_t container)
-{
-  xbt_dict_cursor_t cursor = NULL;
-  container_t child;
-  char *child_name;
-  xbt_dict_foreach(container->children, cursor, child_name, child) {
-    recursiveDestroyContainer (child);
-  }
-  destroyContainer (container);
-}
-
-static void recursiveDestroyType (type_t type)
-{
-  xbt_dict_cursor_t cursor = NULL;
-  type_t child;
-  char *child_name;
-  xbt_dict_foreach(type->children, cursor, child_name, child) {
-    recursiveDestroyType (child);
-  }
-  xbt_free (type->name);
-  xbt_free (type->id);
-  xbt_free (type->children);
-  xbt_free (type);
-  type = NULL;
-}
-
-void instr_destroy_platform ()
+void instr_routing_define_callbacks ()
 {
-  if (getRootContainer()) recursiveDestroyContainer (getRootContainer());
-  if (getRootType()) recursiveDestroyType (getRootType());
+  if (!TRACE_is_active())
+    return;
+  surfxml_add_callback(STag_surfxml_AS_cb_list, &instr_routing_parse_start_AS);
+  surfxml_add_callback(ETag_surfxml_AS_cb_list, &instr_routing_parse_end_AS);
+  surfxml_add_callback(STag_surfxml_link_cb_list, &instr_routing_parse_start_link);
+  surfxml_add_callback(ETag_surfxml_link_cb_list, &instr_routing_parse_end_link);
+  surfxml_add_callback(STag_surfxml_host_cb_list, &instr_routing_parse_start_host);
+  surfxml_add_callback(ETag_surfxml_host_cb_list, &instr_routing_parse_end_host);
+  surfxml_add_callback(STag_surfxml_router_cb_list, &instr_routing_parse_start_router);
+  surfxml_add_callback(ETag_surfxml_router_cb_list, &instr_routing_parse_end_router);
+  surfxml_add_callback(ETag_surfxml_platform_cb_list, &instr_routing_parse_end_platform);
 }
 
 /*