Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
gtnets tracing possible again, updated to latest routing
authorLucas Schnorr <Lucas.Schnorr@imag.fr>
Thu, 14 Apr 2011 06:59:37 +0000 (08:59 +0200)
committerLucas Schnorr <Lucas.Schnorr@imag.fr>
Thu, 14 Apr 2011 06:59:37 +0000 (08:59 +0200)
src/instr/instr_private.h
src/instr/instr_surf.c
src/surf/network_gtnets.c
src/surf/network_gtnets_private.h

index 4a7a725..39e25c1 100644 (file)
@@ -135,9 +135,7 @@ void TRACE_surf_link_set_latency(double date, const char *resource, double laten
 void TRACE_surf_action(surf_action_t surf_action, const char *category);
 
 //for tracing gtnets
 void TRACE_surf_action(surf_action_t surf_action, const char *category);
 
 //for tracing gtnets
-void TRACE_surf_gtnets_communicate(void *action, int src, int dst);
-int TRACE_surf_gtnets_get_src(void *action);
-int TRACE_surf_gtnets_get_dst(void *action);
+void TRACE_surf_gtnets_communicate(void *action, const char *src, const char *dst);
 void TRACE_surf_gtnets_destroy(void *action);
 
 /* from smpi_instr.c */
 void TRACE_surf_gtnets_destroy(void *action);
 
 /* from smpi_instr.c */
index 4318df0..de520c9 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "instr/instr_private.h"
 #include "surf/surf_private.h"
 
 #include "instr/instr_private.h"
 #include "surf/surf_private.h"
+#include "surf/network_gtnets_private.h"
 
 #ifdef HAVE_TRACING
 
 
 #ifdef HAVE_TRACING
 
@@ -53,22 +54,18 @@ void TRACE_surf_link_set_latency(double date, const char *resource, double laten
 }
 
 /* to trace gtnets */
 }
 
 /* to trace gtnets */
-void TRACE_surf_gtnets_communicate(void *action, int src, int dst)
+void TRACE_surf_gtnets_communicate(void *action, const char *src, const char *dst)
 {
 {
-}
-
-int TRACE_surf_gtnets_get_src(void *action)
-{
-  return -1;
-}
-
-int TRACE_surf_gtnets_get_dst(void *action)
-{
-  return -1;
+  surf_action_network_GTNETS_t gtnets_action = (surf_action_network_GTNETS_t)action;
+  gtnets_action->src_name = xbt_strdup (src);
+  gtnets_action->dst_name = xbt_strdup (dst);
 }
 
 void TRACE_surf_gtnets_destroy(void *action)
 {
 }
 
 void TRACE_surf_gtnets_destroy(void *action)
 {
+  surf_action_network_GTNETS_t gtnets_action = (surf_action_network_GTNETS_t)action;
+  xbt_free (gtnets_action->src_name);
+  xbt_free (gtnets_action->dst_name);
 }
 
 void TRACE_surf_action(surf_action_t surf_action, const char *category)
 }
 
 void TRACE_surf_action(surf_action_t surf_action, const char *category)
index efd9ad8..798320b 100644 (file)
@@ -271,18 +271,17 @@ static void update_actions_state(double now, double delta)
         trace_sent = action->generic_action.cost;
       }
       // tracing resource utilization
         trace_sent = action->generic_action.cost;
       }
       // tracing resource utilization
-// COMMENTED BY DAVID
-//       int src = TRACE_surf_gtnets_get_src (action);
-//       int dst = TRACE_surf_gtnets_get_dst (action);
-//       if (src != -1 && dst != -1){
-//         xbt_dynar_t route = used_routing->get_route(src, dst);
-//         network_link_GTNETS_t link;
-//         unsigned int i;
-//         xbt_dynar_foreach(route, i, link) {
-//              TRACE_surf_link_set_utilization (link->generic_resource.name,
-//             action->generic_action.data, trace_sent/delta, now-delta, delta);
-//         }
-//       }
+      xbt_dynar_t route = global_routing->get_route(action->src_name, action->dst_name);
+      network_link_GTNETS_t link;
+      unsigned int i;
+      xbt_dynar_foreach(route, i, link) {
+        TRACE_surf_link_set_utilization (link->generic_resource.name,
+            action->generic_action.data,
+            (surf_action_t) action,
+            trace_sent/delta,
+            now-delta,
+            delta);
+      }
 #endif
 
       XBT_DEBUG("Sent value returned by GTNetS : %f", sent);
 #endif
 
       XBT_DEBUG("Sent value returned by GTNetS : %f", sent);
@@ -356,7 +355,7 @@ static surf_action_t communicate(const char *src_name,
     xbt_die("Not route between host %s and host %s", src_name, dst_name);
   }
 #ifdef HAVE_TRACING
     xbt_die("Not route between host %s and host %s", src_name, dst_name);
   }
 #ifdef HAVE_TRACING
-  TRACE_surf_gtnets_communicate(action, src, dst);
+  TRACE_surf_gtnets_communicate(action, src_name, dst_name);
 #endif
 
   return (surf_action_t) action;
 #endif
 
   return (surf_action_t) action;
@@ -380,6 +379,13 @@ static int action_is_suspended(surf_action_t action)
   return 0;
 }
 
   return 0;
 }
 
+#ifdef HAVE_TRACING
+static void gtnets_action_set_category(surf_action_t action, const char *category)
+{
+  action->category = xbt_strdup (category);
+}
+#endif
+
 static void finalize(void)
 {
   gtnets_finalize();
 static void finalize(void)
 {
   gtnets_finalize();
@@ -407,6 +413,9 @@ static void surf_network_model_init_internal(void)
   surf_network_model->suspend = action_suspend;
   surf_network_model->resume = action_resume;
   surf_network_model->is_suspended = action_is_suspended;
   surf_network_model->suspend = action_suspend;
   surf_network_model->resume = action_resume;
   surf_network_model->is_suspended = action_is_suspended;
+#ifdef HAVE_TRACING
+  surf_network_model->set_category = gtnets_action_set_category;
+#endif
 
   surf_network_model->extension.network.communicate = communicate;
 
 
   surf_network_model->extension.network.communicate = communicate;
 
index b6acca5..0b42195 100644 (file)
@@ -26,6 +26,10 @@ typedef struct surf_action_network_GTNETS {
   lmm_variable_t variable;
   double rate;
   int suspended;
   lmm_variable_t variable;
   double rate;
   int suspended;
+#ifdef HAVE_TRACING
+  char *src_name;
+  char *dst_name;
+#endif //HAVE_TRACING
 } s_surf_action_network_GTNETS_t, *surf_action_network_GTNETS_t;
 
 xbt_dict_t network_card_ids;
 } s_surf_action_network_GTNETS_t, *surf_action_network_GTNETS_t;
 
 xbt_dict_t network_card_ids;