From: navarrop Date: Thu, 24 Mar 2011 10:35:08 +0000 (+0000) Subject: Add levels to lib host_lib, link_lib and as_router_lib X-Git-Tag: v3.6_beta2~145 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/2cc8ea0d3fabf1676e26e7361de7c45d09d5a2b6?hp=eb5ce1f6f6e73da893169729974be2efb3be1b10 Add levels to lib host_lib, link_lib and as_router_lib git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9824 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index af144b6828..a1a2837ebd 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -14,6 +14,24 @@ #include "portable.h" #include "xbt/config.h" #include "surf/datatypes.h" +#include "xbt/lib.h" + +xbt_lib_t host_lib; +int ROUTING_HOST_LEVEL; //Routing level +int SURF_CPU_LEVEL; //Surf cpu level +int SURF_WKS_LEVEL; //Surf workstation level +int SIMIX_HOST_LEVEL; //Simix level +int MSG_HOST_LEVEL; //Msg level +int SD_HOST_LEVEL; //Simdag level +int COORD_HOST_LEVEL; //Coordinates level + +xbt_lib_t link_lib; +int SD_LINK_LEVEL; //Simdag level +int SURF_LINK_LEVEL; //Surf level + +xbt_lib_t as_router_lib; +int ROUTING_ASR_LEVEL; //Routing level +int COORD_ASR_LEVEL; //Coordinates level SG_BEGIN_DECL() /* Actions and models are highly connected structures... */ diff --git a/src/msg/global.c b/src/msg/global.c index 02b300cb02..c7f7d2e94c 100644 --- a/src/msg/global.c +++ b/src/msg/global.c @@ -79,6 +79,9 @@ void MSG_global_init(int *argc, char **argv) #ifdef HAVE_TRACING TRACE_start(); #endif + + XBT_DEBUG("ADD MSG LEVELS"); + MSG_HOST_LEVEL = xbt_lib_add_level(host_lib,free); } /** \defgroup m_channel_management Understanding channels diff --git a/src/simdag/sd_global.c b/src/simdag/sd_global.c index 4d92bdd508..2481b2c3f5 100644 --- a/src/simdag/sd_global.c +++ b/src/simdag/sd_global.c @@ -100,6 +100,10 @@ void SD_init(int *argc, char **argv) #ifdef HAVE_JEDULE jedule_sd_init(); #endif + + XBT_DEBUG("ADD SD LEVELS"); + SD_HOST_LEVEL = xbt_lib_add_level(host_lib,free); + SD_LINK_LEVEL = xbt_lib_add_level(link_lib,free); } /** diff --git a/src/simix/smx_global.c b/src/simix/smx_global.c index eccb2a5636..a486e41fb3 100644 --- a/src/simix/smx_global.c +++ b/src/simix/smx_global.c @@ -109,6 +109,9 @@ void SIMIX_global_init(int *argc, char **argv) if (!simix_timers) { simix_timers = xbt_heap_new(8, &free); } + + XBT_DEBUG("ADD SIMIX LEVELS"); + SIMIX_HOST_LEVEL = xbt_lib_add_level(host_lib,free); } /** diff --git a/src/surf/surf.c b/src/surf/surf.c index 41347b7313..e4672f482d 100644 --- a/src/surf/surf.c +++ b/src/surf/surf.c @@ -284,6 +284,24 @@ XBT_LOG_EXTERNAL_CATEGORY(surf_network_gtnets); void surf_init(int *argc, char **argv) { + XBT_DEBUG("Create all Libs"); + host_lib = xbt_lib_new(); + link_lib = xbt_lib_new(); + as_router_lib = xbt_lib_new(); + + XBT_DEBUG("ADD ROUTING LEVEL"); + ROUTING_HOST_LEVEL = xbt_lib_add_level(host_lib,free); + ROUTING_ASR_LEVEL = xbt_lib_add_level(as_router_lib,free); + + XBT_DEBUG("ADD SURF LEVELS"); + SURF_CPU_LEVEL = xbt_lib_add_level(host_lib,free); + SURF_WKS_LEVEL = xbt_lib_add_level(host_lib,free); + SURF_LINK_LEVEL = xbt_lib_add_level(link_lib,free); + + XBT_DEBUG("ADD COORD LEVEL"); + COORD_HOST_LEVEL = xbt_lib_add_level(host_lib,free); + COORD_ASR_LEVEL = xbt_lib_add_level(as_router_lib,free); + /* Connect our log channels: that must be done manually under windows */ XBT_LOG_CONNECT(surf_cpu, surf); XBT_LOG_CONNECT(surf_kernel, surf); @@ -372,6 +390,10 @@ void surf_exit(void) surf_parse_lex_destroy(); surf_parse_free_callbacks(); NOW = 0; /* Just in case the user plans to restart the simulation afterward */ + // Exit the LIB host_lib + xbt_lib_free(&host_lib); + xbt_lib_free(&link_lib); + xbt_lib_free(&as_router_lib); } void surf_presolve(void)