From f4af50b182ee0b683c2928eae98e31dbe7fd0f3e Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Wed, 24 Feb 2016 18:27:43 +0100 Subject: [PATCH] try to sort out the surf headers a bit, if possible --- src/bindings/lua/lua_platf.cpp | 2 +- src/include/surf/surfxml_parse_values.h | 17 ----------------- src/simix/smx_global.cpp | 1 + src/surf/cpu_interface.cpp | 1 + src/surf/instr_routing.cpp | 9 +++++---- src/surf/network_cm02.cpp | 1 + src/surf/network_ns3.cpp | 1 + src/surf/surf_interface.cpp | 2 ++ src/surf/surf_interface.hpp | 4 ++++ src/surf/surf_private.h | 14 -------------- src/surf/surf_routing.cpp | 1 - src/surf/surf_routing.hpp | 1 + src/surf/surf_routing_private.hpp | 14 +------------- src/surf/trace_mgr.hpp | 3 +++ src/surf/xml/platf.hpp | 11 ++++++++++- src/surf/xml/platf_private.hpp | 23 ++++++++++++++--------- src/surf/xml/surfxml_parseplatf.cpp | 1 + src/surf/xml/surfxml_sax_cb.cpp | 1 + teshsuite/surf/surf_usage/surf_usage.cpp | 1 + teshsuite/surf/surf_usage/surf_usage2.cpp | 1 + tools/cmake/DefinePackages.cmake | 1 - 21 files changed, 49 insertions(+), 61 deletions(-) delete mode 100644 src/include/surf/surfxml_parse_values.h diff --git a/src/bindings/lua/lua_platf.cpp b/src/bindings/lua/lua_platf.cpp index 8065bc6f86..8d07cfbad2 100644 --- a/src/bindings/lua/lua_platf.cpp +++ b/src/bindings/lua/lua_platf.cpp @@ -7,7 +7,7 @@ /* SimGrid Lua bindings */ #include "lua_private.h" -#include "src/surf/xml/platf.hpp" +#include "src/surf/xml/platf_private.hpp" #include "surf/surf_routing.h" #include #include diff --git a/src/include/surf/surfxml_parse_values.h b/src/include/surf/surfxml_parse_values.h deleted file mode 100644 index 3d6db8b3f5..0000000000 --- a/src/include/surf/surfxml_parse_values.h +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright (c) 2011-2014. The SimGrid Team. - * All rights reserved. */ - -/* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ - -#ifndef SURFXML_PARSE_VALUES_H_ -#define SURFXML_PARSE_VALUES_H_ - - -typedef struct s_surf_parsing_link_up_down *surf_parsing_link_up_down_t; -typedef struct s_surf_parsing_link_up_down { - void* link_up; - void* link_down; -} s_surf_parsing_link_up_down_t; - -#endif /* SURFXML_PARSE_VALUES_H_ */ diff --git a/src/simix/smx_global.cpp b/src/simix/smx_global.cpp index 54cf74d888..ac04a45f6c 100644 --- a/src/simix/smx_global.cpp +++ b/src/simix/smx_global.cpp @@ -12,6 +12,7 @@ #endif #include "src/surf/surf_interface.hpp" +#include "src/surf/xml/platf.hpp" #include "smx_private.h" #include "smx_private.hpp" #include "xbt/heap.h" diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index 296877e6cb..e6a50ecba5 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -7,6 +7,7 @@ #include #include "cpu_interface.hpp" #include "plugins/energy.hpp" +#include "src/instr/instr_private.h" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals XBT_LOG_EXTERNAL_CATEGORY(surf_kernel); XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu, surf, diff --git a/src/surf/instr_routing.cpp b/src/surf/instr_routing.cpp index e79947ac4c..fc53997091 100644 --- a/src/surf/instr_routing.cpp +++ b/src/surf/instr_routing.cpp @@ -6,7 +6,8 @@ #include "src/instr/instr_private.h" -#include "src/surf/surf_private.h" +#include "src/surf/surf_routing.hpp" +#include "src/surf/xml/platf_private.hpp" #include "xbt/graph.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_routing, instr, "Tracing platform hierarchy"); @@ -122,14 +123,14 @@ static void linkContainers (container_t src, container_t dst, xbt_dict_t filter) XBT_DEBUG (" linkContainers %s <-> %s", src->name, dst->name); } -static void recursiveGraphExtraction (AS_t rc, container_t container, xbt_dict_t filter) +static void recursiveGraphExtraction (simgrid::surf::As *rc, container_t container, xbt_dict_t filter) { if (!TRACE_platform_topology()){ XBT_DEBUG("Graph extraction disabled by user."); return; } - XBT_DEBUG ("Graph extraction for routing_component = %s", surf_AS_get_name(rc)); - if (!xbt_dict_is_empty(surf_AS_get_routing_sons(rc))){ + XBT_DEBUG ("Graph extraction for routing_component = %s", rc->name_); + if (!xbt_dict_is_empty(rc->sons_)){ xbt_dict_cursor_t cursor = NULL; AS_t rc_son; char *child_name; diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index 52188807b4..c866290c1d 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -9,6 +9,7 @@ #include "network_cm02.hpp" #include "maxmin_private.hpp" #include "simgrid/sg_config.h" +#include "src/instr/instr_private.h" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network); diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index c5af3bf080..3e0e899633 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -8,6 +8,7 @@ #include "src/surf/surf_private.h" #include "src/surf/host_interface.hpp" #include "simgrid/sg_config.h" +#include "src/instr/instr_private.h" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(ns3); diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index a2624dd729..d138d20652 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -14,6 +14,8 @@ #include "simgrid/sg_config.h" #include "mc/mc.h" #include "virtual_machine.hpp" +#include "src/instr/instr_private.h" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals + XBT_LOG_NEW_CATEGORY(surf, "All SURF categories"); XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_kernel, surf, diff --git a/src/surf/surf_interface.hpp b/src/surf/surf_interface.hpp index 2719ed63aa..4b3a940dd0 100644 --- a/src/surf/surf_interface.hpp +++ b/src/surf/surf_interface.hpp @@ -54,6 +54,10 @@ extern XBT_PRIVATE simgrid::xbt::signal surfExitCallbacks; int XBT_PRIVATE __surf_is_absolute_file_path(const char *file_path); +static inline char* sg_storage_name(sg_storage_t storage) { + return storage->key; +} + /*********** * Classes * ***********/ diff --git a/src/surf/surf_private.h b/src/surf/surf_private.h index 1e189ef9bb..336a532a84 100644 --- a/src/surf/surf_private.h +++ b/src/surf/surf_private.h @@ -7,15 +7,9 @@ #ifndef _SURF_SURF_PRIVATE_H #define _SURF_SURF_PRIVATE_H -#include - #include "surf/surf.h" #include "surf/maxmin.h" -#include "xbt/log.h" #include "src/surf/trace_mgr.hpp" -#include "src/instr/instr_private.h" -#include "surf/surfxml_parse_values.h" -#include "src/surf/xml/platf_private.hpp" #define NO_MAX_DURATION -1.0 @@ -65,7 +59,6 @@ XBT_PUBLIC(void) routing_exit(void); XBT_PUBLIC(void) storage_register_callbacks(void); XBT_PUBLIC(void) routing_register_callbacks(void); -XBT_PUBLIC(void) routing_route_free(sg_platf_route_cbarg_t route); // FIXME: make previous function private to routing again? XBT_PUBLIC(void) generic_get_graph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges, AS_t rc); XBT_PRIVATE void parse_after_config(void); @@ -75,13 +68,6 @@ XBT_PRIVATE void parse_after_config(void); void TRACE_surf_host_set_speed(double date, const char *resource, double power); void TRACE_surf_link_set_bandwidth(double date, const char *resource, double bandwidth); -/********** Instr. **********/ - -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() #endif /* _SURF_SURF_PRIVATE_H */ diff --git a/src/surf/surf_routing.cpp b/src/surf/surf_routing.cpp index 69c04af09b..d57974577f 100644 --- a/src/surf/surf_routing.cpp +++ b/src/surf/surf_routing.cpp @@ -10,7 +10,6 @@ #include "simgrid/sg_config.h" #include "storage_interface.hpp" -#include "surf/surfxml_parse_values.h" #include "src/surf/surf_routing_cluster_torus.hpp" #include "src/surf/surf_routing_cluster_fat_tree.hpp" diff --git a/src/surf/surf_routing.hpp b/src/surf/surf_routing.hpp index 5671de1d3e..6d851bee4d 100644 --- a/src/surf/surf_routing.hpp +++ b/src/surf/surf_routing.hpp @@ -11,6 +11,7 @@ #include #include "surf_interface.hpp" +#include "src/surf/xml/platf_private.hpp" // FIXME: including this here is pure madness. KILKILKIL XML. #include #include diff --git a/src/surf/surf_routing_private.hpp b/src/surf/surf_routing_private.hpp index 041dda823f..4f16393947 100644 --- a/src/surf/surf_routing_private.hpp +++ b/src/surf/surf_routing_private.hpp @@ -30,16 +30,11 @@ XBT_PRIVATE void model_generic_finalize(AS_t as); XBT_PRIVATE int generic_parse_PU(AS_t rc, sg_netcard_t elm); XBT_PRIVATE int generic_parse_AS(AS_t rc, sg_netcard_t elm); -XBT_PRIVATE void generic_parse_bypassroute(AS_t rc, sg_platf_route_cbarg_t e_route); /* ************************************************************************** */ /* *************** GENERIC BUSINESS METHODS (declarations) ****************** */ XBT_PRIVATE xbt_dynar_t generic_get_onelink_routes(AS_t rc); -XBT_PRIVATE sg_platf_route_cbarg_t generic_get_bypassroute(AS_t rc, - sg_netcard_t src, - sg_netcard_t dst, - double *lat); /* ************************************************************************** */ /* ****************** GENERIC AUX FUNCTIONS (declarations) ****************** */ @@ -47,25 +42,18 @@ XBT_PRIVATE sg_platf_route_cbarg_t generic_get_bypassroute(AS_t rc, /* change a route containing link names into a route containing link entities. * If change_order is true, the links are put in reverse order in the * produced route */ -XBT_PRIVATE sg_platf_route_cbarg_t generic_new_extended_route(e_surf_routing_hierarchy_t hierarchy, - sg_platf_route_cbarg_t data, int preserve_order); XBT_PRIVATE AS_t generic_autonomous_system_exist(AS_t rc, char *element); XBT_PRIVATE AS_t generic_processing_units_exist(AS_t rc, char *element); void generic_src_dst_check(AS_t rc, sg_netcard_t src, sg_netcard_t dst); /* ************************************************************************** */ /* *************************** FLOYD ROUTING ******************************** */ -XBT_PRIVATE void model_floyd_parse_route(AS_t rc, sg_platf_route_cbarg_t route); +//XBT_PRIVATE void model_floyd_parse_route(AS_t rc, sg_platf_route_cbarg_t route); #define HOST_PEER(peername) bprintf("peer_%s", peername) #define ROUTER_PEER(peername) bprintf("router_%s", peername) #define LINK_PEER(peername) bprintf("link_%s", peername) -/* ************************************************************************** */ -/* ********** Dijkstra & Dijkstra Cached ROUTING **************************** */ -XBT_PRIVATE void model_dijkstra_both_parse_route (AS_t rc, sg_platf_route_cbarg_t route); -XBT_PRIVATE void model_full_set_route( /* Set the route and ASroute between src and dst */ - AS_t rc, sg_platf_route_cbarg_t route); /* ************************************************************************** */ /* ************************* GRAPH EXPORTING FUNCTIONS ********************** */ XBT_PRIVATE xbt_node_t new_xbt_graph_node (xbt_graph_t graph, const char *name, xbt_dict_t nodes); diff --git a/src/surf/trace_mgr.hpp b/src/surf/trace_mgr.hpp index eb301828fd..ffb7620036 100644 --- a/src/surf/trace_mgr.hpp +++ b/src/surf/trace_mgr.hpp @@ -78,6 +78,9 @@ XBT_PUBLIC(void) tmgr_trace_event_unref(tmgr_trace_iterator_t *trace_event); XBT_PUBLIC(void) tmgr_finalize(void); +XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_file(const char *filename); +XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_string(const char *id, const char *input, double periodicity); + SG_END_DECL() #ifdef __cplusplus diff --git a/src/surf/xml/platf.hpp b/src/surf/xml/platf.hpp index 64e16dcb15..d001631679 100644 --- a/src/surf/xml/platf.hpp +++ b/src/surf/xml/platf.hpp @@ -30,8 +30,17 @@ XBT_PUBLIC(double) surf_parse_get_size(const char *string, const char *entity_ki XBT_PUBLIC(double) surf_parse_get_bandwidth(const char *string, const char *entity_kind, const char *name); XBT_PUBLIC(double) surf_parse_get_speed(const char *string, const char *entity_kind, const char *name); -/* What is needed to bypass the parser. */ XBT_PUBLIC_DATA(int_f_void_t) surf_parse; /* Entry-point to the parser. Set this to your function. */ + SG_END_DECL() + +namespace simgrid { +namespace surf { + +extern XBT_PRIVATE xbt::signal on_postparse; + +} +} + #endif diff --git a/src/surf/xml/platf_private.hpp b/src/surf/xml/platf_private.hpp index 6c72ca57cb..260e117c49 100644 --- a/src/surf/xml/platf_private.hpp +++ b/src/surf/xml/platf_private.hpp @@ -20,16 +20,8 @@ SG_BEGIN_DECL() typedef size_t yy_size_t; #endif -static inline char* sg_storage_name(sg_storage_t storage) { - return storage->key; -} - XBT_PUBLIC(sg_netcard_t) sg_netcard_by_name_or_null(const char *name); -XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_file(const char *filename); -XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_string(const char *id, - const char *input, - double periodicity); typedef enum { SURF_CLUSTER_FAT_TREE=2, SURF_CLUSTER_FLAT = 1, @@ -304,6 +296,20 @@ XBT_PRIVATE void surfxml_bufferstack_push(int _new); XBT_PRIVATE void surfxml_bufferstack_pop(int _new); XBT_PUBLIC_DATA(int) surfxml_bufferstack_size; +XBT_PUBLIC(void) routing_route_free(sg_platf_route_cbarg_t route); +/********** Instr. **********/ +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); + +typedef struct s_surf_parsing_link_up_down *surf_parsing_link_up_down_t; +typedef struct s_surf_parsing_link_up_down { + void* link_up; + void* link_down; +} s_surf_parsing_link_up_down_t; + + SG_END_DECL() namespace simgrid { @@ -311,7 +317,6 @@ namespace surf { extern XBT_PRIVATE simgrid::xbt::signal on_link; extern XBT_PRIVATE simgrid::xbt::signal on_cluster; -extern XBT_PRIVATE simgrid::xbt::signal on_postparse; } } diff --git a/src/surf/xml/surfxml_parseplatf.cpp b/src/surf/xml/surfxml_parseplatf.cpp index 0c85993e43..02f8ccdeda 100644 --- a/src/surf/xml/surfxml_parseplatf.cpp +++ b/src/surf/xml/surfxml_parseplatf.cpp @@ -10,6 +10,7 @@ #include "xbt/dict.h" #include "src/surf/cpu_interface.hpp" #include "src/surf/network_interface.hpp" +#include "src/instr/instr_private.h" // TRACE_start(). FIXME: remove by subscribing tracing to the surf signals #include "src/surf/xml/platf.hpp" diff --git a/src/surf/xml/surfxml_sax_cb.cpp b/src/surf/xml/surfxml_sax_cb.cpp index 45febe1b24..ea86273e04 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -15,6 +15,7 @@ #include "xbt/dict.h" #include "src/surf/surf_private.h" #include "simgrid/sg_config.h" +#include "simgrid/link.h" #include "src/surf/xml/platf_private.hpp" diff --git a/teshsuite/surf/surf_usage/surf_usage.cpp b/teshsuite/surf/surf_usage/surf_usage.cpp index a012ff1746..e0ec894599 100644 --- a/teshsuite/surf/surf_usage/surf_usage.cpp +++ b/teshsuite/surf/surf_usage/surf_usage.cpp @@ -8,6 +8,7 @@ #include #include "simgrid/sg_config.h" +#include "simgrid/host.h" #include "surf/surf.h" #include "src/surf/surf_interface.hpp" #include "src/surf/cpu_interface.hpp" diff --git a/teshsuite/surf/surf_usage/surf_usage2.cpp b/teshsuite/surf/surf_usage/surf_usage2.cpp index 7480397b93..0fc3a43d78 100644 --- a/teshsuite/surf/surf_usage/surf_usage2.cpp +++ b/teshsuite/surf/surf_usage/surf_usage2.cpp @@ -7,6 +7,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "simgrid/sg_config.h" +#include "simgrid/host.h" #include "surf/surf.h" #include "src/surf/surf_interface.hpp" #include "src/surf/cpu_interface.hpp" diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index d2528431d4..c5b6a6d267 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -13,7 +13,6 @@ set(EXTRA_DIST src/include/surf/datatypes.h src/include/surf/maxmin.h src/include/surf/surf.h - src/include/surf/surfxml_parse_values.h src/include/xbt/win32_ucontext.h src/include/xbt/wine_dbghelp.h src/msg/msg_mailbox.h -- 2.20.1