X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/159761f29d41e8cfd0636d56a182f9481eff279c..89782b59c2b44de658a46b7f6262075b723cf9b1:/src/instr/instr_resource_utilization.c diff --git a/src/instr/instr_resource_utilization.c b/src/instr/instr_resource_utilization.c index 9e0921cf2a..96d21b2af3 100644 --- a/src/instr/instr_resource_utilization.c +++ b/src/instr/instr_resource_utilization.c @@ -39,7 +39,7 @@ static void __TRACE_surf_check_variable_set_to_zero(double now, xbt_dynar_t array = xbt_dynar_new(sizeof(char *), xbt_free); char *var_cpy = xbt_strdup(variable); xbt_dynar_push(array, &var_cpy); - if (TRACE_platform_is_enabled()) + if (TRACE_categorized ()) pajeSetVariable(now, variable, resource, "0"); xbt_dict_set(platform_variables, resource, array, xbt_dynar_free_voidp); @@ -56,7 +56,7 @@ static void __TRACE_surf_check_variable_set_to_zero(double now, if (flag == 0) { char *var_cpy = xbt_strdup(variable); xbt_dynar_push(array, &var_cpy); - if (TRACE_platform_is_enabled()) + if (TRACE_categorized ()) pajeSetVariable(now, variable, resource, "0"); } } @@ -267,7 +267,7 @@ static void __TRACE_C_end(smx_action_t action) /* * TRACE_surf_link_set_utilization: entry point from SimGrid */ -void TRACE_surf_link_set_utilization(void *link, smx_action_t smx_action, +void TRACE_surf_link_set_utilization(const char *resource, smx_action_t smx_action, surf_action_t surf_action, double value, double now, double delta) @@ -277,36 +277,42 @@ void TRACE_surf_link_set_utilization(void *link, smx_action_t smx_action, if (!value) return; //only trace link utilization if link is known by tracing mechanism - if (!TRACE_surf_link_is_traced(link)) + if (!instr_link_is_traced(resource)) return; if (!value) return; - char resource[100]; - snprintf(resource, 100, "%p", link); + //get link type + char *link_type = instr_link_type (resource); //trace uncategorized link utilization if (TRACE_uncategorized()){ DEBUG4("UNCAT LINK [%f - %f] %s bandwidth_used %f", now, now+delta, resource, value); + char bandwidth_used_type[INSTR_DEFAULT_STR_SIZE]; + snprintf (bandwidth_used_type, INSTR_DEFAULT_STR_SIZE, "bandwidth_used-%s", link_type); TRACE_surf_resource_utilization_event(smx_action, now, delta, - "bandwidth_used", resource, value); + bandwidth_used_type, resource, value); } //trace categorized utilization - if (!surf_action->category) - return; - char type[100]; - snprintf(type, 100, "b%s", surf_action->category); - DEBUG5("CAT LINK [%f - %f] %s %s %f", now, now+delta, resource, type, value); - TRACE_surf_resource_utilization_event(smx_action, now, delta, type, - resource, value); + if (TRACE_categorized()){ + if (!surf_action->category) + return; + + char cat_bw_used_type[INSTR_DEFAULT_STR_SIZE]; + snprintf (cat_bw_used_type, INSTR_DEFAULT_STR_SIZE, "%s-%s", surf_action->category, link_type); + + DEBUG5("CAT LINK [%f - %f] %s %s %f", now, now+delta, resource, cat_bw_used_type, value); + TRACE_surf_resource_utilization_event(smx_action, now, delta, cat_bw_used_type, + resource, value); + } return; } /* * TRACE_surf_host_set_utilization: entry point from SimGrid */ -void TRACE_surf_host_set_utilization(const char *name, +void TRACE_surf_host_set_utilization(const char *resource, smx_action_t smx_action, surf_action_t surf_action, double value, double now, @@ -317,21 +323,30 @@ void TRACE_surf_host_set_utilization(const char *name, if (!value) return; + //get host type + char *host_type = instr_host_type (resource); + //trace uncategorized host utilization if (TRACE_uncategorized()){ - DEBUG4("UNCAT HOST [%f - %f] %s power_used %f", now, now+delta, name, value); + DEBUG4("UNCAT HOST [%f - %f] %s power_used %f", now, now+delta, resource, value); + char power_used_type[INSTR_DEFAULT_STR_SIZE]; + snprintf (power_used_type, INSTR_DEFAULT_STR_SIZE, "power_used-%s", host_type); TRACE_surf_resource_utilization_event(smx_action, now, delta, - "power_used", name, value); + power_used_type, resource, value); } //trace categorized utilization - if (!surf_action->category) - return; - char type[100]; - snprintf(type, 100, "p%s", surf_action->category); - DEBUG5("CAT HOST [%f - %f] %s %s %f", now, now+delta, name, type, value); - TRACE_surf_resource_utilization_event(smx_action, now, delta, type, name, - value); + if (TRACE_categorized()){ + if (!surf_action->category) + return; + + char cat_p_used_type[INSTR_DEFAULT_STR_SIZE]; + snprintf (cat_p_used_type, INSTR_DEFAULT_STR_SIZE, "%s-%s", surf_action->category, host_type); + + DEBUG5("CAT HOST [%f - %f] %s %s %f", now, now+delta, resource, cat_p_used_type, value); + TRACE_surf_resource_utilization_event(smx_action, now, delta, cat_p_used_type, resource, + value); + } return; }