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 "instr/config.h"
15 #include "surf/surf_private.h"
16 #include "surf/network_private.h"
20 extern routing_t used_routing;
22 void __TRACE_link_variable (double time, const char *src, const char *dst, const char *variable, double value, const char *what)
24 if (!IS_TRACING || !IS_TRACING_PLATFORM) return;
27 snprintf (valuestr, 100, "%g", value);
29 if (strcmp (what, "declare") == 0){
30 pajeDefineVariableType (variable, "LINK", variable);
34 if (!used_routing) return;
37 src_id = *(int*)xbt_dict_get(used_routing->host_id,src);
38 dst_id = *(int*)xbt_dict_get(used_routing->host_id,dst);
39 xbt_dynar_t route = used_routing->get_route(src_id, dst_id);
43 xbt_dynar_foreach(route, i, link_ptr) {
44 char *link = (*(link_CM02_t)link_ptr).lmm_resource.generic_resource.name;
46 if (strcmp (what, "set") == 0){
47 pajeSetVariable (time, variable, link, valuestr);
48 }else if (strcmp (what, "add") == 0){
49 pajeAddVariable (time, variable, link, valuestr);
50 }else if (strcmp (what, "sub") == 0){
51 pajeSubVariable (time, variable, link, valuestr);
56 void __TRACE_host_variable (double time, const char *variable, double value, const char *what)
58 if (!IS_TRACING || !IS_TRACING_PLATFORM) return;
61 snprintf (valuestr, 100, "%g", value);
63 if (strcmp (what, "declare") == 0){
64 pajeDefineVariableType (variable, "HOST", variable);
65 }else if (strcmp (what, "set") == 0){
66 pajeSetVariable (time, variable, MSG_host_self()->name, valuestr);
67 }else if (strcmp (what, "add") == 0){
68 pajeAddVariable (time, variable, MSG_host_self()->name, valuestr);
69 }else if (strcmp (what, "sub") == 0){
70 pajeSubVariable (time, variable, MSG_host_self()->name, valuestr);
75 #endif /* HAVE_TRACING */