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 */
#include "instr/instr_private.h"
#include "surf/surf_private.h"
+#include "surf/network_gtnets_private.h"
#ifdef HAVE_TRACING
}
/* 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)
{
+ 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)
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);
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;
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();
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;