return surf_parse_get_value_with_unit(string, units);
}
+double surf_parse_get_size(const char *string)
+{
+ const struct unit_scale units[] = {
+ { "TiB", pow(1024, 4) },
+ { "GiB", pow(1024, 3) },
+ { "MiB", pow(1024, 2) },
+ { "KiB", 1024 },
+ { "TB", 1e12 },
+ { "GB", 1e9 },
+ { "MB", 1e6 },
+ { "kB", 1e3 },
+ { "B", 1.0 },
+ { "", 1.0 }, /* default unit is bytes*/
+ { "Tib", 0.125 * pow(1024, 4) },
+ { "Gib", 0.125 * pow(1024, 3) },
+ { "Mib", 0.125 * pow(1024, 2) },
+ { "Kib", 0.125 * 1024 },
+ { "Tb", 0.125 * 1e12 },
+ { "Gb", 0.125 * 1e9 },
+ { "Mb", 0.125 * 1e6 },
+ { "kb", 0.125 * 1e3 },
+ { "b", 0.125 },
+ { NULL, 0 }
+ };
+ return surf_parse_get_value_with_unit(string, units);
+}
+
double surf_parse_get_bandwidth(const char *string)
{
const struct unit_scale units[] = {
+ { "TiBps", pow(1024, 4) },
+ { "GiBps", pow(1024, 3) },
+ { "MiBps", pow(1024, 2) },
+ { "KiBps", 1024 },
{ "TBps", 1e12 },
{ "GBps", 1e9 },
{ "MBps", 1e6 },
{ "kBps", 1e3 },
{ "Bps", 1.0 },
- { "", 1.0 }, /* default unit is bytes ber second */
+ { "", 1.0 }, /* default unit is bytes per second */
+ { "Tibps", 0.125 * pow(1024, 4) },
+ { "Gibps", 0.125 * pow(1024, 3) },
+ { "Mibps", 0.125 * pow(1024, 2) },
+ { "Kibps", 0.125 * 1024 },
{ "Tbps", 0.125 * 1e12 },
{ "Gbps", 0.125 * 1e9 },
{ "Mbps", 0.125 * 1e6 },
storage_type.id = A_surfxml_storage___type_id;
storage_type.model = A_surfxml_storage___type_model;
storage_type.properties = current_property_set;
- storage_type.size = surf_parse_get_int(A_surfxml_storage___type_size);
+ storage_type.size = surf_parse_get_size(A_surfxml_storage___type_size);
sg_platf_new_storage_type(&storage_type);
current_property_set = NULL;
}
sg_platf_new_router(&router);
}
-void STag_surfxml_cluster(void){
+void ETag_surfxml_cluster(void){
s_sg_platf_cluster_cbarg_t cluster;
memset(&cluster,0,sizeof(cluster));
+ cluster.properties = current_property_set;
+
cluster.id = A_surfxml_cluster_id;
cluster.prefix = A_surfxml_cluster_prefix;
cluster.suffix = A_surfxml_cluster_suffix;
cluster.availability_trace = A_surfxml_cluster_availability___file;
cluster.state_trace = A_surfxml_cluster_state___file;
sg_platf_new_cluster(&cluster);
+
+ current_property_set = NULL;
+}
+
+void STag_surfxml_cluster(void){
+ xbt_assert(current_property_set == NULL, "Someone forgot to reset the property set to NULL in its closing tag (or XML malformed)");
}
void STag_surfxml_cabinet(void){
ASroute.src = A_surfxml_ASroute_src;
ASroute.dst = A_surfxml_ASroute_dst;
- if (!strcmp(current_routing->model_desc->name,"RuleBased")) {
- // DIRTY PERL HACK AHEAD: with the rulebased routing, the {src,dst}_gateway fields
- // store the provided name instead of the entity directly (model_rulebased_parse_ASroute knows)
- //
- // This is because the user will provide something like "^AS_(.*)$" instead of the proper name of a given entity
- ASroute.gw_src = (sg_routing_edge_t) A_surfxml_ASroute_gw___src;
- ASroute.gw_dst = (sg_routing_edge_t) A_surfxml_ASroute_gw___dst;
- } else {
- ASroute.gw_src = sg_routing_edge_by_name_or_null(A_surfxml_ASroute_gw___src);
- ASroute.gw_dst = sg_routing_edge_by_name_or_null(A_surfxml_ASroute_gw___dst);
- }
+ ASroute.gw_src = sg_routing_edge_by_name_or_null(A_surfxml_ASroute_gw___src);
+ ASroute.gw_dst = sg_routing_edge_by_name_or_null(A_surfxml_ASroute_gw___dst);
ASroute.link_list = parsed_link_list;
ASroute.link_list = parsed_link_list;
ASroute.symmetrical = FALSE;
- if (!strcmp(current_routing->model_desc->name,"RuleBased")) {
- // DIRTY PERL HACK AHEAD: with the rulebased routing, the {src,dst}_gateway fields
- // store the provided name instead of the entity directly (model_rulebased_parse_ASroute knows)
- //
- // This is because the user will provide something like "^AS_(.*)$" instead of the proper name of a given entity
- ASroute.gw_src = (sg_routing_edge_t) A_surfxml_bypassASroute_gw___src;
- ASroute.gw_dst = (sg_routing_edge_t) A_surfxml_bypassASroute_gw___dst;
- } else {
- ASroute.gw_src = sg_routing_edge_by_name_or_null(A_surfxml_bypassASroute_gw___src);
- ASroute.gw_dst = sg_routing_edge_by_name_or_null(A_surfxml_bypassASroute_gw___dst);
- }
+ ASroute.gw_src = sg_routing_edge_by_name_or_null(A_surfxml_bypassASroute_gw___src);
+ ASroute.gw_dst = sg_routing_edge_by_name_or_null(A_surfxml_bypassASroute_gw___dst);
sg_platf_new_bypassASroute(&ASroute);
parsed_link_list = NULL;
void STag_surfxml_trace(void){}
void ETag_surfxml_router(void){}
void ETag_surfxml_host___link(void){}
-void ETag_surfxml_cluster(void){}
void ETag_surfxml_cabinet(void){}
void ETag_surfxml_peer(void){}
void STag_surfxml_backbone(void){}