Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Create current_property_set only if it is required.
authornavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 24 Feb 2011 12:46:06 +0000 (12:46 +0000)
committernavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 24 Feb 2011 12:46:06 +0000 (12:46 +0000)
Create link and cpu after create the dict of properties.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9713 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/bindings/lua/lua_console.c
src/simix/smx_deployment.c
src/surf/cpu.c
src/surf/cpu_im.c
src/surf/cpu_ti.c
src/surf/network_gtnets.c
src/surf/workstation_ptask_L07.c

index 67830de..e4a523a 100644 (file)
@@ -55,11 +55,13 @@ static void create_host(const char *id, double power_peak, double power_sc,
     state_trace = tmgr_trace_new(state_tr);
   else
     state_trace = tmgr_trace_new("");
-  current_property_set = xbt_dict_new();
+
   surf_host_create_resource(xbt_strdup(id), power_peak, power_scale,
                             power_trace, core_nb, state_initial, state_trace,
                             current_property_set);
 
+  current_property_set = NULL;
+
 }
 
 /**
@@ -127,11 +129,11 @@ static void create_host_wsL07(const char *id, double power_peak,
     state_trace = tmgr_trace_new(state_tr);
   else
     state_trace = tmgr_trace_new("");
-  current_property_set = xbt_dict_new();
+
   surf_wsL07_host_create_resource(xbt_strdup(id), power_peak, power_scale,
                                   power_trace, state_initial, state_trace,
                                   current_property_set);
-
+  current_property_set = NULL;
 }
 
 /**
index 87d3f61..b8227c1 100644 (file)
@@ -34,8 +34,6 @@ static void parse_process_init(void)
   parse_argv[(parse_argc) - 1] = xbt_strdup(A_surfxml_process_function);
   surf_parse_get_double(&start_time, A_surfxml_process_start_time);
   surf_parse_get_double(&kill_time, A_surfxml_process_kill_time);
-
-  current_property_set = xbt_dict_new();
 }
 
 static void parse_argument(void)
@@ -88,6 +86,7 @@ static void parse_process_finalize(void)
     }
     xbt_free(parse_host);
   }
+  current_property_set = NULL;
 }
 
 /**
@@ -203,7 +202,6 @@ void SIMIX_process_set_function(const char *process_host,
   parse_argv[(parse_argc) - 1] = xbt_strdup(process_function);
   start_time = process_start_time;
   kill_time = process_kill_time;
-  current_property_set = xbt_dict_new();
 
   /* add arguments */
   xbt_dynar_foreach(arguments, i, arg) {
index 2847023..a9ae72a 100644 (file)
@@ -95,10 +95,9 @@ static void parse_cpu_init(void)
     state_initial = SURF_RESOURCE_OFF;
   state_trace = tmgr_trace_new(A_surfxml_host_state_file);
 
-  current_property_set = xbt_dict_new();
   cpu_new(xbt_strdup(A_surfxml_host_id), power_peak, power_scale,
           power_trace, core, state_initial, state_trace, current_property_set);
-
+  current_property_set = NULL;
 }
 
 static void add_traces_cpu(void)
@@ -139,7 +138,7 @@ static void add_traces_cpu(void)
 
 static void cpu_define_callbacks(const char *file)
 {
-  surfxml_add_callback(STag_surfxml_host_cb_list, parse_cpu_init);
+  surfxml_add_callback(ETag_surfxml_host_cb_list, parse_cpu_init);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_traces_cpu);
 }
 
index f4f3873..da69fc5 100644 (file)
@@ -114,10 +114,10 @@ static void parse_cpu_im_init(void)
     state_initial = SURF_RESOURCE_OFF;
   state_trace = tmgr_trace_new(A_surfxml_host_state_file);
 
-  current_property_set = xbt_dict_new();
   cpu_im_new(xbt_strdup(A_surfxml_host_id), power_peak, power_scale,
              power_trace, core, state_initial, state_trace,
              current_property_set);
+  current_property_set = NULL;
 
 }
 
@@ -156,7 +156,7 @@ static void cpu_im_add_traces_cpu(void)
 
 static void cpu_im_define_callbacks(const char *file)
 {
-  surfxml_add_callback(STag_surfxml_host_cb_list, parse_cpu_im_init);
+  surfxml_add_callback(ETag_surfxml_host_cb_list, parse_cpu_im_init);
   surfxml_add_callback(ETag_surfxml_platform_cb_list,
                        &cpu_im_add_traces_cpu);
 }
index f9b3b4e..a67b445 100644 (file)
@@ -215,10 +215,10 @@ static void parse_cpu_ti_init(void)
     state_initial = SURF_RESOURCE_OFF;
   state_trace = tmgr_trace_new(A_surfxml_host_state_file);
 
