Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add V_cluster_availability_file and V_cluster_state_file to struct for cluster.
authorNavarrop <Pierre.Navarro@imag.fr>
Fri, 4 Nov 2011 12:17:15 +0000 (13:17 +0100)
committerNavarrop <Pierre.Navarro@imag.fr>
Fri, 4 Nov 2011 12:17:15 +0000 (13:17 +0100)
src/include/surf/surfxml_parse_values.h
src/surf/surf_routing.c
src/surf/surfxml_parse.c

index 9a5d9a9..a374e02 100644 (file)
@@ -47,6 +47,8 @@ typedef struct s_cluster {
        char* S_cluster_router_id;
        int V_cluster_sharing_policy;
        int V_cluster_bb_sharing_policy;
        char* S_cluster_router_id;
        int V_cluster_sharing_policy;
        int V_cluster_bb_sharing_policy;
+       char* V_cluster_availability_file;
+       char* V_cluster_state_file;
 } s_cluster_t;
 
 typedef struct s_router *router_t;
 } s_cluster_t;
 
 typedef struct s_router *router_t;
index 78866cf..8ff144c 100644 (file)
@@ -1508,10 +1508,9 @@ void routing_parse_Scluster(void)
 
   static int AX_ptr = 0;
   char *host_id, *groups, *link_id = NULL;
 
   static int AX_ptr = 0;
   char *host_id, *groups, *link_id = NULL;
-  char *availability_file = xbt_strdup(A_surfxml_cluster_availability_file);
-  char *state_file = xbt_strdup(A_surfxml_cluster_state_file);
 
 
-  if( !strcmp(A_surfxml_cluster_state_file,"") || !strcmp(A_surfxml_cluster_availability_file,"") ){
+  if( !strcmp(struct_cluster->V_cluster_availability_file,"")
+                 || !strcmp(struct_cluster->V_cluster_state_file,"") ){
          if(xbt_dict_size(patterns)==0)
                  patterns = xbt_dict_new();
 
          if(xbt_dict_size(patterns)==0)
                  patterns = xbt_dict_new();
 
@@ -1554,9 +1553,9 @@ void routing_parse_Scluster(void)
                XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%f\">", host_id, struct_cluster->S_cluster_power);
                struct_host = xbt_new0(s_hostSG_t, 1);
                struct_host->V_host_id = host_id;
                XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%f\">", host_id, struct_cluster->S_cluster_power);
                struct_host = xbt_new0(s_hostSG_t, 1);
                struct_host->V_host_id = host_id;
