char *cluster_prefix = A_surfxml_cluster_prefix;
char *cluster_suffix = A_surfxml_cluster_suffix;
char *cluster_radical = A_surfxml_cluster_radical;
- char *cluster_power = A_surfxml_cluster_power;
char *cluster_core = A_surfxml_cluster_core;
- char *cluster_bw = A_surfxml_cluster_bw;
- char *cluster_lat = A_surfxml_cluster_lat;
- char *temp_cluster_bw = NULL;
- char *temp_cluster_lat = NULL;
- char *temp_cluster_power = NULL;
char *cluster_bb_bw = A_surfxml_cluster_bb_bw;
char *cluster_bb_lat = A_surfxml_cluster_bb_lat;
+ char *cluster_power = xbt_strdup(A_surfxml_cluster_power);
+ char *cluster_bw = xbt_strdup(A_surfxml_cluster_bw);
+ char *cluster_lat = xbt_strdup(A_surfxml_cluster_lat);
char *cluster_availability_file = A_surfxml_cluster_availability_file;
char *cluster_state_file = A_surfxml_cluster_state_file;
char *host_id, *groups, *link_id = NULL;
xbt_dict_set(patterns,"prefix",cluster_prefix,NULL);
xbt_dict_set(patterns,"suffix",cluster_suffix,NULL);
+ cluster_power = replace_random_parameter(cluster_power);
+ cluster_bw = replace_random_parameter(cluster_bw);
+ cluster_lat = replace_random_parameter(cluster_lat);
+
char *route_src_dst;
unsigned int iter;
int start, end, i;
radical_ends = xbt_str_split(groups, "-");
switch (xbt_dynar_length(radical_ends)) {
case 1:
- surf_parse_get_int(&start,
- xbt_dynar_get_as(radical_ends, 0, char *));
+ surf_parse_get_int(&start, xbt_dynar_get_as(radical_ends, 0, char *));
host_id = bprintf("%s%d%s", cluster_prefix, start, cluster_suffix);
link_id = bprintf("%s_link_%d", cluster_id, start);
xbt_dict_set(patterns, "radical", bprintf("%d", start), xbt_free);
- temp_cluster_power = xbt_strdup(cluster_power);
- temp_cluster_power = replace_random_parameter(temp_cluster_power);
- XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%s\">", host_id, temp_cluster_power);
+ XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%s\">", host_id, cluster_power);
A_surfxml_host_state = A_surfxml_host_state_ON;
SURFXML_BUFFER_SET(host_id, host_id);
- SURFXML_BUFFER_SET(host_power, temp_cluster_power);
+ SURFXML_BUFFER_SET(host_power, cluster_power);
SURFXML_BUFFER_SET(host_core, cluster_core);
SURFXML_BUFFER_SET(host_availability, "1.0");
SURFXML_BUFFER_SET(host_coordinates, "");
- xbt_free(availability_file);
- availability_file = xbt_strdup(cluster_availability_file);
- xbt_free(state_file);
- state_file = xbt_strdup(cluster_state_file);
+
XBT_DEBUG("\tavailability_file=\"%s\"",xbt_str_varsubst(availability_file,patterns));
XBT_DEBUG("\tstate_file=\"%s\"",xbt_str_varsubst(state_file,patterns));
SURFXML_BUFFER_SET(host_availability_file, xbt_str_varsubst(availability_file,patterns));
SURFXML_START_TAG(host);
SURFXML_END_TAG(host);
-
- temp_cluster_bw = xbt_strdup(cluster_bw);
- temp_cluster_bw = replace_random_parameter(temp_cluster_bw);
- temp_cluster_lat = xbt_strdup(cluster_lat);
- temp_cluster_lat = replace_random_parameter(temp_cluster_lat);
- XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>", link_id,temp_cluster_bw, cluster_lat);
+ XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>", link_id,cluster_bw, cluster_lat);
A_surfxml_link_state = A_surfxml_link_state_ON;
A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
if(cluster_sharing_policy == A_surfxml_cluster_sharing_policy_FULLDUPLEX)
if(cluster_sharing_policy == A_surfxml_cluster_sharing_policy_FATPIPE)
{A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_FATPIPE;}
SURFXML_BUFFER_SET(link_id, link_id);
- SURFXML_BUFFER_SET(link_bandwidth, temp_cluster_bw);
- SURFXML_BUFFER_SET(link_latency, temp_cluster_lat);
+ SURFXML_BUFFER_SET(link_bandwidth, cluster_bw);
+ SURFXML_BUFFER_SET(link_latency, cluster_lat);
SURFXML_BUFFER_SET(link_bandwidth_file, "");
SURFXML_BUFFER_SET(link_latency_file, "");
SURFXML_BUFFER_SET(link_state_file, "");
SURFXML_START_TAG(link);
SURFXML_END_TAG(link);
- xbt_free(temp_cluster_bw);
- xbt_free(temp_cluster_lat);
- xbt_free(temp_cluster_power);
free(link_id);
free(host_id);
break;
link_id = bprintf("%s_link_%d", cluster_id, i);
xbt_dict_set(patterns, "radical", bprintf("%d", i), xbt_free);
- temp_cluster_power = xbt_strdup(cluster_power);
- temp_cluster_power = replace_random_parameter(temp_cluster_power);
- XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%s\">", host_id, temp_cluster_power);
+ XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%s\">", host_id, cluster_power);
A_surfxml_host_state = A_surfxml_host_state_ON;
SURFXML_BUFFER_SET(host_id, host_id);
- SURFXML_BUFFER_SET(host_power, temp_cluster_power);
+ SURFXML_BUFFER_SET(host_power, cluster_power);
SURFXML_BUFFER_SET(host_core, cluster_core);
SURFXML_BUFFER_SET(host_availability, "1.0");
SURFXML_BUFFER_SET(host_coordinates, "");
- xbt_free(availability_file);
- availability_file = xbt_strdup(cluster_availability_file);
- xbt_free(state_file);
- state_file = xbt_strdup(cluster_state_file);
+
XBT_DEBUG("\tavailability_file=\"%s\"",xbt_str_varsubst(availability_file,patterns));
XBT_DEBUG("\tstate_file=\"%s\"",xbt_str_varsubst(state_file,patterns));
SURFXML_BUFFER_SET(host_availability_file, xbt_str_varsubst(availability_file,patterns));
SURFXML_START_TAG(host);
SURFXML_END_TAG(host);
- xbt_free(temp_cluster_power);
-
- temp_cluster_bw = xbt_strdup(cluster_bw);
- temp_cluster_bw = replace_random_parameter(temp_cluster_bw);
- temp_cluster_lat = xbt_strdup(cluster_lat);
- temp_cluster_lat = replace_random_parameter(temp_cluster_lat);
- XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>", link_id,temp_cluster_bw, cluster_lat);
+ XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>", link_id,cluster_bw, cluster_lat);
A_surfxml_link_state = A_surfxml_link_state_ON;
A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
if(cluster_sharing_policy == A_surfxml_cluster_sharing_policy_FULLDUPLEX)
if(cluster_sharing_policy == A_surfxml_cluster_sharing_policy_FATPIPE)
{A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_FATPIPE;}
SURFXML_BUFFER_SET(link_id, link_id);
- SURFXML_BUFFER_SET(link_bandwidth, temp_cluster_bw);
- SURFXML_BUFFER_SET(link_latency, temp_cluster_lat);
+ SURFXML_BUFFER_SET(link_bandwidth, cluster_bw);
+ SURFXML_BUFFER_SET(link_latency, cluster_lat);
SURFXML_BUFFER_SET(link_bandwidth_file, "");
SURFXML_BUFFER_SET(link_latency_file, "");
SURFXML_BUFFER_SET(link_state_file, "");
SURFXML_START_TAG(link);
SURFXML_END_TAG(link);
- xbt_free(temp_cluster_bw);
- xbt_free(temp_cluster_lat);
free(link_id);
free(host_id);
}
default:
XBT_DEBUG("Malformed radical");
+ break;
}
xbt_dynar_free(&radical_ends);
free(pcre_link_src);
free(route_src_dst);
+ xbt_free(cluster_bw);
+ xbt_free(cluster_lat);
+ xbt_free(cluster_power);
+ xbt_free(availability_file);
+ xbt_free(state_file);
+
free(router_id);
xbt_dict_free(&patterns);
- free(availability_file);
- free(state_file);
XBT_DEBUG("</AS>");
SURFXML_END_TAG(AS);
break;
default:
XBT_INFO("Malformed radical");
+ break;
}
res = random_generate(random);
rd_name = bprintf("%s_router",random_id);