Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
TRACE_surf_[host|link]_declaration responsible for create containers
authorschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 1 Oct 2010 15:20:43 +0000 (15:20 +0000)
committerschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 1 Oct 2010 15:20:43 +0000 (15:20 +0000)
todo:
- end points still not present on the trace

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8320 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/instr/private.h
src/instr/surf_instr.c

index eea811f..eefc370 100644 (file)
@@ -120,7 +120,6 @@ void TRACE_surf_host_vivaldi_parse (char *host, double x, double y, double h);
 void TRACE_surf_link_declaration (char *name, double bw, double lat);
 void TRACE_surf_link_set_bandwidth (double date, char *resource, double bandwidth);
 void TRACE_surf_link_set_latency (double date, char *resource, double latency);
-void TRACE_surf_link_save_endpoints (char *link_name, int src, int dst);
 void TRACE_surf_link_missing (void);
 void TRACE_msg_clean (void);
 
index 66ce712..a559cf7 100644 (file)
@@ -12,16 +12,9 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(tracing_surf,tracing,"Tracing Surf");
 
 #define VARIABLE_SEPARATOR '#'
 
-static xbt_dict_t host_router_id; //name(char*) -> id(char*)
-static xbt_dict_t host_router_name; //id(char*) -> name (char*)
-
 static xbt_dict_t created_links;
-static xbt_dict_t link_bandwidth; //name(char*) -> bandwidth(double)
-static xbt_dict_t link_latency;   //name(char*) -> latency(double)
 static xbt_dict_t host_containers;
-
 static xbt_dict_t platform_variables; /* host or link name -> array of categories */
-
 static xbt_dict_t resource_variables; /* (host|link)#variable -> value */
 
 /* to trace gtnets */
@@ -30,11 +23,7 @@ static xbt_dict_t gtnets_dst; /* %p (action) -> %s */
 
 void __TRACE_surf_init (void)
 {
-  host_router_id = xbt_dict_new();
-  host_router_name = xbt_dict_new();
   created_links = xbt_dict_new();
-  link_bandwidth = xbt_dict_new();
-  link_latency = xbt_dict_new();
   platform_variables = xbt_dict_new();
   host_containers = xbt_dict_new();
   resource_variables = xbt_dict_new ();
@@ -100,19 +89,22 @@ void __TRACE_surf_set_resource_variable (double date, const char *variable, cons
  * information is used in the future to create the link container in the trace.
  *
  * caller: net_link_new (from each network model)
- * main: save bandwidth and latency information
+ * main: create LINK container, set initial bandwidth and latency
  * return: void
  */
 void TRACE_surf_link_declaration (char *name, double bw, double lat)
 {
   if (!IS_TRACING) return;
 
-  double *bw_ptr = xbt_malloc(sizeof(double));
-  double *lat_ptr = xbt_malloc(sizeof(double));
-  *bw_ptr = bw;
-  *lat_ptr = lat;
-  xbt_dict_set (link_bandwidth, name, bw_ptr, xbt_free);
-  xbt_dict_set (link_latency, name, lat_ptr, xbt_free);
+  if (strcmp (name, "__loopback__")==0 ||
+      strcmp (name, "loopback")==0){ //ignore loopback updates
+    return;
+  }
+
+  pajeCreateContainer (SIMIX_get_clock(), name, "LINK", "platform", name);
+  xbt_dict_set (created_links, name, xbt_strdup ("1"), xbt_free);
+  TRACE_surf_link_set_bandwidth (SIMIX_get_clock(), name, bw);
+  TRACE_surf_link_set_latency (SIMIX_get_clock(), name, lat);
 }
 
 /*
@@ -129,64 +121,7 @@ void TRACE_surf_host_declaration (char *name, double power)
   if (!IS_TRACING) return;
   pajeCreateContainer (SIMIX_get_clock(), name, "HOST", "platform", name);
   xbt_dict_set (host_containers, name, xbt_strdup("1"), xbt_free);
-  if (IS_TRACING_PLATFORM){
-    __TRACE_surf_set_resource_variable (SIMIX_get_clock(), "power", name, power);
-  }
-}
-
-/*
- * TRACE_surf_link_save_endpoints (link_name, src, dst): this function
- * creates the container of a link identified by link_name. It gets
- * bandwidth and latency information from the dictionaries previously
- * filled. The end points are obtained from the host_router_name dictionary.
- *
- * caller: end of parsing
- * main: create LINK containers, set initial bandwidth and latency values
- * return: void
- */
-void TRACE_surf_link_save_endpoints (char *link_name, int src, int dst)
-{
-       char srcidstr[100], dstidstr[100];
-       char key[100];
-
-  if (!IS_TRACING) return;
-  snprintf (srcidstr, 100, "%d", src);
-  snprintf (dstidstr, 100, "%d", dst);
-  char *srcname = xbt_dict_get (host_router_name, srcidstr);
-  char *dstname = xbt_dict_get (host_router_name, dstidstr);
-  snprintf (key, 100, "l%d-%d", src, dst);
-
-  if (strcmp (link_name, "__loopback__")==0 ||
-      strcmp (link_name, "loopback")==0){ //ignore loopback updates
-    return;
-  }
-
-  if (!xbt_dict_get_or_null (created_links, link_name)){
-    double *bw = xbt_dict_get (link_bandwidth, link_name);
-    double *lat = xbt_dict_get (link_latency, link_name);
-    pajeCreateContainerWithBandwidthLatencySrcDst (SIMIX_get_clock(), link_name, "LINK", "platform", link_name, *bw, *lat, srcname, dstname);
-    if (IS_TRACING_PLATFORM) __TRACE_surf_set_resource_variable (SIMIX_get_clock(), "bandwidth", link_name, *bw);
-    if (IS_TRACING_PLATFORM) __TRACE_surf_set_resource_variable (SIMIX_get_clock(), "latency", link_name, *lat);
-    xbt_dict_set (created_links, link_name, xbt_strdup ("1"), xbt_free);
-  }
-}
-
-/*
- * TRACE_surf_host_define_id (name, host_id): This function relates
- * the name of the host with its id, as generated by the called and
- * passed as second parameter.
- *
- * caller: host parser, router parser
- * main: save host_id
- * return: void
- */
-void TRACE_surf_host_define_id (const char *name, int host_id)
-{
-  if (!IS_TRACING) return;
-  char strid[100];
-  snprintf (strid, 100, "%d", host_id);
-  xbt_dict_set (host_router_id, name, xbt_strdup(strid), xbt_free);
-  xbt_dict_set (host_router_name, strid, xbt_strdup(name), xbt_free);
+  TRACE_surf_host_set_power (SIMIX_get_clock(), name, power);
 }
 
 void TRACE_surf_host_set_power (double date, char *resource, double power)