Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
registering the source and destination of all onelink routes
authorschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 5 Oct 2010 13:16:06 +0000 (13:16 +0000)
committerschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 5 Oct 2010 13:16:06 +0000 (13:16 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8349 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/instr/interface.c
src/instr/private.h
src/instr/surf_instr.c
src/simix/smx_environment.c

index d8f0bf8..3f998aa 100644 (file)
@@ -53,6 +53,8 @@ int TRACE_start ()
     pajeDefineVariableType ("power", "HOST", "power");
     pajeDefineVariableType ("bandwidth", "LINK", "bandwidth");
     pajeDefineVariableType ("latency", "LINK", "latency");
+    pajeDefineEventType ("source", "LINK", "source");
+    pajeDefineEventType ("destination", "LINK", "destination");
   }
 
   if (IS_TRACING_PROCESSES || IS_TRACING_VOLUME){
index 3ca43f5..d05ef5f 100644 (file)
@@ -111,6 +111,7 @@ void TRACE_surf_link_set_bandwidth (double date, void *link, double bandwidth);
 void TRACE_surf_link_set_latency (double date, void *link, double latency);
 void TRACE_surf_link_missing (void);
 void TRACE_msg_clean (void);
+void TRACE_surf_save_onelink (void);
 
 //for tracing gtnets
 void TRACE_surf_gtnets_communicate (void *action, int src, int dst);
index 29dd9f5..cb8cd7d 100644 (file)
@@ -5,6 +5,7 @@
   * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "instr/private.h"
+#include "surf/surf_private.h"
 
 #ifdef HAVE_TRACING
 
@@ -199,4 +200,29 @@ void TRACE_surf_host_vivaldi_parse (char *host, double x, double y, double h)
   pajeSetVariable (0, "vivaldi_h", host, valuestr);
 }
 
+extern routing_global_t global_routing;
+void TRACE_surf_save_onelink (void)
+{
+  if (!IS_TRACING) return;
+
+  //get the onelinks from the parsed platform
+  xbt_dynar_t onelink_routes = global_routing->get_onelink_routes();
+  if (!onelink_routes) return;
+
+  //save them in trace file
+  onelink_t onelink;
+  unsigned int iter;
+  xbt_dynar_foreach(onelink_routes, iter, onelink) {
+    char *src = onelink->src;
+    char *dst = onelink->dst;
+    void *link = onelink->link_ptr;
+
+    char resource[100];
+    snprintf (resource, 100, "%p", link);
+
+    pajeNewEvent (0.1, "source", resource, src);
+    pajeNewEvent (0.1, "destination", resource, dst);
+  }
+}
+
 #endif
index dd51dd0..982188a 100644 (file)
@@ -46,6 +46,10 @@ void SIMIX_create_environment(const char *file)
   end = xbt_os_time();
   DEBUG1("PARSE TIME: %lg", (end - start));
 
+#ifdef HAVE_TRACING
+  TRACE_surf_save_onelink ();
+#endif
+
   xbt_dict_foreach(surf_model_resource_set(surf_workstation_model), cursor,
                    name, workstation) {
     __SIMIX_host_create(name, workstation, NULL);