Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
preparse the arguments of peer tag
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 8 Nov 2011 14:46:04 +0000 (15:46 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 8 Nov 2011 21:43:39 +0000 (22:43 +0100)
src/include/surf/surfxml_parse_values.h
src/surf/surf_routing.c
src/surf/surfxml_parse.c

index afab4ba..bbd97c7 100644 (file)
 typedef struct s_surf_parsing_peer_arg *surf_parsing_peer_arg_t;
 typedef struct s_surf_parsing_peer_arg {
        const char* id;
 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* 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;
 } s_surf_parsing_peer_arg_t;
 
 typedef struct s_surf_parsing_cluster_arg *surf_parsing_cluster_arg_t;
index bc1c332..9f6f2e2 100644 (file)
@@ -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);
 
   link_router = bprintf("%s_link_router", struct_peer->id);
   link_backbone = bprintf("%s_backbone", struct_peer->id);
 
-  XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%s\"/>", host_id, struct_peer->power);
+  XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%f\"/>", 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;
   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_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);
 
   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);
 
   router.coord = struct_peer->coord;
   sg_platf_new_router(&router);
 
-  XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>", link_id_up, struct_peer->bw_in, struct_peer->lat);
+  XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%f\"\tlat=\"%f\"/>", 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;
   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);
 
   sg_platf_new_link(&link);
 
-  XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>", 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\tid=\"%s\"\tbw=\"%f\"\tlat=\"%f\"/>", link_id_down, struct_peer->bw_out, struct_peer->lat);
   link.id = link_id_down;
   sg_platf_new_link(&link);
 
   link.id = link_id_down;
   sg_platf_new_link(&link);
 
index 2b21cc2..756f837 100644 (file)
@@ -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;
 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->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){
        surfxml_call_cb_functions(STag_surfxml_peer_cb_list);
 }
 void ETag_surfxml_peer(void){