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/private.h"
8 #include "surf/surf_private.h"
9 #include "surf/network_private.h"
13 extern routing_t used_routing;
15 void __TRACE_link_variable (double time, const char *src, const char *dst, const char *variable, double value, const char *what)
19 xbt_dynar_t route = NULL;
23 if (!IS_TRACING || !IS_TRACING_PLATFORM) return;
25 snprintf (valuestr, 100, "%g", value);
27 if (strcmp (what, "declare") == 0){
28 pajeDefineVariableType (variable, "LINK", variable);
32 if (!used_routing) return;
34 src_id = *(int*)xbt_dict_get(used_routing->host_id,src);
35 dst_id = *(int*)xbt_dict_get(used_routing->host_id,dst);
36 route = used_routing->get_route(src_id, dst_id);
38 xbt_dynar_foreach(route, i, link_ptr) {
39 link = (*(link_CM02_t)link_ptr).lmm_resource.generic_resource.name;
41 if (strcmp (what, "set") == 0){
42 pajeSetVariable (time, variable, link, valuestr);
43 }else if (strcmp (what, "add") == 0){
44 pajeAddVariable (time, variable, link, valuestr);
45 }else if (strcmp (what, "sub") == 0){
46 pajeSubVariable (time, variable, link, valuestr);
51 void __TRACE_host_variable (double time, const char *variable, double value, const char *what)
54 if (!IS_TRACING || !IS_TRACING_PLATFORM) return;
56 snprintf (valuestr, 100, "%g", value);
58 if (strcmp (what, "declare") == 0){
59 pajeDefineVariableType (variable, "HOST", variable);
60 }else if (strcmp (what, "set") == 0){
61 pajeSetVariable (time, variable, MSG_host_self()->name, valuestr);
62 }else if (strcmp (what, "add") == 0){
63 pajeAddVariable (time, variable, MSG_host_self()->name, valuestr);
64 }else if (strcmp (what, "sub") == 0){
65 pajeSubVariable (time, variable, MSG_host_self()->name, valuestr);
70 #endif /* HAVE_TRACING */