Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
do not search the cluster backbones again and again, store them in the right location
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 10 Nov 2011 21:38:52 +0000 (22:38 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 10 Nov 2011 21:38:58 +0000 (22:38 +0100)
On the poor tests I've done, it seems to give a non negligible
improvement on the goal example. Maybe 5-10%, but it's hard to say
right now.

src/surf/surf_routing.c
src/surf/surf_routing_cluster.c
src/surf/surf_routing_private.h

index 35e71ac..4514283 100644 (file)
@@ -927,12 +927,7 @@ static void routing_parse_cluster(void)
 
     sg_platf_new_link(&link);
 
-    surf_parsing_link_up_down_t info =
-        xbt_new0(s_surf_parsing_link_up_down_t, 1);
-    info->link_up =
-        xbt_lib_get_or_null(link_lib, link_backbone, SURF_LINK_LEVEL);
-    info->link_down = info->link_up;
-    surf_routing_cluster_add_link(struct_cluster->id, info);
+    surf_routing_cluster_add_backbone(current_routing, xbt_lib_get_or_null(link_lib, link_backbone, SURF_LINK_LEVEL));
 
     free(link_backbone);
   }
index 2ea9e51..883b887 100644 (file)
@@ -14,6 +14,12 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf"
  * Note that a router is created, easing the interconnexion with the rest of the world.
  */
 
+typedef struct {
+  s_as_t generic_routing;
+  void *backbone;
+} s_as_cluster_t, *as_cluster_t;
+
+
 static xbt_dict_t cluster_host_link = NULL;
 
 /* Business methods */
@@ -28,8 +34,8 @@ static route_extended_t cluster_get_route(AS_t as,
          info = xbt_dict_get_or_null(cluster_host_link,src);
          if(info) xbt_dynar_push_as(links_list,void*,info->link_up); //link_up
 
-         info = xbt_dict_get_or_null(cluster_host_link,as->name);
-         if(info)  xbt_dynar_push_as(links_list,void*,info->link_up); //link_bb
+         if ( ((as_cluster_t)as)->backbone )
+           xbt_dynar_push_as(links_list,void*, ((as_cluster_t)as)->backbone) ;
 
          info = xbt_dict_get_or_null(cluster_host_link,dst);
          if(info) xbt_dynar_push_as(links_list,void*,info->link_down); //link_down
@@ -48,7 +54,7 @@ static void model_cluster_finalize(AS_t as) {
 /* Creation routing model functions */
 AS_t model_cluster_create(void)
 {
-  AS_t result = model_none_create();
+  AS_t result = model_none_create_sized(sizeof(s_as_cluster_t));
   result->get_route = cluster_get_route;
   result->finalize = model_cluster_finalize;
 
@@ -61,3 +67,7 @@ void surf_routing_cluster_add_link(const char* host_id,surf_parsing_link_up_down
 
  xbt_dict_set(cluster_host_link,host_id,info,xbt_free);
 }
+
+void surf_routing_cluster_add_backbone(AS_t as, void* bb) {
+  ((as_cluster_t)as)->backbone = bb;
+}
index e11316e..c12b6e3 100644 (file)
@@ -78,7 +78,9 @@ AS_t model_rulebased_create(void);      /* create structures for rulebased routi
 /* **************  Cluster ROUTING   **************** */
 AS_t model_cluster_create(void);      /* create structures for cluster routing model */
 
+/* Pass info from the cluster parser to the cluster routing */
 void surf_routing_cluster_add_link(const char* host_id,surf_parsing_link_up_down_t info);
+void surf_routing_cluster_add_backbone(AS_t as, void* bb);
 
 /* ************************************************** */
 /* **************  Vivaldi ROUTING   **************** */