X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/262945d110ff9c941cf3b3400c8f0a2b8d8ab32d..841d5e83050a1c7a247ab9edfc5e3185663d996d:/src/surf/workstation_KCCFLN05.c diff --git a/src/surf/workstation_KCCFLN05.c b/src/surf/workstation_KCCFLN05.c index 5e31fd203d..f3c9115c39 100644 --- a/src/surf/workstation_KCCFLN05.c +++ b/src/surf/workstation_KCCFLN05.c @@ -79,7 +79,6 @@ static workstation_KCCFLN05_t workstation_new(const char *name, static void parse_workstation(void) { - char *name = NULL; double power_scale = 0.0; double power_initial = 0.0; tmgr_trace_t power_trace = NULL; @@ -89,7 +88,6 @@ static void parse_workstation(void) double interference_recv = 0.0; double interference_send_recv = 0.0; - name = xbt_strdup(A_cpu_name); surf_parse_get_double(&power_scale,A_cpu_power); surf_parse_get_double(&power_initial,A_cpu_availability); surf_parse_get_trace(&power_trace,A_cpu_availability_file); @@ -105,7 +103,7 @@ static void parse_workstation(void) surf_parse_get_double(&interference_recv,A_cpu_interference_recv); surf_parse_get_double(&interference_send_recv,A_cpu_interference_send_recv); - workstation_new(name, power_scale, power_initial, power_trace, state_initial, + workstation_new(A_cpu_name, power_scale, power_initial, power_trace, state_initial, state_trace, interference_send, interference_recv, interference_send_recv); } @@ -128,7 +126,7 @@ static const char *get_resource_name(void *resource_id) static int cpu_used(void *resource_id) { - return lmm_constraint_used(maxmin_system, + return lmm_constraint_used(maxmin_system_cpu_KCCFLN05, ((workstation_KCCFLN05_t) resource_id)->constraint); } @@ -270,6 +268,11 @@ static void parse_route_set_endpoints(void) { src_id = ((workstation_KCCFLN05_t) name_service(A_route_src))->id; dst_id = ((workstation_KCCFLN05_t) name_service(A_route_dst))->id; + surf_parse_get_double(&impact_on_src,A_route_impact_on_src); + surf_parse_get_double(&impact_on_dst,A_route_impact_on_dst); + surf_parse_get_double(&impact_on_src_with_other_recv,A_route_impact_on_src_with_other_recv); + surf_parse_get_double(&impact_on_dst_with_other_send,A_route_impact_on_dst_with_other_send); + nb_link = 0; link_name = NULL; } @@ -355,14 +358,14 @@ static void action_network_KCCFLN05_free(surf_action_t action) xbt_dynar_foreach (src->outgoing_communications,cpt,act) { if(act==action) { - xbt_dynar_remove_at(src->outgoing_communications, cpt, act); + xbt_dynar_remove_at(src->outgoing_communications, cpt, &act); break; } } xbt_dynar_foreach (dst->incomming_communications,cpt,act) { if(act==action) { - xbt_dynar_remove_at(dst->incomming_communications, cpt, act); + xbt_dynar_remove_at(dst->incomming_communications, cpt, &act); break; } } @@ -450,8 +453,11 @@ static surf_action_t communicate_KCCFLN05(void *src, void *dst, double size) lmm_expand(maxmin_system_network_KCCFLN05, route->links[i]->constraint, action->variable, 1.0); - xbt_dynar_push(card_src->outgoing_communications,action); - xbt_dynar_push(card_dst->incomming_communications,action); + action->src=src; + action->dst=dst; + + xbt_dynar_push(card_src->outgoing_communications,&action); + xbt_dynar_push(card_dst->incomming_communications,&action); return (surf_action_t) action; } @@ -464,12 +470,18 @@ static void action_cpu_KCCFLN05_free(surf_action_t action) xbt_free(action); } +/* #define WARNING(format, ...) (fprintf(stderr, "[%s , %s : %d] ", __FILE__, __FUNCTION__, __LINE__),\ */ +/* fprintf(stderr, format, ## __VA_ARGS__), \ */ +/* fprintf(stderr, "\n")) */ +/* #define VOIRP(expr) WARNING(" {" #expr " = %p }", expr) */ +/* #define VOIRD(expr) WARNING(" {" #expr " = %d }", expr) */ +/* #define VOIRG(expr) WARNING(" {" #expr " = %lg }", expr) */ + static double share_cpu_KCCFLN05_resources(double now) { s_surf_action_cpu_KCCFLN05_t s_cpu_action; lmm_constraint_t cnst = NULL; workstation_KCCFLN05_t workstation = NULL; - double value = share_network_KCCFLN05_resources(now); double W=0.0; double scale=0.0; int cpt; @@ -489,6 +501,10 @@ static double share_cpu_KCCFLN05_resources(double now) (xbt_dynar_length(workstation->outgoing_communications))) { scale = workstation->interference_send; xbt_dynar_foreach (workstation->outgoing_communications,cpt,action) { +/* VOIRD(action->src->id); */ +/* VOIRD(action->dst->id); */ +/* VOIRP(&ROUTE(action->src->id,action->dst->id)); */ +/* VOIRG(ROUTE(action->src->id,action->dst->id).impact_on_src); */ scale -= ROUTE(action->src->id,action->dst->id).impact_on_src * lmm_variable_getvalue(action->variable); } @@ -593,8 +609,8 @@ static surf_action_t execute_KCCFLN05(void *cpu, double size) surf_cpu_resource->common_public->states.failed_action_set; xbt_swag_insert(action, action->generic_action.state_set); - action->variable = lmm_variable_new(maxmin_system, action, 1.0, -1.0, 1); - lmm_expand(maxmin_system, CPU->constraint, action->variable, + action->variable = lmm_variable_new(maxmin_system_cpu_KCCFLN05, action, 1.0, -1.0, 1); + lmm_expand(maxmin_system_cpu_KCCFLN05, CPU->constraint, action->variable, 1.0); return (surf_action_t) action; @@ -602,19 +618,33 @@ static surf_action_t execute_KCCFLN05(void *cpu, double size) static void cpu_KCCFLN05_action_suspend(surf_action_t action) { - lmm_update_variable_weight(maxmin_system, - ((surf_action_cpu_KCCFLN05_t) action)->variable, 0.0); + if(action->resource_type==(surf_resource_t)surf_network_resource) + lmm_update_variable_weight(maxmin_system_network_KCCFLN05, + ((surf_action_network_KCCFLN05_t) action)->variable, 0.0); + else if(action->resource_type==(surf_resource_t)surf_cpu_resource) + lmm_update_variable_weight(maxmin_system_cpu_KCCFLN05, + ((surf_action_cpu_KCCFLN05_t) action)->variable, 0.0); + else DIE_IMPOSSIBLE; } static void cpu_KCCFLN05_action_resume(surf_action_t action) { - lmm_update_variable_weight(maxmin_system, - ((surf_action_cpu_KCCFLN05_t) action)->variable, 1.0); + if(action->resource_type==(surf_resource_t)surf_network_resource) + lmm_update_variable_weight(maxmin_system_network_KCCFLN05, + ((surf_action_network_KCCFLN05_t) action)->variable, 1.0); + else if(action->resource_type==(surf_resource_t)surf_cpu_resource) + lmm_update_variable_weight(maxmin_system_cpu_KCCFLN05, + ((surf_action_cpu_KCCFLN05_t) action)->variable, 1.0); + else DIE_IMPOSSIBLE; } static int cpu_KCCFLN05_action_is_suspended(surf_action_t action) { - return (lmm_get_variable_weight(((surf_action_cpu_KCCFLN05_t) action)->variable) == 0.0); + if(action->resource_type==(surf_resource_t)surf_network_resource) + return (lmm_get_variable_weight(((surf_action_cpu_KCCFLN05_t) action)->variable) == 0.0); + if(action->resource_type==(surf_resource_t)surf_cpu_resource) + return (lmm_get_variable_weight(((surf_action_network_KCCFLN05_t) action)->variable) == 0.0); + DIE_IMPOSSIBLE; } /************* workstation ************/ @@ -924,4 +954,9 @@ void surf_workstation_resource_init_KCCFLN05(const char *filename) xbt_dynar_push(resource_list, &surf_network_resource); xbt_dynar_push(resource_list, &surf_cpu_resource); xbt_dynar_push(resource_list, &surf_workstation_resource); + + if (maxmin_system) { /* To avoid using this useless system */ + lmm_system_free(maxmin_system); + maxmin_system = NULL; + } }