static s_route_KCCFLN05_t *routing_table = NULL;
#define ROUTE(i,j) routing_table[(i)+(j)*nb_workstation]
static network_link_KCCFLN05_t loopback = NULL;
+static xbt_dict_t parallel_task_network_link_set = NULL;
/*xbt_dict_t network_link_set = NULL;*/
xbt_dict_free(&network_link_set);
xbt_dict_free(&workstation_set);
+ if (parallel_task_network_link_set != NULL) {
+ xbt_dict_free(¶llel_task_network_link_set);
+ }
xbt_swag_free(surf_workstation_resource->common_public->states.
ready_action_set);
xbt_swag_free(surf_workstation_resource->common_public->states.
{
surf_action_workstation_KCCFLN05_t action = NULL;
int i, j, k;
- static xbt_dict_t network_link_set;
- static int first_run = 1;
int nb_link = 0;
int nb_host = 0;
- if (first_run) {
- network_link_set = xbt_dict_new_ext(workstation_nb * workstation_nb * 10);
- first_run = 0;
- }
- else {
- xbt_dict_reset(network_link_set);
+ if (parallel_task_network_link_set == NULL) {
+ parallel_task_network_link_set = xbt_dict_new_ext(workstation_nb * workstation_nb * 10);
}
/* Compute the number of affected resources... */
if(communication_amount[i*workstation_nb+j]>0)
for(k=0; k< route_size; k++) {
- xbt_dict_set(network_link_set, route[k]->name, route[k], NULL);
+ xbt_dict_set(parallel_task_network_link_set, route[k]->name, route[k], NULL);
}
}
}
- nb_link = xbt_dict_length(network_link_set);
+ nb_link = xbt_dict_length(parallel_task_network_link_set);
+ xbt_dict_reset(parallel_task_network_link_set);
for (i = 0; i<workstation_nb; i++)
if(computation_amount[i]>0) nb_host++;
policy_initial);
}
-static void route_new(int src_id, int dst_id, char **links, int nb_link,
+static void route_new(int src_id, int dst_id, network_link_KCCFLN05_t *link_list, int nb_link,
double impact_on_src, double impact_on_dst,
double impact_on_src_with_other_recv,
double impact_on_dst_with_other_send)
{
- network_link_KCCFLN05_t *link_list = NULL;
- int i;
route_KCCFLN05_t route = &(ROUTE(src_id, dst_id));
route->size = nb_link;
- link_list = route->links = xbt_new0(network_link_KCCFLN05_t, nb_link);
- for (i = 0; i < nb_link; i++) {
- link_list[i] = xbt_dict_get_or_null(network_link_set, links[i]);
- free(links[i]);
- }
- free(links);
+ route->links = link_list = xbt_realloc(link_list, sizeof(network_link_KCCFLN05_t) * nb_link);
route->impact_on_src = impact_on_src;
route->impact_on_dst = impact_on_src;
route->impact_on_src_with_other_recv = impact_on_src_with_other_recv;
route->impact_on_dst_with_other_send = impact_on_dst_with_other_send;
}
-static int nb_link = 0;
-static char **link_name = NULL;
+static int nb_link;
+static int link_list_capacity;
+static network_link_KCCFLN05_t *link_list = NULL;
static int src_id = -1;
static int dst_id = -1;
static double impact_on_src;
A_surfxml_route_impact_on_dst_with_other_send);
nb_link = 0;
- link_name = NULL;
+ link_list_capacity = 20;
+ link_list = xbt_new(network_link_KCCFLN05_t, link_list_capacity);
}
static void parse_route_elem(void)
{
- nb_link++;
- link_name = xbt_realloc(link_name, (nb_link) * sizeof(char *));
- link_name[(nb_link) - 1] = xbt_strdup(A_surfxml_route_element_name);
+ if (nb_link == link_list_capacity) {
+ link_list_capacity *= 2;
+ link_list = xbt_realloc(link_list, (link_list_capacity) * sizeof(network_link_KCCFLN05_t));
+ }
+ link_list[nb_link++] = xbt_dict_get_or_null(network_link_set, A_surfxml_route_element_name);
}
static void parse_route_set_route(void)
{
- route_new(src_id, dst_id, link_name, nb_link, impact_on_src,
+ route_new(src_id, dst_id, link_list, nb_link, impact_on_src,
impact_on_dst, impact_on_src_with_other_recv,
impact_on_dst_with_other_send);
}