X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/0f5e8daaa6e9f74521068aa75837200bcd182ea6..c6189d1b7b02cda083791afc98f7e632100424d5:/src/surf/fair_bottleneck.c diff --git a/src/surf/fair_bottleneck.c b/src/surf/fair_bottleneck.c index c7ebba87db..aa9c4fa634 100644 --- a/src/surf/fair_bottleneck.c +++ b/src/surf/fair_bottleneck.c @@ -12,9 +12,9 @@ #include XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_maxmin); -#define SHOW_EXPR_G(expr) DEBUG1(#expr " = %g",expr); -#define SHOW_EXPR_D(expr) DEBUG1(#expr " = %d",expr); -#define SHOW_EXPR_P(expr) DEBUG1(#expr " = %p",expr); +#define SHOW_EXPR_G(expr) XBT_DEBUG(#expr " = %g",expr); +#define SHOW_EXPR_D(expr) XBT_DEBUG(#expr " = %d",expr); +#define SHOW_EXPR_P(expr) XBT_DEBUG(#expr " = %p",expr); void bottleneck_solve(lmm_system_t sys) { @@ -27,7 +27,6 @@ void bottleneck_solve(lmm_system_t sys) xbt_swag_t cnst_list = NULL; xbt_swag_t var_list = NULL; xbt_swag_t elem_list = NULL; - double min_usage = -1; int i; static s_xbt_swag_t cnst_to_update; @@ -40,24 +39,24 @@ void bottleneck_solve(lmm_system_t sys) xbt_swag_offset(s_cnst, saturated_constraint_set_hookup)); var_list = &(sys->variable_set); - DEBUG1("Variable set : %d", xbt_swag_size(var_list)); + XBT_DEBUG("Variable set : %d", xbt_swag_size(var_list)); xbt_swag_foreach(var, var_list) { int nb = 0; var->value = 0.0; - DEBUG1("Handling variable %p", var); + XBT_DEBUG("Handling variable %p", var); xbt_swag_insert(var, &(sys->saturated_variable_set)); for (i = 0; i < var->cnsts_number; i++) { if (var->cnsts[i].value == 0.0) nb++; } if ((nb == var->cnsts_number) && (var->weight > 0.0)) { - DEBUG1("Err, finally, there is no need to take care of variable %p", + XBT_DEBUG("Err, finally, there is no need to take care of variable %p", var); xbt_swag_remove(var, &(sys->saturated_variable_set)); var->value = 1.0; } if (var->weight <= 0.0) { - DEBUG1("Err, finally, there is no need to take care of variable %p", + XBT_DEBUG("Err, finally, there is no need to take care of variable %p", var); xbt_swag_remove(var, &(sys->saturated_variable_set)); } @@ -65,7 +64,7 @@ void bottleneck_solve(lmm_system_t sys) var_list = &(sys->saturated_variable_set); cnst_list = &(sys->active_constraint_set); - DEBUG1("Active constraints : %d", xbt_swag_size(cnst_list)); + XBT_DEBUG("Active constraints : %d", xbt_swag_size(cnst_list)); xbt_swag_foreach(cnst, cnst_list) { xbt_swag_insert(cnst, &(sys->saturated_constraint_set)); } @@ -75,22 +74,21 @@ void bottleneck_solve(lmm_system_t sys) cnst->usage = 0.0; } - DEBUG0("Fair bottleneck Initialized"); + XBT_DEBUG("Fair bottleneck Initialized"); /* * Compute Usage and store the variables that reach the maximum. */ do { if (XBT_LOG_ISENABLED(surf_maxmin, xbt_log_priority_debug)) { - DEBUG0("Fair bottleneck done"); + XBT_DEBUG("Fair bottleneck done"); lmm_print(sys); } - DEBUG1("******* Constraints to process: %d *******", + XBT_DEBUG("******* Constraints to process: %d *******", xbt_swag_size(cnst_list)); - min_usage = -1; xbt_swag_foreach_safe(cnst, cnst_next, cnst_list) { int nb = 0; - DEBUG1("Processing cnst %p ", cnst); + XBT_DEBUG("Processing cnst %p ", cnst); elem_list = &(cnst->element_set); cnst->usage = 0.0; xbt_swag_foreach(elem, elem_list) { @@ -100,7 +98,7 @@ void bottleneck_solve(lmm_system_t sys) && xbt_swag_belongs(elem->variable, var_list)) nb++; } - DEBUG1("\tThere are %d variables", nb); + XBT_DEBUG("\tThere are %d variables", nb); if (nb > 0 && !cnst->shared) nb = 1; if (!nb) { @@ -110,7 +108,7 @@ void bottleneck_solve(lmm_system_t sys) continue; } cnst->usage = cnst->remaining / nb; - DEBUG3("\tConstraint Usage %p : %f with %d variables", cnst, + XBT_DEBUG("\tConstraint Usage %p : %f with %d variables", cnst, cnst->usage, nb); } @@ -124,7 +122,7 @@ void bottleneck_solve(lmm_system_t sys) if (var->bound > 0) min_inc = MIN(min_inc, var->bound - var->value); var->mu = min_inc; - DEBUG2("Updating variable %p maximum increment: %g", var, var->mu); + XBT_DEBUG("Updating variable %p maximum increment: %g", var, var->mu); var->value += var->mu; if (var->value == var->bound) { xbt_swag_remove(var, var_list); @@ -132,41 +130,41 @@ void bottleneck_solve(lmm_system_t sys) } xbt_swag_foreach_safe(cnst, cnst_next, cnst_list) { - DEBUG1("Updating cnst %p ", cnst); + XBT_DEBUG("Updating cnst %p ", cnst); elem_list = &(cnst->element_set); xbt_swag_foreach(elem, elem_list) { if (elem->variable->weight <= 0) break; if (cnst->shared) { - DEBUG4("\tUpdate constraint %p (%g) with variable %p by %g", + XBT_DEBUG("\tUpdate constraint %p (%g) with variable %p by %g", cnst, cnst->remaining, elem->variable, elem->variable->mu); double_update(&(cnst->remaining), elem->value * elem->variable->mu); } else { - DEBUG4 + XBT_DEBUG ("\tNon-Shared variable. Update constraint usage of %p (%g) with variable %p by %g", cnst, cnst->usage, elem->variable, elem->variable->mu); cnst->usage = MIN(cnst->usage, elem->value * elem->variable->mu); } } if (!cnst->shared) { - DEBUG3("\tUpdate constraint %p (%g) by %g", + XBT_DEBUG("\tUpdate constraint %p (%g) by %g", cnst, cnst->remaining, cnst->usage); double_update(&(cnst->remaining), cnst->usage); } - DEBUG2("\tRemaining for %p : %g", cnst, cnst->remaining); + XBT_DEBUG("\tRemaining for %p : %g", cnst, cnst->remaining); if (cnst->remaining == 0.0) { - DEBUG1("\tGet rid of constraint %p", cnst); + XBT_DEBUG("\tGet rid of constraint %p", cnst); xbt_swag_remove(cnst, cnst_list); xbt_swag_foreach(elem, elem_list) { if (elem->variable->weight <= 0) break; if (elem->value > 0) { - DEBUG1("\t\tGet rid of variable %p", elem->variable); + XBT_DEBUG("\t\tGet rid of variable %p", elem->variable); xbt_swag_remove(elem->variable, var_list); } } @@ -174,12 +172,10 @@ void bottleneck_solve(lmm_system_t sys) } } while (xbt_swag_size(var_list)); - xbt_swag_foreach_safe(cnst, cnst_next, cnst_list) { - xbt_swag_remove(cnst, cnst_list); - } + xbt_swag_reset(cnst_list); sys->modified = 0; if (XBT_LOG_ISENABLED(surf_maxmin, xbt_log_priority_debug)) { - DEBUG0("Fair bottleneck done"); + XBT_DEBUG("Fair bottleneck done"); lmm_print(sys); } }