X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b0873fb942f5d028c07216e2e5af2ab4924ccdf2..a9361ff5f9057e93ed0bbdfac0eab6e5ba8aeab8:/src/surf/maxmin.cpp diff --git a/src/surf/maxmin.cpp b/src/surf/maxmin.cpp index b3b9103844..a96e470de0 100644 --- a/src/surf/maxmin.cpp +++ b/src/surf/maxmin.cpp @@ -26,7 +26,7 @@ double sg_maxmin_precision = 0.00001; double sg_surf_precision = 0.00001; int sg_concurrency_limit= 100; -static void *lmm_variable_mallocator_new_f(void); +static void *lmm_variable_mallocator_new_f(); static void lmm_variable_mallocator_free_f(void *var); #define lmm_variable_mallocator_reset_f ((void_f_pvoid_t)nullptr) static void lmm_update_modified_set(lmm_system_t sys, lmm_constraint_t cnst); @@ -254,7 +254,7 @@ inline void lmm_constraint_free(lmm_system_t sys,lmm_constraint_t cnst) lmm_cnst_free(sys, cnst); } -static void *lmm_variable_mallocator_new_f(void) +static void *lmm_variable_mallocator_new_f() { lmm_variable_t var = xbt_new(s_lmm_variable_t, 1); var->cnsts = nullptr; /* will be created by realloc */ @@ -1220,25 +1220,28 @@ static void lmm_remove_all_modified_set(lmm_system_t sys) } /** - * Returns total resource load + * Returns resource load (in flop per second, or byte per second, or similar) * - * \param cnst the lmm_constraint_t associated to the resource + * If the resource is shared (the default case), the load is sum of + * resource usage made by every variables located on this resource. * - * This is dead code, but we may use it later for debug/trace. + * If the resource is not shared (ie in FATPIPE mode), then the the + * load is the max (not the sum) of all resource usages located on this resource. + * . + * \param cnst the lmm_constraint_t associated to the resource */ double lmm_constraint_get_usage(lmm_constraint_t cnst) { double usage = 0.0; xbt_swag_t elem_list = &(cnst->enabled_element_set); void *_elem; - lmm_element_t elem = nullptr; xbt_swag_foreach(_elem, elem_list) { - elem = (lmm_element_t)_elem; - if ((elem->value > 0)) { + lmm_element_t elem = (lmm_element_t)_elem; + if (elem->value > 0) { if (cnst->sharing_policy) usage += elem->value * elem->variable->value; else if (usage < elem->value * elem->variable->value) - usage = elem->value * elem->variable->value; + usage = std::max(usage, elem->value * elem->variable->value); } } return usage;