surf_cpu_model_pm = new CpuPlopModel();
- sg_platf_postparse_add_cb(cpu_add_traces);
+ simgrid::surf::on_postparse.connect(cpu_add_traces);
xbt_dynar_push(model_list, &surf_cpu_model_pm);
}
XBT_PUBLIC(void) sg_platf_init(void);
XBT_PUBLIC(void) sg_platf_exit(void);
-/* Managing the parsing callbacks */
-
-typedef void (*sg_platf_link_cb_t)(sg_platf_link_cbarg_t);
-typedef void (*sg_platf_cluster_cb_t)(sg_platf_cluster_cbarg_t);
-
-XBT_PUBLIC(void) sg_platf_link_add_cb(sg_platf_link_cb_t);
-XBT_PUBLIC(void) sg_platf_cluster_add_cb(sg_platf_cluster_cb_t fct);
-XBT_PUBLIC(void) sg_platf_postparse_add_cb(void_f_void_t fct);
-
/** \brief Pick the right models for CPU, net and host, and call their model_init_preparse
*
* Must be called within parsing/creating the environment (after the <config>s, if any, and before <AS> or friends such as <cluster>)
#include "xbt/replay.h"
#include "simgrid/sg_config.h" /* Configuration mechanism of SimGrid */
#include "src/surf/callbacks.h"
+#include "src/surf/platform.hpp"
XBT_LOG_NEW_CATEGORY(msg, "All MSG categories");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_kernel, msg,
SIMIX_function_register_process_create(MSG_process_create_from_SIMIX);
SIMIX_function_register_process_cleanup(MSG_process_cleanup_from_SIMIX);
- sg_platf_postparse_add_cb(MSG_post_create_environment);
+ simgrid::surf::on_postparse.connect(MSG_post_create_environment);
simgrid::s4u::Host::onCreation.connect([](simgrid::s4u::Host& host) {
MSG_host_create_(&host);
});
#endif
#include "src/mc/mc_record.h"
+#include "src/surf/platform.hpp"
#ifdef HAVE_SMPI
#include "src/smpi/private.h"
#endif
/* register a function to be called by SURF after the environment creation */
sg_platf_init();
- sg_platf_postparse_add_cb(SIMIX_post_create_environment);
+ simgrid::surf::on_postparse.connect(SIMIX_post_create_environment);
simgrid::s4u::Host::onCreation.connect([](simgrid::s4u::Host& host) {
SIMIX_host_create(&host);
});
#include "cpu_ti.hpp"
#include "maxmin_private.hpp"
#include "simgrid/sg_config.h"
+#include "src/surf/platform.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu_cas, surf_cpu,
"Logging specific to the SURF CPU IMPROVED module");
surf_cpu_model_vm = new simgrid::surf::CpuCas01Model();
xbt_dynar_push(all_existing_models, &surf_cpu_model_vm);
- sg_platf_postparse_add_cb(simgrid::surf::cpu_add_traces);
+ simgrid::surf::on_postparse.connect(simgrid::surf::cpu_add_traces);
}
namespace simgrid {
#include "cpu_ti.hpp"
#include "trace_mgr_private.h"
#include "xbt/heap.h"
+#include "src/surf/platform.hpp"
#ifndef SURF_MODEL_CPUTI_H_
#define SURF_MODEL_CPUTI_H_
static void cpu_ti_define_callbacks()
{
- sg_platf_postparse_add_cb(simgrid::surf::cpu_add_traces);
+ simgrid::surf::on_postparse.connect(simgrid::surf::cpu_add_traces);
}
/*********
#include "cpu_interface.hpp"
#include "surf_routing.hpp"
#include "xbt/lib.h"
+#include "src/surf/platform.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_host);
xbt_assert(!surf_network_model, "network model type already defined");
// Define the callbacks to parse the XML
- sg_platf_link_add_cb(ptask_netlink_parse_init);
- sg_platf_postparse_add_cb(host_add_traces);
+ simgrid::surf::on_link.connect(ptask_netlink_parse_init);
+ simgrid::surf::on_postparse.connect(host_add_traces);
surf_host_model = new simgrid::surf::HostL07Model();
xbt_dynar_push(all_existing_models, &surf_host_model);
#include "src/surf/surf_private.h"
#include "xbt/graph.h"
+#include "src/surf/platform.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_routing, instr, "Tracing platform hierarchy");
//always need the call backs to ASes (we need only the root AS),
//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_postparse_add_cb(instr_routing_parse_end_platform);
+ simgrid::surf::on_link.connect(instr_routing_parse_start_link);
+ simgrid::surf::on_postparse.connect(instr_routing_parse_end_platform);
}
/*
#include "network_cm02.hpp"
#include "maxmin_private.hpp"
#include "simgrid/sg_config.h"
+#include "src/surf/platform.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network);
void net_define_callbacks(void)
{
/* Figuring out the network links */
- sg_platf_link_add_cb(netlink_parse_init);
- sg_platf_postparse_add_cb(net_add_traces);
+ simgrid::surf::on_link.connect(netlink_parse_init);
+ simgrid::surf::on_postparse.connect(net_add_traces);
}
/*********
#include "surf/random_mgr.h"
#include "host_interface.hpp"
+#include "src/surf/platform.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network);
static int host_number_int = 0;
simgrid::s4u::Host::onCreation.connect([](simgrid::s4u::Host&) {
host_number_int++;
});
- sg_platf_link_add_cb(netcste_parse_nolink);
+ simgrid::surf::on_link.connect(netcste_parse_nolink);
simgrid::surf::Model *model = surf_network_model;
xbt_dynar_push(all_existing_models, &model);
#include "src/surf/surf_private.h"
#include "src/surf/host_interface.hpp"
#include "simgrid/sg_config.h"
+#include "src/surf/platform.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(ns3);
{
simgrid::s4u::Host::onCreation.connect(simgrid_ns3_add_host);
simgrid::surf::netcardCreatedCallbacks.connect(simgrid_ns3_add_router);
- sg_platf_link_add_cb (&parse_ns3_add_link);
- sg_platf_cluster_add_cb (&parse_ns3_add_cluster);
+ simgrid::surf::on_link.connect (&parse_ns3_add_link);
+ simgrid::surf::on_cluster.connect (&parse_ns3_add_cluster);
simgrid::surf::asCreatedCallbacks.connect(parse_ns3_add_AS);
- sg_platf_postparse_add_cb(&create_ns3_topology); //get_one_link_routes
- sg_platf_postparse_add_cb(&parse_ns3_end_platform); //InitializeRoutes
+ simgrid::surf::on_postparse.connect(&create_ns3_topology); //get_one_link_routes
+ simgrid::surf::on_postparse.connect(&parse_ns3_end_platform); //InitializeRoutes
}
/*********
--- /dev/null
+/* Copyright (c) 2016. 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 SIMGRID_PLATFORM_HPP
+#define SIMGRID_PLATFORM_HPP
+
+#include <xbt/base.h>
+#include <xbt/signal.hpp>
+#include <simgrid/forward.h>
+
+namespace simgrid {
+namespace surf {
+
+extern XBT_PRIVATE simgrid::xbt::signal<void(sg_platf_link_cbarg_t)> on_link;
+extern XBT_PRIVATE simgrid::xbt::signal<void(sg_platf_cluster_cbarg_t)> on_cluster;
+extern XBT_PRIVATE simgrid::xbt::signal<void(void)> on_postparse;
+
+}
+}
+
+#endif
#include "surf/surf.h"
#include "src/simix/smx_private.h"
+#include "src/surf/platform.hpp"
#include "cpu_interface.hpp"
#include "host_interface.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_parse);
-static simgrid::xbt::signal<void(sg_platf_link_cbarg_t)> on_link;
-static simgrid::xbt::signal<void(sg_platf_cluster_cbarg_t)> on_cluster;
-static simgrid::xbt::signal<void(void)> on_postparse;
+
+namespace simgrid {
+namespace surf {
+
+simgrid::xbt::signal<void(sg_platf_link_cbarg_t)> on_link;
+simgrid::xbt::signal<void(sg_platf_cluster_cbarg_t)> on_cluster;
+simgrid::xbt::signal<void(void)> on_postparse;
+
+}
+}
static int surf_parse_models_setup_already_called = 0;
/** Module management function: frees all internal data structures */
void sg_platf_exit(void) {
- on_link.disconnect_all_slots();
- on_cluster.disconnect_all_slots();
- on_postparse.disconnect_all_slots();
+ simgrid::surf::on_link.disconnect_all_slots();
+ simgrid::surf::on_cluster.disconnect_all_slots();
+ simgrid::surf::on_postparse.disconnect_all_slots();
/* make sure that we will reinit the models while loading the platf once reinited */
surf_parse_models_setup_already_called = 0;
}
void sg_platf_new_link(sg_platf_link_cbarg_t link){
- on_link(link);
+ simgrid::surf::on_link(link);
}
void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster)
{
routing_new_cluster(cluster);
- on_cluster(cluster);
+ simgrid::surf::on_cluster(cluster);
}
void sg_platf_new_storage(sg_platf_storage_cbarg_t storage)
void sg_platf_begin() { /* Do nothing: just for symmetry of user code */ }
void sg_platf_end() {
- on_postparse();
+ simgrid::surf::on_postparse();
}
void sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS)
}
/* ***************************************** */
-void sg_platf_link_add_cb(sg_platf_link_cb_t fct) {
- on_link.connect(fct);
-}
-void sg_platf_cluster_add_cb(sg_platf_cluster_cb_t fct) {
- on_cluster.connect(fct);
-}
-void sg_platf_postparse_add_cb(void_f_void_t fct) {
- on_postparse.connect(fct);
-}
-
void sg_platf_rng_stream_init(unsigned long seed[6]) {
RngStream_SetPackageSeed(seed);
sg_platf_rng_stream = RngStream_CreateStream(NULL);
#include "simgrid/platf_interface.h" // platform creation API internal interface
#include "simgrid/sg_config.h"
#include "storage_interface.hpp"
-
+#include "src/surf/platform.hpp"
#include "surf/surfxml_parse_values.h"
/*************
void routing_register_callbacks()
{
- sg_platf_postparse_add_cb(routing_parse_postparse);
- sg_platf_postparse_add_cb(check_disk_attachment);
+ simgrid::surf::on_postparse.connect(routing_parse_postparse);
+ simgrid::surf::on_postparse.connect(check_disk_attachment);
instr_routing_define_callbacks();
}
src/surf/ns3/ns3_simulator.h
src/surf/ns3/red-queue.h
src/surf/platf_generator_private.h
+ src/surf/platform.hpp
src/surf/plugins/energy.hpp
src/surf/simgrid.dtd
src/surf/simgrid_dtd.c