1 /* Copyright (c) 2010. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #include "instr/instr_private.h"
8 #include "surf/surf_private.h"
9 #include "surf/network_private.h"
13 //extern routing_global_t global_routing;
14 extern xbt_dict_t hosts_types;
15 extern xbt_dict_t links_types;
17 void TRACE_user_link_variable(double time, const char *src,
18 const char *dst, const char *variable,
19 double value, const char *what)
21 xbt_die ("deprecated");
23 // if (!TRACE_is_active() || !TRACE_categorized ())
26 // char valuestr[100];
27 // snprintf(valuestr, 100, "%g", value);
29 // if (strcmp(what, "declare") == 0) {
30 // pajeDefineVariableType(variable, "LINK", variable);
34 // if (!global_routing)
37 // xbt_dynar_t route = global_routing->get_route(src, dst);
40 // xbt_dynar_foreach(route, i, link_ptr) {
41 // char resource[100];
42 // snprintf(resource, 100, "%p", link_ptr);
44 // if (strcmp(what, "set") == 0) {
45 // pajeSetVariable(time, variable, resource, valuestr);
46 // } else if (strcmp(what, "add") == 0) {
47 // pajeAddVariable(time, variable, resource, valuestr);
48 // } else if (strcmp(what, "sub") == 0) {
49 // pajeSubVariable(time, variable, resource, valuestr);
54 void TRACE_user_host_variable(double time, const char *variable,
55 double value, const char *what)
57 if (!TRACE_is_active())
61 snprintf(valuestr, 100, "%g", value);
63 if (strcmp(what, "declare") == 0) {
64 char new_type[INSTR_DEFAULT_STR_SIZE];
65 xbt_dict_cursor_t cursor = NULL;
68 xbt_dict_foreach(hosts_types, cursor, type, data) {
69 snprintf (new_type, INSTR_DEFAULT_STR_SIZE, "%s-%s", variable, type);
70 pajeDefineVariableType (new_type, type, variable);
73 char *host_name = MSG_host_self()->name;
74 char *host_type = instr_host_type (host_name);
75 char variable_type[INSTR_DEFAULT_STR_SIZE];
76 snprintf (variable_type, INSTR_DEFAULT_STR_SIZE, "%s-%s", variable, host_type);
78 if (strcmp(what, "set") == 0) {
79 pajeSetVariable(time, variable_type, host_name, valuestr);
80 } else if (strcmp(what, "add") == 0) {
81 pajeAddVariable(time, variable_type, host_name, valuestr);
82 } else if (strcmp(what, "sub") == 0) {
83 pajeSubVariable(time, variable_type, host_name, valuestr);
88 #endif /* HAVE_TRACING */