From: navarrop Date: Thu, 24 Feb 2011 12:46:06 +0000 (+0000) Subject: Create current_property_set only if it is required. X-Git-Tag: v3.6_beta2~232 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/e20d6e2c634bba1e7d1b2ca4e9b7627338655c23?hp=f542eb7dfaec061b7274b3bd08f8ec6eaee90953 Create current_property_set only if it is required. 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 --- diff --git a/src/bindings/lua/lua_console.c b/src/bindings/lua/lua_console.c index 67830dee51..e4a523a8b3 100644 --- a/src/bindings/lua/lua_console.c +++ b/src/bindings/lua/lua_console.c @@ -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; } /** diff --git a/src/simix/smx_deployment.c b/src/simix/smx_deployment.c index 87d3f6151a..b8227c19f3 100644 --- a/src/simix/smx_deployment.c +++ b/src/simix/smx_deployment.c @@ -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) { diff --git a/src/surf/cpu.c b/src/surf/cpu.c index 2847023a4b..a9ae72a66b 100644 --- a/src/surf/cpu.c +++ b/src/surf/cpu.c @@ -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); } diff --git a/src/surf/cpu_im.c b/src/surf/cpu_im.c index f4f3873fff..da69fc5cf8 100644 --- a/src/surf/cpu_im.c +++ b/src/surf/cpu_im.c @@ -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); } diff --git a/src/surf/cpu_ti.c b/src/surf/cpu_ti.c index f9b3b4e086..a67b44536f 100644 --- a/src/surf/cpu_ti.c +++ b/src/surf/cpu_ti.c @@ -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); } diff --git a/src/surf/network_gtnets.c b/src/surf/network_gtnets.c index 6564fb5150..c317017237 100644 --- a/src/surf/network_gtnets.c +++ b/src/surf/network_gtnets.c @@ -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); } diff --git a/src/surf/workstation_ptask_L07.c b/src/surf/workstation_ptask_L07.c index f5544c007a..093256acab 100644 --- a/src/surf/workstation_ptask_L07.c +++ b/src/surf/workstation_ptask_L07.c @@ -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); }