4 * Created on: Feb 23, 2010
5 * Author: Lucas Schnorr
6 * License: This program is free software; you can redistribute
7 * it and/or modify it under the terms of the license
8 * (GNU LGPL) which comes with this package.
10 * Copyright (c) 2009 The SimGrid team.
13 #include "instr/private.h"
14 #include "surf/surf_private.h"
15 #include "surf/network_private.h"
19 extern routing_t used_routing;
21 void __TRACE_link_variable (double time, const char *src, const char *dst, const char *variable, double value, const char *what)
23 if (!IS_TRACING || !IS_TRACING_PLATFORM) return;
26 snprintf (valuestr, 100, "%g", value);
28 if (strcmp (what, "declare") == 0){
29 pajeDefineVariableType (variable, "LINK", variable);
33 if (!used_routing) return;
36 src_id = *(int*)xbt_dict_get(used_routing->host_id,src);
37 dst_id = *(int*)xbt_dict_get(used_routing->host_id,dst);
38 xbt_dynar_t route = used_routing->get_route(src_id, dst_id);
42 xbt_dynar_foreach(route, i, link_ptr) {
43 char *link = (*(link_CM02_t)link_ptr).lmm_resource.generic_resource.name;
45 if (strcmp (what, "set") == 0){
46 pajeSetVariable (time, variable, link, valuestr);
47 }else if (strcmp (what, "add") == 0){
48 pajeAddVariable (time, variable, link, valuestr);
49 }else if (strcmp (what, "sub") == 0){
50 pajeSubVariable (time, variable, link, valuestr);
55 void __TRACE_host_variable (double time, const char *variable, double value, const char *what)
57 if (!IS_TRACING || !IS_TRACING_PLATFORM) return;
60 snprintf (valuestr, 100, "%g", value);
62 if (strcmp (what, "declare") == 0){
63 pajeDefineVariableType (variable, "HOST", variable);
64 }else if (strcmp (what, "set") == 0){
65 pajeSetVariable (time, variable, MSG_host_self()->name, valuestr);
66 }else if (strcmp (what, "add") == 0){
67 pajeAddVariable (time, variable, MSG_host_self()->name, valuestr);
68 }else if (strcmp (what, "sub") == 0){
69 pajeSubVariable (time, variable, MSG_host_self()->name, valuestr);
74 #endif /* HAVE_TRACING */