- Actor::on_destruction is now called in the destructor
Actor::on_termination new signal called when the actor terminates
its code.
+ - Global signals are now part of the Engine:
+ - on_platform_creation: after config settings, before the XML parsing
+ - on_platform_created: right after the XML parsing
+ - on_time_advance: each time the clock advances
+ - on_simulation_end: after simulation, before cleanups
+ - on_deadlock: as the name implies.
MSG:
- convert a new set of functions to the S4U C interface and move the old MSG
*/
void set_config(const std::string& str);
-private:
- kernel::EngineImpl* const pimpl;
- static Engine* instance_;
-};
+ /** Callback fired when the platform is created (ie, the xml file parsed),
+ * right before the actual simulation starts. */
+ static xbt::signal<void()> on_platform_created;
-/** Callback fired when the platform is created (ie, the xml file parsed),
- * right before the actual simulation starts. */
-extern XBT_PUBLIC xbt::signal<void()> on_platform_created;
+ /** Callback fired when the platform is about to be created
+ * (ie, after any configuration change and just before the resource creation) */
+ static xbt::signal<void()> on_platform_creation;
-/** Callback fired when the platform is about to be created
- * (ie, after any configuration change and just before the resource creation) */
-extern XBT_PUBLIC xbt::signal<void()> on_platform_creation;
+ /** Callback fired when the main simulation loop ends, just before the end of Engine::run() */
+ static xbt::signal<void()> on_simulation_end;
-/** Callback fired when the main simulation loop ends, just before the end of Engine::run() */
-extern XBT_PUBLIC xbt::signal<void()> on_simulation_end;
+ /** Callback fired when the time jumps into the future */
+ static xbt::signal<void(double)> on_time_advance;
-/** Callback fired when the time jumps into the future */
-extern XBT_PUBLIC xbt::signal<void(double)> on_time_advance;
+ /** Callback fired when the time cannot advance because of inter-actors deadlock */
+ static xbt::signal<void(void)> on_deadlock;
-/** Callback fired when the time cannot advance because of inter-actors deadlock */
-extern XBT_PUBLIC xbt::signal<void(void)> on_deadlock;
+private:
+ kernel::EngineImpl* const pimpl;
+ static Engine* instance_;
+};
#ifndef DOXYGEN /* Internal use only, no need to expose it */
template <class T> XBT_PRIVATE void get_filtered_netzones_recursive(s4u::NetZone* current, std::vector<T*>* whereto)
int console_open(lua_State*)
{
sg_platf_init();
- simgrid::s4u::on_platform_creation();
+ simgrid::s4u::Engine::on_platform_creation();
return 0;
}
int console_close(lua_State*)
{
- simgrid::s4u::on_platform_created();
+ simgrid::s4u::Engine::on_platform_created();
sg_platf_exit();
return 0;
}
6);
/* Connect callbacks */
- simgrid::s4u::on_platform_creation.connect(TRACE_start);
- simgrid::s4u::on_deadlock.connect(TRACE_end);
- simgrid::s4u::on_simulation_end.connect(TRACE_end);
+ simgrid::s4u::Engine::on_platform_creation.connect(TRACE_start);
+ simgrid::s4u::Engine::on_deadlock.connect(TRACE_end);
+ simgrid::s4u::Engine::on_simulation_end.connect(TRACE_end);
}
static void print_line(const char* option, const char* desc, const char* longdesc)
// always need the callbacks to zones (we need only the root zone), to create the rootContainer and the rootType
// properly
if (TRACE_needs_platform()) {
- simgrid::s4u::on_platform_created.connect(instr_on_platform_created);
+ simgrid::s4u::Engine::on_platform_created.connect(instr_on_platform_created);
simgrid::s4u::Host::on_creation.connect(instr_host_on_creation);
simgrid::s4u::Host::on_speed_change.connect(instr_host_on_speed_change);
simgrid::s4u::Link::on_creation.connect(instr_link_on_creation);
simgrid::s4u::Host::on_state_change.connect(&on_host_change);
simgrid::s4u::Host::on_speed_change.connect(&on_host_change);
simgrid::s4u::Host::on_destruction.connect(&on_host_destruction);
- simgrid::s4u::on_simulation_end.connect(&on_simulation_end);
+ simgrid::s4u::Engine::on_simulation_end.connect(&on_simulation_end);
simgrid::kernel::resource::CpuAction::on_state_change.connect(&on_action_state_change);
// We may only have one actor on a node. If that actor executes something like
// compute -> recv -> compute
*/
void sg_link_energy_plugin_init()
{
-
if (LinkEnergy::EXTENSION_ID.valid())
return;
LinkEnergy::EXTENSION_ID = simgrid::s4u::Link::extension_create<LinkEnergy>();
});
simgrid::s4u::Link::on_communicate.connect(&on_communicate);
- simgrid::s4u::on_simulation_end.connect(&on_simulation_end);
+ simgrid::s4u::Engine::on_simulation_end.connect(&on_simulation_end);
}
/** @ingroup plugin_energy
namespace simgrid {
namespace s4u {
-xbt::signal<void()> on_platform_creation;
-xbt::signal<void()> on_platform_created;
-xbt::signal<void()> on_simulation_end;
-xbt::signal<void(double)> on_time_advance;
-xbt::signal<void(void)> on_deadlock;
+xbt::signal<void()> Engine::on_platform_creation;
+xbt::signal<void()> Engine::on_platform_created;
+xbt::signal<void()> Engine::on_simulation_end;
+xbt::signal<void(double)> Engine::on_time_advance;
+xbt::signal<void(void)> Engine::on_deadlock;
Engine* Engine::instance_ = nullptr; /* That singleton is awful, but I don't see no other solution right now. */
#endif
/* register a function to be called by SURF after the environment creation */
sg_platf_init();
- simgrid::s4u::on_platform_created.connect(surf_presolve);
+ simgrid::s4u::Engine::on_platform_created.connect(surf_presolve);
simgrid::s4u::Storage::on_creation.connect([](simgrid::s4u::Storage const& storage) {
sg_storage_t s = simgrid::s4u::Storage::by_name(storage.get_name());
XBT_CRITICAL("Oops! Deadlock or code not perfectly clean.");
}
SIMIX_display_process_status();
- simgrid::s4u::on_deadlock();
+ simgrid::s4u::Engine::on_deadlock();
xbt_abort();
}
- simgrid::s4u::on_simulation_end();
+ simgrid::s4u::Engine::on_simulation_end();
}
double SIMIX_timer_next()
});
surf::on_cluster.connect(&clusterCreation_cb);
- s4u::on_platform_created.connect(&postparse_cb);
+ s4u::Engine::on_platform_created.connect(&postparse_cb);
s4u::NetZone::on_route_creation.connect(&routeCreation_cb);
}
/** Module management function: creates all internal data structures */
void sg_platf_init()
{
- simgrid::s4u::on_platform_created.connect(check_disk_attachment);
+ simgrid::s4u::Engine::on_platform_created.connect(check_disk_attachment);
}
/** Module management function: frees all internal data structures */
void sg_platf_exit() {
simgrid::surf::on_cluster.disconnect_slots();
- simgrid::s4u::on_platform_created.disconnect_slots();
+ simgrid::s4u::Engine::on_platform_created.disconnect_slots();
/* make sure that we will reinit the models while loading the platf once reinited */
surf_parse_models_setup_already_called = 0;
simgrid::kernel::routing::NetZoneImpl* sg_platf_new_Zone_begin(simgrid::kernel::routing::ZoneCreationArgs* zone)
{
if (not surf_parse_models_setup_already_called) {
- simgrid::s4u::on_platform_creation();
+ simgrid::s4u::Engine::on_platform_creation();
/* Initialize the surf models. That must be done after we got all config, and before we need the models.
* That is, after the last <config> tag, if any, and before the first of cluster|peer|zone|trace|trace_connect
for (auto const& model : all_existing_models)
model->update_actions_state(NOW, time_delta);
- simgrid::s4u::on_time_advance(time_delta);
+ simgrid::s4u::Engine::on_time_advance(time_delta);
TRACE_paje_dump_buffer(false);
surf_parsed_filename.c_str(), version);
}
void ETag_surfxml_platform(){
- simgrid::s4u::on_platform_created();
+ simgrid::s4u::Engine::on_platform_created();
}
void STag_surfxml_host(){