From 0e683608f783111ab47bac546980f8245a900a1d Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Tue, 8 Nov 2011 15:46:04 +0100 Subject: [PATCH] preparse the arguments of peer tag --- src/include/surf/surfxml_parse_values.h | 12 ++++++------ src/surf/surf_routing.c | 18 ++++++++++-------- src/surf/surfxml_parse.c | 12 ++++++------ 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/include/surf/surfxml_parse_values.h b/src/include/surf/surfxml_parse_values.h index afab4baba3..bbd97c7dfb 100644 --- a/src/include/surf/surfxml_parse_values.h +++ b/src/include/surf/surfxml_parse_values.h @@ -10,13 +10,13 @@ typedef struct s_surf_parsing_peer_arg *surf_parsing_peer_arg_t; typedef struct s_surf_parsing_peer_arg { const char* id; - const char* power;//FIXME: convert to double - const char* bw_in; - const char* bw_out; - const char* lat; + double power; + double bw_in; + double bw_out; + double lat; const char* coord; - const char* availability_trace; - const char* state_trace; + tmgr_trace_t availability_trace; + tmgr_trace_t state_trace; } s_surf_parsing_peer_arg_t; typedef struct s_surf_parsing_cluster_arg *surf_parsing_cluster_arg_t; diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index bc1c332fd3..9f6f2e2411 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -1729,15 +1729,15 @@ static void routing_parse_Speer(void) link_router = bprintf("%s_link_router", struct_peer->id); link_backbone = bprintf("%s_backbone", struct_peer->id); - XBT_DEBUG("", host_id, struct_peer->power); + XBT_DEBUG("", host_id, struct_peer->power); s_sg_platf_host_cbarg_t host; memset(&host,0,sizeof(host)); host.initial_state = SURF_RESOURCE_ON; host.id = host_id; - host.power_peak = surf_parse_get_double(struct_peer->power); + host.power_peak = struct_peer->power; host.power_scale = 1.0; - host.power_trace = tmgr_trace_new(struct_peer->availability_trace); - host.state_trace = tmgr_trace_new(struct_peer->state_trace); + host.power_trace = struct_peer->availability_trace; + host.state_trace = struct_peer->state_trace; host.core_amount = 1; sg_platf_new_host(&host); @@ -1749,17 +1749,19 @@ static void routing_parse_Speer(void) router.coord = struct_peer->coord; sg_platf_new_router(&router); - XBT_DEBUG("", link_id_up, struct_peer->bw_in, struct_peer->lat); + XBT_DEBUG("", link_id_up, struct_peer->bw_in, struct_peer->lat); s_sg_platf_link_cbarg_t link; memset(&link,0,sizeof(link)); link.state = SURF_RESOURCE_ON; link.policy = SURF_LINK_SHARED; link.id = link_id_up; - link.bandwidth = surf_parse_get_double(struct_peer->bw_in); - link.latency = surf_parse_get_double(struct_peer->lat); + link.bandwidth = struct_peer->bw_in; + link.latency = struct_peer->lat; sg_platf_new_link(&link); - XBT_DEBUG("", link_id_down, struct_peer->bw_out, struct_peer->lat); + // FIXME: dealing with full duplex is not the role of this piece of code, I'd say [Mt] + // Instead, it should be created fullduplex, and the models will do what's needed in this case + XBT_DEBUG("", link_id_down, struct_peer->bw_out, struct_peer->lat); link.id = link_id_down; sg_platf_new_link(&link); diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index 2b21cc2ed1..756f83752f 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -339,13 +339,13 @@ void ETag_surfxml_cluster(void){ void STag_surfxml_peer(void){ struct_peer = xbt_new0(s_surf_parsing_peer_arg_t, 1); struct_peer->id = A_surfxml_peer_id; - struct_peer->power = A_surfxml_peer_power; - struct_peer->bw_in = A_surfxml_peer_bw_in; - struct_peer->bw_out = A_surfxml_peer_bw_out; - struct_peer->lat = A_surfxml_peer_lat; + struct_peer->power = surf_parse_get_double(A_surfxml_peer_power); + struct_peer->bw_in = surf_parse_get_double(A_surfxml_peer_bw_in); + struct_peer->bw_out = surf_parse_get_double(A_surfxml_peer_bw_out); + struct_peer->lat = surf_parse_get_double(A_surfxml_peer_lat); struct_peer->coord = A_surfxml_peer_coordinates; - struct_peer->availability_trace = A_surfxml_peer_availability_file; - struct_peer->state_trace = A_surfxml_peer_state_file; + struct_peer->availability_trace = tmgr_trace_new(A_surfxml_peer_availability_file); + struct_peer->state_trace = tmgr_trace_new(A_surfxml_peer_state_file); surfxml_call_cb_functions(STag_surfxml_peer_cb_list); } void ETag_surfxml_peer(void){ -- 2.20.1