-  current_property_set = xbt_dict_new();
   cpu_ti_new(xbt_strdup(A_surfxml_host_id), power_peak, power_scale,
              power_trace, core, state_initial, state_trace,
              current_property_set);
+  current_property_set = NULL;
 
 }
 
@@ -281,7 +281,7 @@ static void add_traces_cpu_ti(void)
 
 static void cpu_ti_define_callbacks(const char *file)
 {
-  surfxml_add_callback(STag_surfxml_host_cb_list, parse_cpu_ti_init);
+  surfxml_add_callback(ETag_surfxml_host_cb_list, parse_cpu_ti_init);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_traces_cpu_ti);
 }
 
index 6564fb5..c317017 100644 (file)
@@ -110,7 +110,6 @@ static void parse_link_init(void)
   if (state_trace)
     XBT_INFO("The GTNetS network model doesn't support link state traces");
 
-  current_property_set = xbt_dict_new();
   if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_FULLDUPLEX)
   {
          link_new(bprintf("%s_UP",name), bw, lat, current_property_set);
@@ -118,6 +117,7 @@ static void parse_link_init(void)
 
   }
   else  link_new(name, bw, lat, current_property_set);
+  current_property_set = NULL;
 }
 
 /* Create the gtnets topology based on routing strategy */
@@ -167,7 +167,7 @@ static void create_gtnets_topology()
 static void define_callbacks(const char *file)
 {
   /* Figuring out the network links */
-  surfxml_add_callback(STag_surfxml_link_cb_list, &parse_link_init);
+  surfxml_add_callback(ETag_surfxml_link_cb_list, &parse_link_init);
   surfxml_add_callback(ETag_surfxml_platform_cb_list,
                        &create_gtnets_topology);
 }
index f5544c0..093256a 100644 (file)
@@ -629,7 +629,7 @@ static cpu_L07_t ptask_cpu_new(const char *name, double power_scale,
   cpu->generic_resource.model = surf_workstation_model;
   cpu->type = SURF_WORKSTATION_RESOURCE_CPU;
   cpu->generic_resource.name = xbt_strdup(name);
-  cpu->generic_resource.properties = current_property_set;
+  cpu->generic_resource.properties = cpu_properties;
   cpu->id = ptask_host_count++;
 
   cpu->power_scale = power_scale;
@@ -676,9 +676,9 @@ static void ptask_parse_cpu_init(void)
     state_initial = SURF_RESOURCE_OFF;
   state_trace = tmgr_trace_new(A_surfxml_host_state_file);
 
-  current_property_set = xbt_dict_new();
   ptask_cpu_new(A_surfxml_host_id, power_scale, power_initial, power_trace,
                 state_initial, state_trace, current_property_set);
+  current_property_set=NULL;
 }
 
 static void ptask_cpu_create_resource(char *name, double power_peak,
@@ -783,8 +783,6 @@ static void ptask_parse_link_init(void)
 
   state_trace = tmgr_trace_new(A_surfxml_link_state_file);
 
-  current_property_set = xbt_dict_new();
-
   if(policy_initial_link == SURF_LINK_FULLDUPLEX)
   {
          ptask_link_new(name_link_up, bw_initial, bw_trace, lat_initial, lat_trace,
@@ -792,7 +790,7 @@ static void ptask_parse_link_init(void)
                         current_property_set);
          ptask_link_new(name_link_down, bw_initial, bw_trace, lat_initial, lat_trace,
                         state_initial_link, state_trace, policy_initial_link,
-                        xbt_dict_new());
+                        current_property_set);
   }
   else
   {
@@ -800,6 +798,7 @@ static void ptask_parse_link_init(void)
                                         state_initial_link, state_trace, policy_initial_link,
                                         current_property_set);
   }
+  current_property_set = NULL;
 }
 
 static void ptask_link_create_resource(char *name,
@@ -813,10 +812,9 @@ static void ptask_link_create_resource(char *name,
                                        e_surf_link_sharing_policy_t
                                        policy, xbt_dict_t properties)
 {
-
   ptask_link_new(name, bw_initial, bw_trace,
                  lat_initial, lat_trace, state_initial, state_trace,
-                 policy, xbt_dict_new());
+                 policy, properties);
 }
 
 
@@ -892,8 +890,8 @@ static void ptask_add_traces(void)
 static void ptask_define_callbacks(const char *file)
 {
   /* Adding callback functions */
-  surfxml_add_callback(STag_surfxml_host_cb_list, &ptask_parse_cpu_init);
-  surfxml_add_callback(STag_surfxml_link_cb_list, &ptask_parse_link_init);
+  surfxml_add_callback(ETag_surfxml_host_cb_list, &ptask_parse_cpu_init);
+  surfxml_add_callback(ETag_surfxml_link_cb_list, &ptask_parse_link_init);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &ptask_add_traces);
 }