From: schnorr Date: Mon, 13 Dec 2010 16:44:35 +0000 (+0000) Subject: [trace] updating the tracing of user host variables to the new way hosts are created X-Git-Tag: v3.6_beta2~756 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/e30398c22a922e2238c303852d782e00f1296115 [trace] updating the tracing of user host variables to the new way hosts are created git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9167 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/instr/instr_variables.c b/src/instr/instr_variables.c index 8b5c973f67..f7c497eafa 100644 --- a/src/instr/instr_variables.c +++ b/src/instr/instr_variables.c @@ -10,61 +10,79 @@ #ifdef HAVE_TRACING -extern routing_global_t global_routing; +//extern routing_global_t global_routing; +extern xbt_dict_t hosts_types; +extern xbt_dict_t links_types; void TRACE_user_link_variable(double time, const char *src, const char *dst, const char *variable, double value, const char *what) { - if (!TRACE_is_active() || !TRACE_categorized ()) + xbt_die ("deprecated"); +// FIXME +// if (!TRACE_is_active() || !TRACE_categorized ()) +// return; +// +// char valuestr[100]; +// snprintf(valuestr, 100, "%g", value); +// +// if (strcmp(what, "declare") == 0) { +// pajeDefineVariableType(variable, "LINK", variable); +// return; +// } +// +// if (!global_routing) +// return; +// +// xbt_dynar_t route = global_routing->get_route(src, dst); +// unsigned int i; +// void *link_ptr; +// xbt_dynar_foreach(route, i, link_ptr) { +// char resource[100]; +// snprintf(resource, 100, "%p", link_ptr); +// +// if (strcmp(what, "set") == 0) { +// pajeSetVariable(time, variable, resource, valuestr); +// } else if (strcmp(what, "add") == 0) { +// pajeAddVariable(time, variable, resource, valuestr); +// } else if (strcmp(what, "sub") == 0) { +// pajeSubVariable(time, variable, resource, valuestr); +// } +// } +} + +void TRACE_user_host_variable(double time, const char *variable, + double value, const char *what) +{ + if (!TRACE_is_active()) return; char valuestr[100]; snprintf(valuestr, 100, "%g", value); if (strcmp(what, "declare") == 0) { - pajeDefineVariableType(variable, "LINK", variable); - return; - } - - if (!global_routing) - return; - - xbt_dynar_t route = global_routing->get_route(src, dst); - unsigned int i; - void *link_ptr; - xbt_dynar_foreach(route, i, link_ptr) { - char resource[100]; - snprintf(resource, 100, "%p", link_ptr); + char new_type[INSTR_DEFAULT_STR_SIZE]; + xbt_dict_cursor_t cursor = NULL; + char *type; + void *data; + xbt_dict_foreach(hosts_types, cursor, type, data) { + snprintf (new_type, INSTR_DEFAULT_STR_SIZE, "%s-%s", variable, type); + pajeDefineVariableType (new_type, type, variable); + } + } else{ + char *host_name = MSG_host_self()->name; + char *host_type = instr_host_type (host_name); + char variable_type[INSTR_DEFAULT_STR_SIZE]; + snprintf (variable_type, INSTR_DEFAULT_STR_SIZE, "%s-%s", variable, host_type); if (strcmp(what, "set") == 0) { - pajeSetVariable(time, variable, resource, valuestr); + pajeSetVariable(time, variable_type, host_name, valuestr); } else if (strcmp(what, "add") == 0) { - pajeAddVariable(time, variable, resource, valuestr); + pajeAddVariable(time, variable_type, host_name, valuestr); } else if (strcmp(what, "sub") == 0) { - pajeSubVariable(time, variable, resource, valuestr); + pajeSubVariable(time, variable_type, host_name, valuestr); } } } -void TRACE_user_host_variable(double time, const char *variable, - double value, const char *what) -{ - char valuestr[100]; - if (!TRACE_is_active() || !TRACE_categorized ()) - return; - - snprintf(valuestr, 100, "%g", value); - - if (strcmp(what, "declare") == 0) { - pajeDefineVariableType(variable, "HOST", variable); - } else if (strcmp(what, "set") == 0) { - pajeSetVariable(time, variable, MSG_host_self()->name, valuestr); - } else if (strcmp(what, "add") == 0) { - pajeAddVariable(time, variable, MSG_host_self()->name, valuestr); - } else if (strcmp(what, "sub") == 0) { - pajeSubVariable(time, variable, MSG_host_self()->name, valuestr); - } -} - #endif /* HAVE_TRACING */