Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[routing] rename routing_global_t -> routing_platf_t (and friends)
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 9 Apr 2012 18:44:47 +0000 (08:44 -1000)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 9 Apr 2012 18:44:47 +0000 (08:44 -1000)
One day maybe, this could be usefull to enable the declaration (and
simulation) of several platform within one simgrid run. But for now, I
mainly want to make the sg/platf interface less context sensitive and
more usual by expressing directly the AS to which elements are added.

14 files changed:
src/include/surf/surf.h
src/instr/instr_routing.c
src/surf/network_gtnets.c
src/surf/network_ns3.c
src/surf/surf_private.h
src/surf/surf_routing.c
src/surf/surf_routing_dijkstra.c
src/surf/surf_routing_floyd.c
src/surf/surf_routing_full.c
src/surf/surf_routing_rulebased.c
teshsuite/simdag/platforms/Evaluate_get_route_time.c
teshsuite/simdag/platforms/Evaluate_parse_time.c
teshsuite/simdag/platforms/basic_parsing_test.c
teshsuite/simdag/platforms/is_router_test.c

index d5d2114..0d6cd04 100644 (file)
@@ -147,8 +147,8 @@ typedef struct surf_action_state {
 /***************************/
 /* Generic model object */
 /***************************/
-typedef struct s_routing_global s_routing_global_t, *routing_global_t;
-XBT_PUBLIC_DATA(routing_global_t) global_routing;
+typedef struct s_routing_platf s_routing_platf_t, *routing_platf_t;
+XBT_PUBLIC_DATA(routing_platf_t) routing_platf;
 
 
 /** \ingroup SURF_models
index c00078e..d2c91ee 100644 (file)
@@ -329,7 +329,7 @@ static void instr_routing_parse_end_platform ()
   xbt_dynar_free(&currentContainer);
   currentContainer = NULL;
   xbt_dict_t filter = xbt_dict_new_homogeneous(xbt_free);
-  recursiveGraphExtraction (global_routing->root, PJ_container_get_root(), filter);
+  recursiveGraphExtraction (routing_platf->root, PJ_container_get_root(), filter);
   xbt_dict_free(&filter);
   platform_created = 1;
   TRACE_paje_dump_buffer(1);
@@ -514,7 +514,7 @@ xbt_graph_t instr_routing_platform_graph (void)
   xbt_graph_t ret = xbt_graph_new_graph (0, NULL);
   xbt_dict_t nodes = xbt_dict_new_homogeneous(NULL);
   xbt_dict_t edges = xbt_dict_new_homogeneous(NULL);
-  recursiveXBTGraphExtraction (ret, nodes, edges, global_routing->root, PJ_container_get_root());
+  recursiveXBTGraphExtraction (ret, nodes, edges, routing_platf->root, PJ_container_get_root());
   xbt_dict_free (&nodes);
   xbt_dict_free (&edges);
   return ret;
index 0ff71c7..7193b0d 100644 (file)
@@ -14,7 +14,7 @@ static double time_to_next_flow_completion = -1;
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network_gtnets, surf,
                                 "Logging specific to the SURF network GTNetS module");
 
-extern routing_global_t global_routing;
+extern routing_platf_t routing_platf;
 
 double sg_gtnets_jitter = 0.0;
 int sg_gtnets_jitter_seed = 10;
@@ -113,7 +113,7 @@ static void create_gtnets_topology(void)
 //   and then you can use the id to reimplement properly the following GTNets calls
 
    //get the onelinks from the parsed platform
-   xbt_dynar_t onelink_routes = global_routing->get_onelink_routes();
+   xbt_dynar_t onelink_routes = routing_platf->get_onelink_routes();
    if (!onelink_routes)
      return;
 
index 6741f6f..5083d94 100644 (file)
@@ -18,7 +18,7 @@ extern xbt_lib_t as_router_lib;
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network_ns3, surf,
                                 "Logging specific to the SURF network NS3 module");
 
-extern routing_global_t global_routing;
+extern routing_platf_t routing_platf;
 extern xbt_dict_t dict_socket;
 
 static double time_to_next_flow_completion = -1;
@@ -253,7 +253,7 @@ static void create_ns3_topology(void)
   xbt_dynar_shrink(IPV4addr,0);
 
   //get the onelinks from the parsed platform
-  xbt_dynar_t onelink_routes = global_routing->get_onelink_routes();
+  xbt_dynar_t onelink_routes = routing_platf->get_onelink_routes();
   if (!onelink_routes)
     xbt_die("There is no routes!");
   XBT_DEBUG("Have get_onelink_routes, found %ld routes",onelink_routes->used);
index 6e10c38..f115c12 100644 (file)
@@ -175,7 +175,7 @@ typedef struct s_as {
                            const char *dst, route_t e_route);
 } s_as_t;
 
-struct s_routing_global {
+struct s_routing_platf {
   AS_t root;
   void *loopback;
   xbt_dynar_t last_route;
index cf60159..53a5d62 100644 (file)
@@ -54,7 +54,7 @@ sg_routing_edge_t sg_routing_edge_by_name_or_null(const char *name) {
 }
 
 /* Global vars */
-routing_global_t global_routing = NULL;
+routing_platf_t routing_platf = NULL;
 AS_t current_routing = NULL;
 
 /* global parse functions */
@@ -406,13 +406,13 @@ void routing_AS_begin(const char *AS_id, const char *wanted_routing_type)
   sg_routing_edge_t info = NULL;
   info = xbt_new0(s_network_element_t, 1);
 
-  if (current_routing == NULL && global_routing->root == NULL) {
+  if (current_routing == NULL && routing_platf->root == NULL) {
 
     /* it is the first one */
     new_as->routing_father = NULL;
-    global_routing->root = new_as;
+    routing_platf->root = new_as;
     info->id = -1;
-  } else if (current_routing != NULL && global_routing->root != NULL) {
+  } else if (current_routing != NULL && routing_platf->root != NULL) {
 
     xbt_assert(!xbt_dict_get_or_null
                (current_routing->routing_sons, AS_id),
@@ -639,8 +639,8 @@ void routing_get_route_and_latency(sg_routing_edge_t src,
 {
   XBT_DEBUG("routing_get_route_and_latency from %s to %s",src->name,dst->name);
   if (!*route) {
-    xbt_dynar_reset(global_routing->last_route);
-    *route = global_routing->last_route;
+    xbt_dynar_reset(routing_platf->last_route);
+    *route = routing_platf->last_route;
   }
 
   _get_route_and_latency(src, dst, route, latency);
@@ -672,7 +672,7 @@ static xbt_dynar_t recursive_get_onelink_routes(AS_t rc)
 
 static xbt_dynar_t get_onelink_routes(void)
 {
-  return recursive_get_onelink_routes(global_routing->root);
+  return recursive_get_onelink_routes(routing_platf->root);
 }
 
 e_surf_network_element_type_t routing_get_network_element_type(const char *name)
@@ -692,11 +692,11 @@ e_surf_network_element_type_t routing_get_network_element_type(const char *name)
 void routing_model_create( void *loopback)
 {
   /* config the uniq global routing */
-  global_routing = xbt_new0(s_routing_global_t, 1);
-  global_routing->root = NULL;
-  global_routing->get_onelink_routes = get_onelink_routes;
-  global_routing->loopback = loopback;
-  global_routing->last_route = xbt_dynar_new(sizeof(sg_routing_link_t),NULL);
+  routing_platf = xbt_new0(s_routing_platf_t, 1);
+  routing_platf->root = NULL;
+  routing_platf->get_onelink_routes = get_onelink_routes;
+  routing_platf->loopback = loopback;
+  routing_platf->last_route = xbt_dynar_new(sizeof(sg_routing_link_t),NULL);
   /* no current routing at moment */
   current_routing = NULL;
 }
@@ -1203,9 +1203,9 @@ static void finalize_rec(AS_t as) {
 
 /** \brief Frees all memory allocated by the routing module */
 void routing_exit(void) {
-  if (!global_routing)
+  if (!routing_platf)
     return;
-  xbt_dynar_free(&global_routing->last_route);
-  finalize_rec(global_routing->root);
-  xbt_free(global_routing);
+  xbt_dynar_free(&routing_platf->last_route);
+  finalize_rec(routing_platf->root);
+  xbt_free(routing_platf);
 }
index 4ae034e..27c04b8 100644 (file)
@@ -7,7 +7,7 @@
 #include "surf_routing_private.h"
 
 /* Global vars */
-extern routing_global_t global_routing;
+extern routing_platf_t routing_platf;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_dijkstra, surf, "Routing part of surf -- dijkstra routing logic");
 
@@ -159,7 +159,7 @@ static void add_loopback_dijkstra(as_dijkstra_t as) {
       route_t e_route = xbt_new0(s_route_t, 1);
       e_route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
       xbt_dynar_push(e_route->link_list,
-          &global_routing->loopback);
+          &routing_platf->loopback);
       xbt_graph_new_edge(as->route_graph, node, node, e_route);
     }
   }
@@ -456,7 +456,7 @@ void model_dijkstra_both_end(AS_t as)
     THIS_AS->route_cache = xbt_dict_new_homogeneous(&route_cache_elem_free);
 
   /* Add the loopback if needed */
-  if (global_routing->loopback && as->hierarchy == SURF_ROUTING_BASE)
+  if (routing_platf->loopback && as->hierarchy == SURF_ROUTING_BASE)
     add_loopback_dijkstra(THIS_AS);
 
   /* initialize graph indexes in nodes after graph has been built */
index 92020e8..4207401 100644 (file)
@@ -7,7 +7,7 @@
 #include "surf_routing_private.h"
 
 /* Global vars */
-extern routing_global_t global_routing;
+extern routing_platf_t routing_platf;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_floyd, surf, "Routing part of surf");
 
@@ -207,7 +207,7 @@ void model_floyd_end(AS_t current_routing)
   }
 
   /* Add the loopback if needed */
-  if (global_routing->loopback && current_routing->hierarchy == SURF_ROUTING_BASE) {
+  if (routing_platf->loopback && current_routing->hierarchy == SURF_ROUTING_BASE) {
     for (i = 0; i < table_size; i++) {
       route_t e_route = TO_FLOYD_LINK(i, i);
       if (!e_route) {
@@ -215,7 +215,7 @@ void model_floyd_end(AS_t current_routing)
         e_route->src_gateway = NULL;
         e_route->dst_gateway = NULL;
         e_route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
-        xbt_dynar_push(e_route->link_list, &global_routing->loopback);
+        xbt_dynar_push(e_route->link_list, &routing_platf->loopback);
         TO_FLOYD_LINK(i, i) = e_route;
         TO_FLOYD_PRED(i, i) = i;
         TO_FLOYD_COST(i, i) = 1;
index 776d2ed..ab14bf6 100644 (file)
@@ -7,7 +7,7 @@
 #include "surf_routing_private.h"
 
 /* Global vars */
-extern routing_global_t global_routing;
+extern routing_platf_t routing_platf;
 extern int surf_parse_lineno;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf");
@@ -136,7 +136,7 @@ void model_full_end(AS_t current_routing)
     routing->routing_table = xbt_new0(route_t, table_size * table_size);
 
   /* Add the loopback if needed */
-  if (global_routing->loopback && current_routing->hierarchy == SURF_ROUTING_BASE) {
+  if (routing_platf->loopback && current_routing->hierarchy == SURF_ROUTING_BASE) {
     for (i = 0; i < table_size; i++) {
       e_route = TO_ROUTE_FULL(i, i);
       if (!e_route) {
@@ -144,7 +144,7 @@ void model_full_end(AS_t current_routing)
         e_route->src_gateway = NULL;
         e_route->dst_gateway = NULL;
         e_route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
-        xbt_dynar_push(e_route->link_list, &global_routing->loopback);
+        xbt_dynar_push(e_route->link_list, &routing_platf->loopback);
         TO_ROUTE_FULL(i, i) = e_route;
       }
     }
index c223032..ca03d30 100644 (file)
@@ -7,7 +7,7 @@
 #include <pcre.h>               /* regular expression library */
 
 /* Global vars */
-extern routing_global_t global_routing;
+extern routing_platf_t routing_platf;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_rulebased, surf, "Routing part of surf");
 
@@ -340,9 +340,9 @@ static void rulebased_get_route_and_latency(AS_t rc,
   if (rc_src >= 0 && rc_dst >= 0) {
     /* matched src and dest, nothing more to do (?) */
   } else if (!strcmp(src_name, dst_name) && are_processing_units) {
-    xbt_dynar_push(route->link_list, &(global_routing->loopback));
+    xbt_dynar_push(route->link_list, &(routing_platf->loopback));
     if (lat)
-      *lat += surf_network_model->extension.network.get_link_latency(global_routing->loopback);
+      *lat += surf_network_model->extension.network.get_link_latency(routing_platf->loopback);
   } else {
     THROWF(arg_error,0,"No route from '%s' to '%s'??",src_name,dst_name);
     //xbt_dynar_reset(route->link_list);
index 0994999..6c4fda9 100644 (file)
@@ -14,7 +14,7 @@
 #include "xbt/xbt_os_time.h"
 
 #define BILLION  1000000000L;
-extern routing_global_t global_routing;
+extern routing_platf_t routing_platf;
 
 int main(int argc, char **argv)
 {
index 42f2f62..9b822dd 100644 (file)
@@ -12,7 +12,7 @@
 #include "surf/surf_private.h"
 #include "xbt/xbt_os_time.h"
 
-extern routing_global_t global_routing;
+extern routing_platf_t routing_platf;
 
 int main(int argc, char **argv)
 {
index 2d841f3..2f58cb5 100644 (file)
@@ -9,7 +9,7 @@
 #include "simdag/simdag.h"
 #include "surf/surf_private.h"
 
-extern routing_global_t global_routing;
+extern routing_platf_t routing_platf;
 
 int main(int argc, char **argv)
 {
index d9dcd42..d6bf9b1 100644 (file)
@@ -9,7 +9,7 @@
 #include "simdag/simdag.h"
 #include "surf/surf_private.h"
 
-extern routing_global_t global_routing;
+extern routing_platf_t routing_platf;
 
 int main(int argc, char **argv)
 {