-               if(!strcmp(A_surfxml_cluster_availability_file,"")){
+               if(!strcmp(struct_cluster->V_cluster_availability_file,"")){
                  xbt_dict_set(patterns, "radical", bprintf("%d", start), xbt_free);
                  xbt_dict_set(patterns, "radical", bprintf("%d", start), xbt_free);
-                 char* tmp_availability_file = xbt_strdup(availability_file);
+                 char* tmp_availability_file = xbt_strdup(struct_cluster->V_cluster_availability_file);
                  xbt_str_varsubst(tmp_availability_file,patterns);
                  XBT_DEBUG("\tavailability_file=\"%s\"",tmp_availability_file);
                  struct_host->V_host_power_trace = tmgr_trace_new(tmp_availability_file);
                  xbt_str_varsubst(tmp_availability_file,patterns);
                  XBT_DEBUG("\tavailability_file=\"%s\"",tmp_availability_file);
                  struct_host->V_host_power_trace = tmgr_trace_new(tmp_availability_file);
@@ -1566,8 +1565,8 @@ void routing_parse_Scluster(void)
                {
                  XBT_DEBUG("\tavailability_file=\"\"");
                }
                {
                  XBT_DEBUG("\tavailability_file=\"\"");
                }
-               if(!strcmp(A_surfxml_cluster_state_file,"")){
-                 char *tmp_state_file = xbt_strdup(state_file);
+               if(!strcmp(struct_cluster->V_cluster_state_file,"")){
+                 char *tmp_state_file = xbt_strdup(struct_cluster->V_cluster_state_file);
                  xbt_str_varsubst(tmp_state_file,patterns);
                  XBT_DEBUG("\tstate_file=\"%s\"",tmp_state_file);
                  struct_host->V_host_state_trace = tmgr_trace_new(tmp_state_file);
                  xbt_str_varsubst(tmp_state_file,patterns);
                  XBT_DEBUG("\tstate_file=\"%s\"",tmp_state_file);
                  struct_host->V_host_state_trace = tmgr_trace_new(tmp_state_file);
@@ -1636,9 +1635,9 @@ void routing_parse_Scluster(void)
                XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%f\">", host_id, struct_cluster->S_cluster_power);
                struct_host = xbt_new0(s_hostSG_t, 1);
                struct_host->V_host_id = host_id;
                XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%f\">", host_id, struct_cluster->S_cluster_power);
                struct_host = xbt_new0(s_hostSG_t, 1);
                struct_host->V_host_id = host_id;
-               if(!strcmp(A_surfxml_cluster_availability_file,"")){
+               if(!strcmp(struct_cluster->V_cluster_availability_file,"")){
                  xbt_dict_set(patterns, "radical", bprintf("%d", i), xbt_free);
                  xbt_dict_set(patterns, "radical", bprintf("%d", i), xbt_free);
-                 char* tmp_availability_file = xbt_strdup(availability_file);
+                 char* tmp_availability_file = xbt_strdup(struct_cluster->V_cluster_availability_file);
                  xbt_str_varsubst(tmp_availability_file,patterns);
                  XBT_DEBUG("\tavailability_file=\"%s\"",tmp_availability_file);
                  struct_host->V_host_power_trace = tmgr_trace_new(tmp_availability_file);
                  xbt_str_varsubst(tmp_availability_file,patterns);
                  XBT_DEBUG("\tavailability_file=\"%s\"",tmp_availability_file);
                  struct_host->V_host_power_trace = tmgr_trace_new(tmp_availability_file);
@@ -1648,8 +1647,8 @@ void routing_parse_Scluster(void)
                {
                  XBT_DEBUG("\tavailability_file=\"\"");
                }
                {
                  XBT_DEBUG("\tavailability_file=\"\"");
                }
-               if(!strcmp(A_surfxml_cluster_state_file,"")){
-                 char *tmp_state_file = xbt_strdup(state_file);
+               if(!strcmp(struct_cluster->V_cluster_state_file,"")){
+                 char *tmp_state_file = xbt_strdup(struct_cluster->V_cluster_state_file);
                  xbt_str_varsubst(tmp_state_file,patterns);
                  XBT_DEBUG("\tstate_file=\"%s\"",tmp_state_file);
                  struct_host->V_host_state_trace = tmgr_trace_new(tmp_state_file);
                  xbt_str_varsubst(tmp_state_file,patterns);
                  XBT_DEBUG("\tstate_file=\"%s\"",tmp_state_file);
                  struct_host->V_host_state_trace = tmgr_trace_new(tmp_state_file);
@@ -1752,7 +1751,6 @@ void routing_parse_Scluster(void)
 
          STag_surfxml_link_cluster();
          ETag_surfxml_link();
 
          STag_surfxml_link_cluster();
          ETag_surfxml_link();
-//       free(link_backbone);
   }
 
   XBT_DEBUG(" ");
   }
 
   XBT_DEBUG(" ");
@@ -1770,10 +1768,9 @@ void routing_parse_Scluster(void)
 
   xbt_dynar_free(&radical_elements);
   xbt_free(new_suffix);
 
   xbt_dynar_free(&radical_elements);
   xbt_free(new_suffix);
-  xbt_free(availability_file);
-  xbt_free(state_file);
 
 
-  if( !strcmp(A_surfxml_cluster_state_file,"") || !strcmp(A_surfxml_cluster_availability_file,"") )
+  if( !strcmp(struct_cluster->V_cluster_availability_file,"")
+                 || !strcmp(struct_cluster->V_cluster_state_file,"") )
          xbt_dict_free(&patterns);
 
   XBT_DEBUG("</AS>");
          xbt_dict_free(&patterns);
 
   XBT_DEBUG("</AS>");
index c5e1479..1515934 100644 (file)
@@ -363,6 +363,9 @@ void STag_surfxml_cluster(void){
        struct_cluster->V_cluster_sharing_policy = AX_surfxml_cluster_sharing_policy;
        struct_cluster->V_cluster_bb_sharing_policy = AX_surfxml_cluster_bb_sharing_policy;
 
        struct_cluster->V_cluster_sharing_policy = AX_surfxml_cluster_sharing_policy;
        struct_cluster->V_cluster_bb_sharing_policy = AX_surfxml_cluster_bb_sharing_policy;
 
+       struct_cluster->V_cluster_availability_file = xbt_strdup(A_surfxml_cluster_availability_file);
+       struct_cluster->V_cluster_state_file = xbt_strdup(A_surfxml_cluster_state_file);
+
        surfxml_call_cb_functions(STag_surfxml_cluster_cb_list);
 }
 void ETag_surfxml_cluster(void){
        surfxml_call_cb_functions(STag_surfxml_cluster_cb_list);
 }
 void ETag_surfxml_cluster(void){
@@ -372,6 +375,8 @@ void ETag_surfxml_cluster(void){
        xbt_free(struct_cluster->V_cluster_suffix);
        xbt_free(struct_cluster->V_cluster_radical);
        xbt_free(struct_cluster->S_cluster_router_id);
        xbt_free(struct_cluster->V_cluster_suffix);
        xbt_free(struct_cluster->V_cluster_radical);
        xbt_free(struct_cluster->S_cluster_router_id);
+       xbt_free(struct_cluster->V_cluster_availability_file);
+       xbt_free(struct_cluster->V_cluster_state_file);
        xbt_free(struct_cluster);
 }
 
        xbt_free(struct_cluster);
 }