Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add limiter_link option to cluster tag, to add a pseudo-shared link, to limit bandwid...
authorAugustin Degomme <degomme@idpann.imag.fr>
Thu, 7 Mar 2013 09:48:22 +0000 (10:48 +0100)
committerAugustin Degomme <degomme@idpann.imag.fr>
Fri, 29 Mar 2013 09:47:40 +0000 (10:47 +0100)
include/simgrid/platf.h
include/surf/simgrid_dtd.h
src/include/surf/surfxml_parse_values.h
src/surf/simgrid.dtd
src/surf/surf_routing.c
src/surf/surf_routing_cluster.c
src/surf/surfxml_parse.c

index 49ad142..29e7606 100644 (file)
@@ -187,6 +187,7 @@ typedef struct s_sg_platf_cluster_cbarg {
   double lat;
   double bb_bw;
   double bb_lat;
+  double limiter_link;
   const char* router_id;
   e_surf_link_sharing_policy_t sharing_policy;
   e_surf_link_sharing_policy_t bb_sharing_policy;
index 00bea13..930d5bb 100644 (file)
@@ -304,6 +304,8 @@ typedef int AT_surfxml_random_std___deviation;
 #define AU_surfxml_random_std___deviation NULL
 typedef int AT_surfxml_cluster_core;
 #define AU_surfxml_cluster_core NULL
+typedef int AT_surfxml_cluster_limiter___link;
+#define AU_surfxml_cluster_limiter___link NULL
 typedef int AT_surfxml_host_state___file;
 #define AU_surfxml_host_state___file NULL
 typedef int AT_surfxml_route_dst;
@@ -632,6 +634,9 @@ XBT_PUBLIC_DATA(short int) surfxml_random_std___deviation_isset;
 XBT_PUBLIC_DATA(AT_surfxml_cluster_core) AX_surfxml_cluster_core;
 #define A_surfxml_cluster_core (surfxml_bufferstack + AX_surfxml_cluster_core)
 XBT_PUBLIC_DATA(short int) surfxml_cluster_core_isset;
+XBT_PUBLIC_DATA(AT_surfxml_cluster_limiter___link) AX_surfxml_cluster_limiter___link;
+#define A_surfxml_cluster_limiter___link (surfxml_bufferstack + AX_surfxml_cluster_limiter___link)
+XBT_PUBLIC_DATA(short int) surfxml_cluster_limiter___link_isset;
 XBT_PUBLIC_DATA(AT_surfxml_host_state___file) AX_surfxml_host_state___file;
 #define A_surfxml_host_state___file (surfxml_bufferstack + AX_surfxml_host_state___file)
 XBT_PUBLIC_DATA(short int) surfxml_host_state___file_isset;
index 0092095..389b67c 100644 (file)
@@ -12,6 +12,7 @@ typedef struct s_surf_parsing_link_up_down *surf_parsing_link_up_down_t;
 typedef struct s_surf_parsing_link_up_down {
   void* link_up;
   void* link_down;
+  void* limiter_link;
 } s_surf_parsing_link_up_down_t;
 
 #endif /* SURFXML_PARSE_VALUES_H_ */
index 9674277..067e4a4 100644 (file)
@@ -82,6 +82,7 @@
 <!ATTLIST cluster availability_file CDATA "">
 <!ATTLIST cluster state_file CDATA "">
 <!ATTLIST cluster router_id CDATA "">
+<!ATTLIST cluster limiter_link CDATA "">
 
 <!ELEMENT cabinet EMPTY>
 <!ATTLIST cabinet id CDATA #REQUIRED>
index 8e25069..32de839 100644 (file)
@@ -897,6 +897,28 @@ static void routing_parse_cluster(sg_platf_cluster_cbarg_t cluster)
         info.link_up = xbt_lib_get_or_null(link_lib, link_id, SURF_LINK_LEVEL);
         info.link_down = info.link_up;
       }
+      
+      if(cluster->limiter_link!=0){      
+        char *tmp_link = bprintf("%s_limiter", link_id);
+        XBT_DEBUG("<limiter\tid=\"%s\"\tbw=\"%f\"/>", tmp_link,
+                cluster->limiter_link);
+
+        
+        memset(&link, 0, sizeof(link));
+        link.id = tmp_link;
+        link.bandwidth = cluster->limiter_link;
+        link.latency = 0;
+        link.state = SURF_RESOURCE_ON;
+        link.policy = SURF_LINK_SHARED;
+        sg_platf_new_link(&link);
+         info.limiter_link =
+            xbt_lib_get_or_null(link_lib, tmp_link, SURF_LINK_LEVEL);
+        free(tmp_link);
+      }else{
+        info.limiter_link =NULL;
+      }
+      
+      
       xbt_dynar_push(current_routing->link_up_down_list,&info);
       xbt_free(link_id);
       xbt_free(host_id);
index f19670f..a3308da 100644 (file)
@@ -23,13 +23,16 @@ static void cluster_get_route_and_latency(AS_t as,
 {
 
   s_surf_parsing_link_up_down_t info;
-  XBT_DEBUG("cluster_get_route_and_latency from '%s'[%d] to '%s'[%d]",
+  XBT_VERB("cluster_get_route_and_latency from '%s'[%d] to '%s'[%d]",
             src->name, src->id, dst->name, dst->id);
 
   if (src->rc_type != SURF_NETWORK_ELEMENT_ROUTER) {    // No specific link for router
     info =
         xbt_dynar_get_as(as->link_up_down_list, src->id,
                          s_surf_parsing_link_up_down_t);
+    if (info.limiter_link)          // limiter for sender
+      xbt_dynar_push_as(route->link_list, void *, info.limiter_link);
+    
     if (info.link_up) {         // link up
       xbt_dynar_push_as(route->link_list, void *, info.link_up);
       if (lat)
@@ -58,6 +61,10 @@ static void cluster_get_route_and_latency(AS_t as,
             surf_network_model->extension.network.get_link_latency(info.
                                                                    link_down);
     }
+    
+    if (info.limiter_link)          // limiter for receiver
+      xbt_dynar_push_as(route->link_list, void *, info.limiter_link);
+    
   }
 }
 
index 18a6f49..64d6f7f 100644 (file)
@@ -348,6 +348,8 @@ void STag_surfxml_cluster(void){
     cluster.bb_bw = surf_parse_get_double(A_surfxml_cluster_bb___bw);
   if(strcmp(A_surfxml_cluster_bb___lat,""))
     cluster.bb_lat = surf_parse_get_double(A_surfxml_cluster_bb___lat);
+  if(strcmp(A_surfxml_cluster_limiter___link,""))
+    cluster.limiter_link = surf_parse_get_double(A_surfxml_cluster_limiter___link);
   cluster.router_id = A_surfxml_cluster_router___id;
 
   switch (AX_surfxml_cluster_sharing___policy) {