/***************************/
/* 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
xbt_dynar_free(¤tContainer);
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);
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;
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;
// 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;
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;
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);
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;
}
/* Global vars */
-routing_global_t global_routing = NULL;
+routing_platf_t routing_platf = NULL;
AS_t current_routing = NULL;
/* global parse functions */
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),
{
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);
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)
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;
}
/** \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);
}
#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");
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);
}
}
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 */
#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");
}
/* 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) {
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;
#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");
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) {
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;
}
}
#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");
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);
#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)
{
#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)
{
#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)
{
#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)
{