X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9371d0958b1cb03eb1ad4ccc8d2ba04416b4fd28..b857f66adac2e677a8a2642afe500e9a5f19e474:/src/instr/instr_interface.c diff --git a/src/instr/instr_interface.c b/src/instr/instr_interface.c index 6c547ee6b1..263f3c6872 100644 --- a/src/instr/instr_interface.c +++ b/src/instr/instr_interface.c @@ -12,8 +12,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_api, instr, "API"); -xbt_dict_t created_categories; - void TRACE_category(const char *category) { TRACE_category_with_color (category, NULL); @@ -21,7 +19,7 @@ void TRACE_category(const char *category) void TRACE_category_with_color (const char *category, const char *color) { - if (!TRACE_is_active()) + if (!(TRACE_is_active() && category != NULL)) return; xbt_assert1 (instr_platform_traced(), @@ -88,4 +86,62 @@ void TRACE_mark(const char *mark_type, const char *mark_value) pajeNewEvent(MSG_get_clock(), mark_type, "0", mark_value); } + +void TRACE_user_link_variable(double time, const char *resource, + const char *variable, + double value, const char *what) +{ + if (!TRACE_is_active()) + return; + + xbt_assert1 (instr_platform_traced(), + "%s must be called after environment creation", __FUNCTION__); + + char valuestr[100]; + snprintf(valuestr, 100, "%g", value); + + if (strcmp(what, "declare") == 0) { + instr_new_user_link_variable_type (variable, NULL); + } else{ + char *variable_id = instr_variable_type(variable, resource); + char *resource_id = instr_resource_type(resource); + if (strcmp(what, "set") == 0) { + pajeSetVariable(time, variable_id, resource_id, valuestr); + } else if (strcmp(what, "add") == 0) { + pajeAddVariable(time, variable_id, resource_id, valuestr); + } else if (strcmp(what, "sub") == 0) { + pajeSubVariable(time, variable_id, resource_id, valuestr); + } + } +} + +void TRACE_user_host_variable(double time, const char *variable, + double value, const char *what) +{ + if (!TRACE_is_active()) + return; + + xbt_assert1 (instr_platform_traced(), + "%s must be called after environment creation", __FUNCTION__); + + char valuestr[100]; + snprintf(valuestr, 100, "%g", value); + + if (strcmp(what, "declare") == 0) { + instr_new_user_host_variable_type (variable, NULL); + } else{ + char *host_name = MSG_host_self()->name; + char *variable_id = instr_variable_type(variable, host_name); + char *resource_id = instr_resource_type(host_name); + if (strcmp(what, "set") == 0) { + pajeSetVariable(time, variable_id, resource_id, valuestr); + } else if (strcmp(what, "add") == 0) { + pajeAddVariable(time, variable_id, resource_id, valuestr); + } else if (strcmp(what, "sub") == 0) { + pajeSubVariable(time, variable_id, resource_id, valuestr); + } + } +} + + #endif /* HAVE_TRACING */