From b70484c88111a53e55555690d90be085b6a05846 Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Tue, 1 Dec 2015 16:52:19 +0100 Subject: [PATCH] [surf] Remove sg_platf_host_cb --- src/include/simgrid/platf_interface.h | 1 - src/surf/instr_routing.cpp | 4 +--- src/surf/sg_platf.cpp | 17 +++-------------- src/surf/surf_private.h | 1 + 4 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/include/simgrid/platf_interface.h b/src/include/simgrid/platf_interface.h index 5ffea5b3de..e983b0f977 100644 --- a/src/include/simgrid/platf_interface.h +++ b/src/include/simgrid/platf_interface.h @@ -47,7 +47,6 @@ typedef void (*sg_platf_gpu_cb_t)(sg_platf_gpu_cbarg_t); XBT_PUBLIC(void) sg_platf_gpu_add_cb(sg_platf_gpu_cb_t); /* ***************************************** */ -XBT_PUBLIC(void) sg_platf_host_add_cb(sg_platf_host_cb_t); XBT_PUBLIC(void) sg_platf_link_add_cb(sg_platf_link_cb_t); XBT_PUBLIC(void) sg_platf_peer_add_cb(sg_platf_peer_cb_t fct); XBT_PUBLIC(void) sg_platf_cluster_add_cb(sg_platf_cluster_cb_t fct); diff --git a/src/surf/instr_routing.cpp b/src/surf/instr_routing.cpp index 05a47064c5..e46a41a46d 100644 --- a/src/surf/instr_routing.cpp +++ b/src/surf/instr_routing.cpp @@ -255,7 +255,7 @@ static void instr_routing_parse_start_link (sg_platf_link_cbarg_t link) xbt_dynar_free (&links_to_create); } -static void instr_routing_parse_start_host (sg_platf_host_cbarg_t host) +void sg_instr_new_host(sg_platf_host_cbarg_t host) { container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1); container_t container = PJ_container_new (host->id, INSTR_HOST, father); @@ -344,8 +344,6 @@ void instr_routing_define_callbacks () //to create the rootContainer and the rootType properly if (!TRACE_needs_platform()) return; sg_platf_link_add_cb(instr_routing_parse_start_link); - sg_platf_host_add_cb(instr_routing_parse_start_host); - sg_platf_postparse_add_cb(instr_routing_parse_end_platform); } diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 0471dc9834..aad3375fc8 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -19,7 +19,6 @@ #include "host_interface.hpp" XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_parse); -xbt_dynar_t sg_platf_host_cb_list = NULL; // of sg_platf_host_cb_t xbt_dynar_t sg_platf_link_cb_list = NULL; // of sg_platf_link_cb_t xbt_dynar_t sg_platf_peer_cb_list = NULL; // of sg_platf_peer_cb_t xbt_dynar_t sg_platf_cluster_cb_list = NULL; // of sg_platf_cluster_cb_t @@ -51,10 +50,9 @@ static RngStream sg_platf_rng_stream = NULL; void sg_platf_init(void) { //FIXME : Ugly, but useful... - if(sg_platf_host_cb_list) + if (sg_platf_gpu_cb_list) return; //Already initialized, so do nothing... - sg_platf_host_cb_list = xbt_dynar_new(sizeof(sg_platf_host_cb_t), NULL); sg_platf_link_cb_list = xbt_dynar_new(sizeof(sg_platf_link_cb_t), NULL); sg_platf_peer_cb_list = xbt_dynar_new(sizeof(sg_platf_peer_cb_t), NULL); sg_platf_cluster_cb_list = xbt_dynar_new(sizeof(sg_platf_cluster_cb_t), NULL); @@ -78,7 +76,6 @@ void sg_platf_init(void) { } /** Module management function: frees all internal data structures */ void sg_platf_exit(void) { - xbt_dynar_free(&sg_platf_host_cb_list); xbt_dynar_free(&sg_platf_link_cb_list); xbt_dynar_free(&sg_platf_postparse_cb_list); xbt_dynar_free(&sg_platf_peer_cb_list); @@ -107,7 +104,6 @@ void sg_platf_exit(void) { void sg_platf_new_host(sg_platf_host_cbarg_t host) { - xbt_assert(! sg_host_by_name(host->id), "Refusing to create a second host named '%s'.", host->id); @@ -128,11 +124,8 @@ void sg_platf_new_host(sg_platf_host_cbarg_t host) host->properties); surf_host_model->createHost(host->id, net, cpu); - unsigned int iterator; - sg_platf_host_cb_t fun; - xbt_dynar_foreach(sg_platf_host_cb_list, iterator, fun) { - fun(host); - } + if (TRACE_is_enabled() && TRACE_needs_platform()) + sg_instr_new_host(host); } /** @@ -544,10 +537,6 @@ void sg_platf_gpu_add_cb(sg_platf_gpu_cb_t fct) { /* ***************************************** */ - -void sg_platf_host_add_cb(sg_platf_host_cb_t fct) { - xbt_dynar_push(sg_platf_host_cb_list, &fct); -} void sg_platf_link_add_cb(sg_platf_link_cb_t fct) { xbt_dynar_push(sg_platf_link_cb_list, &fct); } diff --git a/src/surf/surf_private.h b/src/surf/surf_private.h index a985c26b2c..eb2bc276ce 100644 --- a/src/surf/surf_private.h +++ b/src/surf/surf_private.h @@ -101,6 +101,7 @@ void TRACE_surf_link_set_bandwidth(double date, const char *resource, double ban XBT_PRIVATE void sg_instr_AS_begin(sg_platf_AS_cbarg_t AS); XBT_PRIVATE void sg_instr_new_router(sg_platf_router_cbarg_t router); +XBT_PRIVATE void sg_instr_new_host(sg_platf_host_cbarg_t host); XBT_PRIVATE void sg_instr_AS_end(void); SG_END_DECL() -- 2.20.1