Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
removing old and no longer used tracing functions
[simgrid.git] / src / instr / variables_instr.c
1 /* Copyright (c) 2010. The SimGrid Team.
2  * All rights reserved.                                                     */
3
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. */
6
7 #include "instr/private.h"
8 #include "surf/surf_private.h"
9 #include "surf/network_private.h"
10
11 #ifdef HAVE_TRACING
12
13 extern routing_global_t global_routing;
14
15 void __TRACE_link_variable (double time, const char *src, const char *dst, const char *variable, double value, const char *what)
16 {
17   char valuestr[100];
18   xbt_dynar_t route = NULL;
19   unsigned int i;
20   void *link_ptr;
21   char *link = NULL;
22   if (!IS_TRACING || !IS_TRACING_PLATFORM) return;
23
24   snprintf (valuestr, 100, "%g", value);
25
26   if (strcmp (what, "declare") == 0){
27     pajeDefineVariableType (variable, "LINK", variable);
28     return;
29   }
30
31   if (!global_routing) return;
32   route = global_routing->get_route(src, dst);
33
34   xbt_dynar_foreach(route, i, link_ptr) {
35     link = (*(link_CM02_t)link_ptr).lmm_resource.generic_resource.name;
36
37     if (strcmp (what, "set") == 0){
38       pajeSetVariable (time, variable, link, valuestr);
39     }else if (strcmp (what, "add") == 0){
40       pajeAddVariable (time, variable, link, valuestr);
41     }else if (strcmp (what, "sub") == 0){
42       pajeSubVariable (time, variable, link, valuestr);
43     }
44   }
45 }
46
47 void __TRACE_host_variable (double time, const char *variable, double value, const char *what)
48 {
49   char valuestr[100];
50   if (!IS_TRACING || !IS_TRACING_PLATFORM) return;
51
52   snprintf (valuestr, 100, "%g", value);
53
54   if (strcmp (what, "declare") == 0){
55     pajeDefineVariableType (variable, "HOST", variable);
56   }else if (strcmp (what, "set") == 0){
57     pajeSetVariable (time, variable, MSG_host_self()->name, valuestr);
58   }else if (strcmp (what, "add") == 0){
59     pajeAddVariable (time, variable, MSG_host_self()->name, valuestr);
60   }else if (strcmp (what, "sub") == 0){
61     pajeSubVariable (time, variable, MSG_host_self()->name, valuestr);
62   }
63 }
64
65 #endif /* HAVE_TRACING */