Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Export functions in SURF to indicate whether a link is shared or not.
[simgrid.git] / src / surf / workstation_ptask_L07.c
index ec0c05e..f69cb1e 100644 (file)
@@ -665,6 +665,10 @@ static double get_link_latency(const void *link)
   return ((link_L07_t) link)->lat_current;
 }
 
+static int link_shared(const void *link)
+{
+  return lmm_constraint_is_shared(((link_L07_t) link)->constraint);
+}
 
 /**************************************/
 /*** Resource Creation & Destruction **/
@@ -673,6 +677,7 @@ static double get_link_latency(const void *link)
 static void cpu_free(void *cpu)
 {
   free(((cpu_L07_t) cpu)->name);
+  xbt_dict_free(&(((cpu_L07_t)cpu)->properties));
   free(cpu);
 }
 
@@ -751,6 +756,7 @@ static void parse_cpu_init(void)
 static void link_free(void *nw_link)
 {
   free(((link_L07_t) nw_link)->name);
+  xbt_dict_free(&(((link_L07_t)nw_link)->properties));
   free(nw_link);
 }
 
@@ -868,8 +874,6 @@ static void parse_route_set_endpoints(void)
     dst_id = cpu_tmp->id;
 
   route_action = A_surfxml_route_action;
-
-  route_link_list = xbt_dynar_new(sizeof(char*), &xbt_free_ref);
 }
 
 static void parse_route_set_route(void)
@@ -938,8 +942,6 @@ static void add_route(void)
        }
        route_new(src_id, dst_id, link_list, nb_link);
    }
-
-   xbt_dict_free(&route_table);
 }
 
 static void add_traces(void) {   
@@ -1027,13 +1029,6 @@ static void add_traces(void) {
      }
    }
 */
-   xbt_dict_free(&trace_connect_list_host_avail);
-   xbt_dict_free(&trace_connect_list_power);
-   xbt_dict_free(&trace_connect_list_link_avail);
-   xbt_dict_free(&trace_connect_list_bandwidth);
-   xbt_dict_free(&trace_connect_list_latency);
-   
-   xbt_dict_free(&traces_set_list); 
 }
 
 static void define_callbacks(const char *file)
@@ -1041,25 +1036,12 @@ static void define_callbacks(const char *file)
   /* Adding callback functions */
   surf_parse_reset_parser();
   surfxml_add_callback(STag_surfxml_host_cb_list, &parse_cpu_init);
-  surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
   surfxml_add_callback(STag_surfxml_link_cb_list, &parse_link_init);
   surfxml_add_callback(STag_surfxml_route_cb_list, &parse_route_set_endpoints);
-  surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, &parse_route_elem);
   surfxml_add_callback(ETag_surfxml_route_cb_list, &parse_route_set_route);
-  surfxml_add_callback(STag_surfxml_platform_cb_list, &init_data);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_route);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_loopback);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_traces);
-  surfxml_add_callback(STag_surfxml_set_cb_list, &parse_sets);
-  surfxml_add_callback(STag_surfxml_route_c_multi_cb_list, &parse_route_multi_set_endpoints);
-  surfxml_add_callback(ETag_surfxml_route_c_multi_cb_list, &parse_route_multi_set_route);
-  surfxml_add_callback(STag_surfxml_foreach_cb_list, &parse_foreach);
-  surfxml_add_callback(STag_surfxml_cluster_cb_list, &parse_cluster);
-  surfxml_add_callback(STag_surfxml_trace_cb_list, &parse_trace_init);
-  surfxml_add_callback(ETag_surfxml_trace_cb_list, &parse_trace_finalize);
-  surfxml_add_callback(STag_surfxml_trace_c_connect_cb_list, &parse_trace_c_connect);
-  surfxml_add_callback(STag_surfxml_random_cb_list, &init_randomness);
-  surfxml_add_callback(ETag_surfxml_random_cb_list, &add_randomness);
 }
 
 
@@ -1145,6 +1127,8 @@ static void model_init_internal(void)
       get_link_bandwidth;
   surf_workstation_model->extension_public->get_link_latency =
       get_link_latency;
+  surf_workstation_model->extension_public->link_shared =
+      link_shared;
 
   surf_workstation_model->common_public->get_properties = get_properties;
 
@@ -1167,8 +1151,7 @@ void surf_workstation_model_init_ptask_L07(const char *filename)
   define_callbacks(filename);
 
   update_model_description(surf_workstation_model_description,
-                             surf_workstation_model_description_size,
-                             "ptask_L07",
-                             (surf_model_t) surf_workstation_model);
+                          "ptask_L07",
+                          (surf_model_t) surf_workstation_model);
   xbt_dynar_push(model_list, &surf_workstation_model);
 }