Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] adding new way of set user variables for links, by providing src and dst
authorLucas Schnorr <Lucas.Schnorr@inf.ufrgs.br>
Tue, 24 May 2011 09:19:11 +0000 (11:19 +0200)
committerLucas Schnorr <Lucas.Schnorr@inf.ufrgs.br>
Tue, 24 May 2011 12:42:26 +0000 (14:42 +0200)
details:
- instrumentation gets the routes between src and dst
and set the variable for all the links of the route

include/instr/instr.h
src/instr/instr_interface.c

index 6309b7d..4449bdd 100644 (file)
@@ -47,6 +47,13 @@ XBT_PUBLIC(void) TRACE_user_variable(double time,
                               const char *father_type,
                               double value,
                               InstrUserVariable what);
                               const char *father_type,
                               double value,
                               InstrUserVariable what);
+XBT_PUBLIC(void) TRACE_user_srcdst_variable(double time,
+                              const char *src,
+                              const char *dst,
+                              const char *variable,
+                              const char *father_type,
+                              double value,
+                              InstrUserVariable what);
 
 #define TRACE_host_variable_declare(var) \
        TRACE_user_variable(0,NULL,var,"HOST",0,INSTR_US_DECLARE);
 
 #define TRACE_host_variable_declare(var) \
        TRACE_user_variable(0,NULL,var,"HOST",0,INSTR_US_DECLARE);
@@ -90,6 +97,26 @@ XBT_PUBLIC(void) TRACE_user_variable(double time,
 #define TRACE_link_variable_sub(link,var,value) \
        TRACE_user_variable(MSG_get_clock(),link,var,"LINK",value,INSTR_US_SUB);
 
 #define TRACE_link_variable_sub(link,var,value) \
        TRACE_user_variable(MSG_get_clock(),link,var,"LINK",value,INSTR_US_SUB);
 
+//user provides src and dst, we set the value for the variables of all
+//links connecting src and dst
+#define TRACE_link_srcdst_variable_set_with_time(time,src,dst,var,value) \
+  TRACE_user_srcdst_variable(time,src,dst,,var,"LINK",value,INSTR_US_SET);
+
+#define TRACE_link_srcdst_variable_add_with_time(time,src,dst,var,value) \
+  TRACE_user_srcdst_variable(time,src,dst,var,"LINK",value,INSTR_US_ADD);
+
+#define TRACE_link_srcdst_variable_sub_with_time(time,src,dst,var,value) \
+  TRACE_user_srcdst_variable(time,src,dst,var,"LINK",value,INSTR_US_SUB);
+
+#define TRACE_link_srcdst_variable_set(src,dst,var,value) \
+  TRACE_user_srcdst_variable(MSG_get_clock(),src,dst,var,"LINK",value,INSTR_US_SET);
+
+#define TRACE_link_srcdst_variable_add(src,dst,var,value) \
+  TRACE_user_srcdst_variable(MSG_get_clock(),src,dst,var,"LINK",value,INSTR_US_ADD);
+
+#define TRACE_link_srcdst_variable_sub(src,dst,var,value) \
+  TRACE_user_srcdst_variable(MSG_get_clock(),src,dst,var,"LINK",value,INSTR_US_SUB);
+
 #else                           /* HAVE_TRACING */
 
 #define TRACE_category(category)
 #else                           /* HAVE_TRACING */
 
 #define TRACE_category(category)
@@ -118,6 +145,14 @@ XBT_PUBLIC(void) TRACE_user_variable(double time,
 #define TRACE_link_variable_set(link,var,value)
 #define TRACE_link_variable_add(link,var,value)
 #define TRACE_link_variable_sub(link,var,value)
 #define TRACE_link_variable_set(link,var,value)
 #define TRACE_link_variable_add(link,var,value)
 #define TRACE_link_variable_sub(link,var,value)
+#define TRACE_link_srcdst_variable_set_with_time(time,src,dst,var,value)
+#define TRACE_link_srcdst_variable_add_with_time(time,src,dst,var,value)
+#define TRACE_link_srcdst_variable_sub_with_time(time,src,dst,var,value)
+#define TRACE_link_srcdst_variable_set(src,dst,var,value)
+#define TRACE_link_srcdst_variable_add(src,dst,var,value)
+#define TRACE_link_srcdst_variable_sub(src,dst,var,value)
+
+
 
 #endif                          /* HAVE_TRACING */
 
 
 #endif                          /* HAVE_TRACING */
 
index df4d026..17515ef 100644 (file)
@@ -9,6 +9,7 @@
 #ifdef HAVE_TRACING
 
 #include "instr/instr_private.h"
 #ifdef HAVE_TRACING
 
 #include "instr/instr_private.h"
+#include "surf/network_private.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_api, instr, "API");
 
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_api, instr, "API");
 
@@ -135,6 +136,23 @@ void TRACE_user_variable(double time,
   }
 }
 
   }
 }
 
+void TRACE_user_srcdst_variable(double time,
+                              const char *src,
+                              const char *dst,
+                              const char *variable,
+                              const char *father_type,
+                              double value,
+                              InstrUserVariable what)
+{
+  xbt_dynar_t route = global_routing->get_route (src, dst);
+  unsigned int i;
+  void *link;
+  xbt_dynar_foreach (route, i, link) {
+    char *link_name = ((link_CM02_t)link)->lmm_resource.generic_resource.name;
+    TRACE_user_variable (time, link_name, variable, father_type, value, what);
+  }
+}
+
 const char *TRACE_node_name (xbt_node_t node)
 {
   void *data = xbt_graph_node_get_data(node);
 const char *TRACE_node_name (xbt_node_t node)
 {
   void *data = xbt_graph_node_get_data(node);