Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Indent include and src using this command:
[simgrid.git] / src / instr / variables_instr.c
index 9fb2106..303eada 100644 (file)
 
 #ifdef HAVE_TRACING
 
-// extern routing_t used_routing; // COMMENTED BY DAVID
 extern routing_global_t global_routing;
 
-void __TRACE_link_variable (double time, const char *src, const char *dst, const char *variable, double value, const char *what)
+void TRACE_user_link_variable(double time, const char *src,
+                              const char *dst, const char *variable,
+                              double value, const char *what)
 {
-       char valuestr[100];
-       //int src_id, dst_id;
-       xbt_dynar_t route = NULL;
-       unsigned int i;
-    void *link_ptr;
-    char *link = NULL;
-  if (!IS_TRACING || !IS_TRACING_PLATFORM) return;
+  if (!IS_TRACING || !IS_TRACING_PLATFORM)
+    return;
 
-  snprintf (valuestr, 100, "%g", value);
+  char valuestr[100];
+  snprintf(valuestr, 100, "%g", value);
 
-  if (strcmp (what, "declare") == 0){
-       pajeDefineVariableType (variable, "LINK", variable);
-       return;
+  if (strcmp(what, "declare") == 0) {
+    pajeDefineVariableType(variable, "LINK", variable);
+    return;
   }
 
-//   if (!used_routing) return;
-// 
-//   src_id = *(int*)xbt_dict_get(used_routing->host_id,src);
-//   dst_id = *(int*)xbt_dict_get(used_routing->host_id,dst);
-//   route = used_routing->get_route(src_id, dst_id);
+  if (!global_routing)
+    return;
 
-  if (!global_routing) return;
-  route = global_routing->get_route(src, dst);
-  
+  xbt_dynar_t route = global_routing->get_route(src, dst);
+  unsigned int i;
+  void *link_ptr;
   xbt_dynar_foreach(route, i, link_ptr) {
-       link = (*(link_CM02_t)link_ptr).lmm_resource.generic_resource.name;
+    char resource[100];
+    snprintf(resource, 100, "%p", link_ptr);
 
-       if (strcmp (what, "set") == 0){
-         pajeSetVariable (time, variable, link, valuestr);
-       }else if (strcmp (what, "add") == 0){
-         pajeAddVariable (time, variable, link, valuestr);
-       }else if (strcmp (what, "sub") == 0){
-         pajeSubVariable (time, variable, link, valuestr);
-       }
+    if (strcmp(what, "set") == 0) {
+      pajeSetVariable(time, variable, resource, valuestr);
+    } else if (strcmp(what, "add") == 0) {
+      pajeAddVariable(time, variable, resource, valuestr);
+    } else if (strcmp(what, "sub") == 0) {
+      pajeSubVariable(time, variable, resource, valuestr);
+    }
   }
 }
 
-void __TRACE_host_variable (double time, const char *variable, double value, const char *what)
+void TRACE_user_host_variable(double time, const char *variable,
+                              double value, const char *what)
 {
-       char valuestr[100];
-  if (!IS_TRACING || !IS_TRACING_PLATFORM) return;
+  char valuestr[100];
+  if (!IS_TRACING || !IS_TRACING_PLATFORM)
+    return;
 
-  snprintf (valuestr, 100, "%g", value);
+  snprintf(valuestr, 100, "%g", value);
 
-  if (strcmp (what, "declare") == 0){
-       pajeDefineVariableType (variable, "HOST", variable);
-  }else if (strcmp (what, "set") == 0){
-       pajeSetVariable (time, variable, MSG_host_self()->name, valuestr);
-  }else if (strcmp (what, "add") == 0){
-       pajeAddVariable (time, variable, MSG_host_self()->name, valuestr);
-  }else if (strcmp (what, "sub") == 0){
-       pajeSubVariable (time, variable, MSG_host_self()->name, valuestr);
+  if (strcmp(what, "declare") == 0) {
+    pajeDefineVariableType(variable, "HOST", variable);
+  } else if (strcmp(what, "set") == 0) {
+    pajeSetVariable(time, variable, MSG_host_self()->name, valuestr);
+  } else if (strcmp(what, "add") == 0) {
+    pajeAddVariable(time, variable, MSG_host_self()->name, valuestr);
+  } else if (strcmp(what, "sub") == 0) {
+    pajeSubVariable(time, variable, MSG_host_self()->name, valuestr);
   }
 }
 
-
-#endif /* HAVE_TRACING */
+#endif                          /* HAVE_TRACING */