- New function: Engine::track_vetoed_activities() to interrupt run()
when an activity fails to start, and to keep track of such activities.
Please see the corresponding example for more info.
+ - Introduce on_X_cb() functions for all signals, to attach a new
+ callback to the signal X. The signal variables are now hidden and
+ only these functions should be used.
+ Rational: this enables the usual deprecation schema where functions
+ remain for 4 releases when we need to modify the signals, while the
+ current code with the signal variables directly visible prevent any
+ smooth transition.
SMPI:
- Dynamic costs for MPI operations: New API to allow users to dynamically
e.load_platform(argv[1]); /* - Load the platform description */
/* Register a callback in the Actor::on_termination signal. It will be called for every terminated actors */
- sg4::Actor::on_termination.connect(
+ sg4::Actor::on_termination_cb(
[](sg4::Actor const& actor) { XBT_INFO("Actor %s terminates now", actor.get_cname()); });
/* Register a callback in the Actor::on_destruction signal. It will be called for every destructed actors */
- sg4::Actor::on_destruction.connect(
+ sg4::Actor::on_destruction_cb(
[](sg4::Actor const& actor) { XBT_INFO("Actor %s gets destroyed now", actor.get_cname()); });
/* Create some actors */
auto jupiter = e.host_by_name("Jupiter");
// Display the details on vetoed activities
- simgrid::s4u::Activity::on_veto.connect([](const simgrid::s4u::Activity& a) {
+ simgrid::s4u::Activity::on_veto_cb([](const simgrid::s4u::Activity& a) {
XBT_INFO("Activity '%s' vetoed. Dependencies: %s; Ressources: %s", a.get_cname(),
(a.dependencies_solved() ? "solved" : "NOT solved"), (a.is_assigned() ? "assigned" : "NOT assigned"));
});
- simgrid::s4u::Activity::on_completion.connect([](simgrid::s4u::Activity& activity) {
+ simgrid::s4u::Activity::on_completion_cb([](simgrid::s4u::Activity& activity) {
const auto* exec = dynamic_cast<simgrid::s4u::Exec*>(&activity);
if (exec != nullptr)
XBT_INFO("Activity '%s' is complete (start time: %f, finish time: %f)", exec->get_cname(), exec->get_start_time(),
auto* faulty = e.host_by_name("Faulty Host");
auto* safe = e.host_by_name("Safe Host");
- sg4::Activity::on_completion.connect([](sg4::Activity& activity) {
+ sg4::Activity::on_completion_cb([](sg4::Activity& activity) {
const auto* exec = dynamic_cast<simgrid::s4u::Exec*>(&activity);
if (exec == nullptr) // Only Execs are concerned here
return;
auto carl = e.host_by_name("carl");
// Display the details on vetoed activities
- simgrid::s4u::Activity::on_veto.connect([](const simgrid::s4u::Activity& a) {
+ simgrid::s4u::Activity::on_veto_cb([](const simgrid::s4u::Activity& a) {
XBT_INFO("Activity '%s' vetoed. Dependencies: %s; Ressources: %s", a.get_cname(),
(a.dependencies_solved() ? "solved" : "NOT solved"), (a.is_assigned() ? "assigned" : "NOT assigned"));
});
- simgrid::s4u::Activity::on_completion.connect([](simgrid::s4u::Activity& activity) {
+ simgrid::s4u::Activity::on_completion_cb([](simgrid::s4u::Activity& activity) {
const auto* exec = dynamic_cast<simgrid::s4u::Exec*>(&activity);
if (exec == nullptr) // Only Execs are concerned here
return;
std::set<simgrid::s4u::Activity*> vetoed;
e.track_vetoed_activities(&vetoed);
- simgrid::s4u::Activity::on_completion.connect([](simgrid::s4u::Activity& activity) {
+ simgrid::s4u::Activity::on_completion_cb([](simgrid::s4u::Activity& activity) {
// when an Exec completes, we need to set the potential start time of all its ouput comms
const auto* exec = dynamic_cast<simgrid::s4u::Exec*>(&activity);
if (exec == nullptr) // Only Execs are concerned here
auto fafard = e.host_by_name("Fafard");
// Display the details on vetoed activities
- simgrid::s4u::Activity::on_veto.connect([](const simgrid::s4u::Activity& a) {
+ simgrid::s4u::Activity::on_veto_cb([](const simgrid::s4u::Activity& a) {
const auto& exec = static_cast<const simgrid::s4u::Exec&>(a); // all activities are execs in this example
XBT_INFO("Activity '%s' vetoed. Dependencies: %s; Ressources: %s", exec.get_cname(),
(exec.is_assigned() ? "assigned" : "NOT assigned"));
});
- simgrid::s4u::Activity::on_completion.connect([](simgrid::s4u::Activity& activity) {
+ simgrid::s4u::Activity::on_completion_cb([](simgrid::s4u::Activity& activity) {
const auto* exec = dynamic_cast<simgrid::s4u::Exec*>(&activity);
if (exec == nullptr) // Only Execs are concerned here
return;
simgrid::s4u::Actor::create("worker", e.host_by_name("Fafard"), worker);
- simgrid::s4u::Activity::on_veto.connect([&e](simgrid::s4u::Activity& a) {
+ simgrid::s4u::Activity::on_veto_cb([&e](simgrid::s4u::Activity& a) {
auto& exec = static_cast<simgrid::s4u::Exec&>(a);
// First display the situation
// This is how to attach a profile to an host that is created from the XML file.
// This should be done before calling load_platform(), as the on_creation() event is fired when loading the platform.
// You can never set a new profile to a resource that already have one.
- sg4::Host::on_creation.connect([](sg4::Host& h) {
+ sg4::Host::on_creation_cb([](sg4::Host& h) {
if (h.get_name() == "Bourrassa") {
h.set_state_profile(simgrid::kernel::profile::ProfileBuilder::from_string("bourassa_profile", "67 0\n70 1\n", 0));
}
static std::set<Activity*>* vetoed_activities_;
-public:
- /*! Signal fired each time that the activity fails to start because of a veto (e.g., unsolved dependency or no
- * resource assigned) */
+private:
static xbt::signal<void(Activity&)> on_veto;
- /*! Signal fired when theactivity completes (either normally, cancelled or failed) */
static xbt::signal<void(Activity&)> on_completion;
+public:
+ /*! Add a callback fired each time that the activity fails to start because of a veto (e.g., unsolved dependency or no
+ * resource assigned) */
+ static void on_veto_cb(const std::function<void(Activity&)>& cb) { on_veto.connect(cb); }
+ /*! Add a callback fired when theactivity completes (either normally, cancelled or failed) */
+ static void on_completion_cb(const std::function<void(Activity&)> cb) { on_completion.connect(cb); }
+
void vetoable_start()
{
state_ = State::STARTING;
/** Retrieve a reference to myself */
static Actor* self();
- /** Fired when a new actor has been created **/
+#ifndef DOXYGEN
static xbt::signal<void(Actor&)> on_creation;
- /** Signal to others that an actor has been suspended**/
static xbt::signal<void(Actor const&)> on_suspend;
- /** Signal to others that an actor has been resumed **/
static xbt::signal<void(Actor const&)> on_resume;
- /** Signal to others that an actor is sleeping **/
static xbt::signal<void(Actor const&)> on_sleep;
- /** Signal to others that an actor wakes up for a sleep **/
static xbt::signal<void(Actor const&)> on_wake_up;
- /** Signal to others that an actor is has been migrated to another host **/
static xbt::signal<void(const Actor&, const Host& previous_location)> on_host_change;
+ static xbt::signal<void(Actor const&)> on_termination;
+ static xbt::signal<void(Actor const&)> on_destruction;
+#endif
+
+public:
+ /** Add a callback fired when a new actor has been created **/
+ static void on_creation_cb(const std::function<void(Actor&)>& cb) { on_creation.connect(cb); }
+ /** Add a callback fired when an actor has been suspended**/
+ static void on_suspend_cb(const std::function<void(Actor const&)> cb) { on_suspend.connect(cb); }
+ /** Add a callback fired when an actor has been resumed **/
+ static void on_resume_cb(const std::function<void(Actor const&)>& cb) { on_resume.connect(cb); }
+ /** Add a callback fired when an actor starts sleeping **/
+ static void on_sleep_cb(const std::function<void(Actor const&)>& cb) { on_sleep.connect(cb); }
+ /** Add a callback fired when an actor wakes up from a sleep **/
+ static void on_wake_up_cb(const std::function<void(Actor const&)>& cb) { on_wake_up.connect(cb); }
+ /** Add a callback fired when an actor is has been migrated to another host **/
+ static void on_host_change_cb(const std::function<void(const Actor&, const Host& previous_location)>& cb)
+ {
+ on_host_change.connect(cb);
+ }
- /** Signal indicating that an actor terminated its code.
+ /** Add a callback fired when an actor terminates its code.
* @beginrst
* The actor may continue to exist if it is still referenced in the simulation, but it's not active anymore.
* If you want to free extra data when the actor's destructor is called, use :cpp:var:`Actor::on_destruction`.
* If you want to register to the termination of a given actor, use :cpp:func:`this_actor::on_exit()` instead.
* @endrst
*/
- static xbt::signal<void(Actor const&)> on_termination;
- /** Signal indicating that an actor is about to disappear (its destructor was called).
+ static void on_termination_cb(const std::function<void(Actor const&)>& cb) { on_termination.connect(cb); }
+ /** Add a callback fired when an actor is about to disappear (its destructor was called).
* This signal is fired for any destructed actor, which is mostly useful when designing plugins and extensions.
* If you want to react to the end of the actor's code, use Actor::on_termination instead.
* If you want to register to the termination of a given actor, use this_actor::on_exit() instead.*/
- static xbt::signal<void(Actor const&)> on_destruction;
+ static void on_destruction_cb(const std::function<void(Actor const&)>& cb) { on_destruction.connect(cb); }
/** Create an actor from a std::function<void()>.
* If the actor is restarted, it gets a fresh copy of the function. */
*/
static void sendto(Host* from, Host* to, uint64_t simulated_size_in_bytes);
+ static void on_send_cb(const std::function<void(Comm const&)>& cb) { on_send.connect(cb); }
+ static void on_recv_cb(const std::function<void(Comm const&)>& cb) { on_recv.connect(cb); }
+ static void on_start_cb(const std::function<void(Comm const&)>& cb) { on_start.connect(cb); }
+ static void on_completion_cb(const std::function<void(Comm const&)>& cb) { on_completion.connect(cb); }
+#ifndef DOXYGEN
+ /* FIXME signals should be private */
static xbt::signal<void(Comm const&)> on_send;
static xbt::signal<void(Comm const&)> on_recv;
static xbt::signal<void(Comm const&)> on_start;
static xbt::signal<void(Comm const&)> on_completion;
+#endif
/*! take a vector s4u::CommPtr and return when one of them is finished.
* The return value is the rank of the first finished CommPtr. */
Disk* seal();
/* The signals */
- /** @brief Callback signal fired when a new Disk is created */
+ /** @brief Add a callback fired when a new Disk is created */
+ static void on_creation_cb(const std::function<void(Disk&)>& cb) { on_creation.connect(cb); }
+ /** @brief Add a callback fired when a Disk is destroyed */
+ static void on_destruction_cb(const std::function<void(Disk const&)>& cb) { on_destruction.connect(cb); }
+ /** @brief Add a callback fired when a Disk's state changes */
+ static void on_state_change_cb(const std::function<void(Disk const&)>& cb) { on_state_change.connect(cb); }
+
+private:
static xbt::signal<void(Disk&)> on_creation;
- /** @brief Callback signal fired when a Disk is destroyed */
static xbt::signal<void(Disk const&)> on_destruction;
- /** @brief Callback signal fired when a Disk's state changes */
static xbt::signal<void(Disk const&)> on_state_change;
};
static void set_config(const std::string& name, const std::string& value);
Engine* set_default_comm_data_copy_callback(void (*callback)(kernel::activity::CommImpl*, void*, size_t));
- /** 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 about to be created
+ /** Add a callback fired when the platform is created (ie, the xml file parsed),
+ * right before the actual simulation starts. */
+ static void on_platform_created_cb(const std::function<void()>& cb) { on_platform_created.connect(cb); }
+ /** Add a 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;
+ static void on_platform_creation_cb(const std::function<void()>& cb) { on_platform_creation.connect(cb); }
+ /** Add a callback fired when the main simulation loop ends, just before the end of Engine::run() */
+ static void on_simulation_end_cb(const std::function<void()>& cb) { on_simulation_end.connect(cb); }
- /** 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 time jumps into the future */
- static xbt::signal<void(double)> on_time_advance;
+ /** Add a callback fired when the time jumps into the future */
+ static void on_time_advance_cb(const std::function<void(double)>& cb) { on_time_advance.connect(cb); }
- /** Callback fired when the time cannot advance because of inter-actors deadlock. Note that the on_exit of each actor
- * is also executed on deadlock. */
- static xbt::signal<void(void)> on_deadlock;
+ /** Add a callback fired when the time cannot advance because of inter-actors deadlock. Note that the on_exit of each
+ * actor is also executed on deadlock. */
+ static void on_deadlock_cb(const std::function<void(void)>& cb) { on_deadlock.connect(cb); }
+#ifndef DOXYGEN
+ /* FIXME signals should be private */
+ static xbt::signal<void()> on_platform_created;
+ static xbt::signal<void()> on_platform_creation;
+#endif
private:
+ static xbt::signal<void()> on_simulation_end;
+ static xbt::signal<void(double)> on_time_advance;
+ static xbt::signal<void(void)> on_deadlock;
kernel::EngineImpl* const pimpl;
static Engine* instance_;
void initialize(int* argc, char** argv);
void reset() const;
+ static xbt::signal<void(Exec const&)> on_start;
+
public:
#ifndef DOXYGEN
Exec(Exec const&) = delete;
Exec& operator=(Exec const&) = delete;
#endif
/*! Signal fired each time that an execution actually starts (no veto) */
- static xbt::signal<void(Exec const&)> on_start;
+ static void on_start_cb(const std::function<void(Exec const&)>& cb) { on_start.connect(cb); }
static ExecPtr init();
Exec* start() override;
protected:
virtual ~Host(); // Call destroy() instead of manually deleting it.
Host* set_netpoint(kernel::routing::NetPoint* netpoint);
-#endif
-public:
- /** Called on each newly created host */
static xbt::signal<void(Host&)> on_creation;
- /** Called when the machine is turned on or off (called AFTER the change) */
+ static xbt::signal<void(Host const&)> on_destruction;
+
+public:
+ static xbt::signal<void(Host const&)> on_speed_change;
static xbt::signal<void(Host const&)> on_state_change;
- /** Called when the speed of the machine is changed (called AFTER the change)
+#endif
+ /** Add a callback fired on each newly created host */
+ static void on_creation_cb(const std::function<void(Host&)>& cb) { on_creation.connect(cb); }
+ /** Add a callback fired when the machine is turned on or off (called AFTER the change) */
+ static void on_state_change_cb(const std::function<void(Host const&)>& cb) { on_state_change.connect(cb); }
+ /** Add a callback fired when the speed of the machine is changed (called AFTER the change)
* (either because of a pstate switch or because of an external load event coming from the profile) */
- static xbt::signal<void(Host const&)> on_speed_change;
- /** Called just before destructing a host */
- static xbt::signal<void(Host const&)> on_destruction;
+ static void on_speed_change_cb(const std::function<void(Host const&)>& cb) { on_speed_change.connect(cb); }
+ /** Add a callback fired just before destructing a host */
+ static void on_destruction_cb(const std::function<void(Host const&)>& cb) { on_destruction.connect(cb); }
virtual void destroy();
#ifndef DOXYGEN
virtual ~Link() = default;
// The implementation that never changes
kernel::resource::LinkImplIntf* const pimpl_;
+#ifndef DOXYGEN
+ friend kernel::resource::NetworkAction; // signal comm_state_changed
+#endif
public:
enum class SharingPolicy { NONLINEAR = 4, WIFI = 3, SPLITDUPLEX = 2, SHARED = 1, FATPIPE = 0 };
Link* seal();
- /* The signals */
- /** @brief Callback signal fired when a new Link is created */
+private:
+#ifndef DOXYGEN
static xbt::signal<void(Link&)> on_creation;
-
- /** @brief Callback signal fired when the state of a Link changes (when it is turned on or off) */
static xbt::signal<void(Link const&)> on_state_change;
-
- /** @brief Callback signal fired when the bandwidth of a Link changes */
static xbt::signal<void(Link const&)> on_bandwidth_change;
-
- /** @brief Callback signal fired when a communication changes it state (ready/done/cancel) */
static xbt::signal<void(kernel::resource::NetworkAction&, kernel::resource::Action::State)>
on_communication_state_change;
-
- /** @brief Callback signal fired when a Link is destroyed */
static xbt::signal<void(Link const&)> on_destruction;
+#endif
+
+public:
+ /* The signals */
+ /** @brief Add a callback fired when a new Link is created */
+ static void on_creation_cb(const std::function<void(Link&)>& cb) { on_creation.connect(cb); }
+ /** @brief Add a callback fired when the state of a Link changes (when it is turned on or off) */
+ static void on_state_change_cb(const std::function<void(Link const&)>& cb) { on_state_change.connect(cb); }
+ /** @brief Add a callback fired when the bandwidth of a Link changes */
+ static void on_bandwidth_change_cb(const std::function<void(Link const&)>& cb) { on_bandwidth_change.connect(cb); }
+ /** @brief Add a callback fired when a communication changes it state (ready/done/cancel) */
+ static void on_communication_state_change_cb(
+ const std::function<void(kernel::resource::NetworkAction&, kernel::resource::Action::State)>& cb)
+ {
+ on_communication_state_change.connect(cb);
+ }
+ /** @brief Add a callback fired when a Link is destroyed */
+ static void on_destruction_cb(std::function<void(Link const&)> cb) { on_destruction.connect(cb); }
};
/**
std::vector<kernel::resource::LinkImpl*> const& link_list)>
on_route_creation; // XBT_ATTRIB_DEPRECATED_v332 : should not be used by users, used by ns3.. if necessary,
// signal shouldn't use LinkImpl*
-#endif
+private:
static xbt::signal<void(NetZone const&)> on_creation;
static xbt::signal<void(NetZone const&)> on_seal;
+#endif
+public:
+ static void on_creation_cb(const std::function<void(NetZone const&)>& cb) { on_creation.connect(cb); }
+ static void on_seal_cb(const std::function<void(NetZone const&)>& cb) { on_seal.connect(cb); }
/**
* @brief Create a host
VirtualMachine* set_bound(double bound);
State get_state() const;
+ static void on_creation_cb(const std::function<void(VirtualMachine&)>& cb) { on_creation.connect(cb); }
+ static void on_start_cb(const std::function<void(VirtualMachine const&)>& cb) { on_start.connect(cb); }
+ static void on_started_cb(const std::function<void(VirtualMachine const&)>& cb) { on_started.connect(cb); }
+ static void on_shutdown_cb(const std::function<void(VirtualMachine const&)>& cb) { on_shutdown.connect(cb); }
+ static void on_suspend_cb(const std::function<void(VirtualMachine const&)>& cb) { on_suspend.connect(cb); }
+ static void on_resume_cb(const std::function<void(VirtualMachine const&)>& cb) { on_resume.connect(cb); }
+ static void on_destruction_cb(const std::function<void(VirtualMachine const&)>& cb) { on_destruction.connect(cb); }
+ static void on_migration_start_cb(const std::function<void(VirtualMachine const&)>& cb)
+ {
+ on_migration_start.connect(cb);
+ }
+ static void on_migration_end_cb(const std::function<void(VirtualMachine const&)>& cb)
+ {
+ on_migration_end.connect(cb);
+ }
+#ifndef DOXYGEN
+ /* FIXME the signals should be private */
+ static xbt::signal<void(VirtualMachine const&)> on_migration_start;
+ static xbt::signal<void(VirtualMachine const&)> on_migration_end;
+ static xbt::signal<void(VirtualMachine const&)> on_destruction;
+#endif
+private:
static xbt::signal<void(VirtualMachine&)> on_creation;
static xbt::signal<void(VirtualMachine const&)> on_start;
static xbt::signal<void(VirtualMachine const&)> on_started;
static xbt::signal<void(VirtualMachine const&)> on_shutdown;
static xbt::signal<void(VirtualMachine const&)> on_suspend;
static xbt::signal<void(VirtualMachine const&)> on_resume;
- static xbt::signal<void(VirtualMachine const&)> on_migration_start;
- static xbt::signal<void(VirtualMachine const&)> on_migration_end;
- static xbt::signal<void(VirtualMachine const&)> on_destruction;
};
} // namespace s4u
} // namespace simgrid
XBT_DEBUG("Filename %s is open for writing", filename.c_str());
if (format == "Paje") {
- Container::on_creation.connect(on_container_creation_paje);
- Container::on_destruction.connect(on_container_destruction_paje);
- EntityValue::on_creation.connect(on_entity_value_creation);
- Type::on_creation.connect(on_type_creation);
- LinkType::on_creation.connect(on_link_type_creation);
- PajeEvent::on_creation.connect(on_event_creation);
- PajeEvent::on_destruction.connect(on_event_destruction);
+ Container::on_creation_cb(on_container_creation_paje);
+ Container::on_destruction_cb(on_container_destruction_paje);
+ EntityValue::on_creation_cb(on_entity_value_creation);
+ Type::on_creation_cb(on_type_creation);
+ LinkType::on_creation_cb(on_link_type_creation);
+ PajeEvent::on_creation_cb(on_event_creation);
+ PajeEvent::on_destruction_cb(on_event_destruction);
paje::dump_generator_version();
paje::dump_header(trace_basic, TRACE_display_sizes());
} else {
trace_format = TraceFormat::Ti;
- Container::on_creation.connect(on_container_creation_ti);
- Container::on_destruction.connect(on_container_destruction_ti);
- StateEvent::on_destruction.connect(on_state_event_destruction);
+ Container::on_creation_cb(on_container_creation_ti);
+ Container::on_destruction_cb(on_container_destruction_ti);
+ StateEvent::on_destruction_cb(on_state_event_destruction);
}
trace_active = true;
6);
/* Connect Engine callbacks */
- s4u::Engine::on_platform_creation.connect(on_simulation_start);
- s4u::Engine::on_time_advance.connect([](double /*time_delta*/) { dump_buffer(false); });
- s4u::Engine::on_deadlock.connect(on_simulation_end);
- s4u::Engine::on_simulation_end.connect(on_simulation_end);
+ s4u::Engine::on_platform_creation_cb(on_simulation_start);
+ s4u::Engine::on_time_advance_cb([](double /*time_delta*/) { dump_buffer(false); });
+ s4u::Engine::on_deadlock_cb(on_simulation_end);
+ s4u::Engine::on_simulation_end_cb(on_simulation_end);
}
} // namespace instr
} // namespace simgrid
protected:
static void set_root(Container* root) { root_container_ = root; }
-public:
+private:
static xbt::signal<void(Container const&)> on_creation;
static xbt::signal<void(Container const&)> on_destruction;
+public:
+ static void on_creation_cb(const std::function<void(Container const&)>& cb) { on_creation.connect(cb); }
+ static void on_destruction_cb(const std::function<void(Container const&)>& cb) { on_destruction.connect(cb); }
+
explicit Container(const std::string& name, const std::string& type_name, Container* parent);
Container(const Container&) = delete;
Container& operator=(const Container&) = delete;
class PajeEvent {
Container* container_;
Type* type_;
-public:
static xbt::signal<void(PajeEvent&)> on_creation;
static xbt::signal<void(PajeEvent const&)> on_destruction;
+public:
+ static void on_creation_cb(const std::function<void(PajeEvent&)>& cb) { on_creation.connect(cb); }
+ static void on_destruction_cb(const std::function<void(PajeEvent const&)>& cb) { on_destruction.connect(cb); }
+
double timestamp_;
PajeEventType eventType_;
std::stringstream stream_;
#endif
std::unique_ptr<TIData> extra_;
-public:
static xbt::signal<void(StateEvent const&)> on_destruction;
+
+public:
+ static void on_destruction_cb(const std::function<void(StateEvent const&)>& cb) { on_destruction.connect(cb); }
StateEvent(Container* container, Type* type, PajeEventType event_type, EntityValue* value, TIData* extra);
~StateEvent() override { on_destruction(*this); }
bool has_extra() const { return extra_ != nullptr; }
std::map<std::string, std::unique_ptr<Type>, std::less<>> children_;
Container* issuer_ = nullptr;
+ static xbt::signal<void(Type const&, PajeEventType event_type)> on_creation;
+
protected:
Container* get_issuer() const { return issuer_; }
public:
- static xbt::signal<void(Type const&, PajeEventType event_type)> on_creation;
+ static void on_creation_cb(const std::function<void(Type const&, PajeEventType event_type)>& cb)
+ {
+ on_creation.connect(cb);
+ }
Type(PajeEventType event_type, const std::string& name, const std::string& alias, const std::string& color,
Type* parent);
};
class LinkType : public ValueType {
-public:
static xbt::signal<void(LinkType const&, Type const&, Type const&)> on_creation;
+
+public:
+ static void on_creation_cb(const std::function<void(LinkType const&, Type const&, Type const&)>& cb)
+ {
+ on_creation.connect(cb);
+ }
LinkType(const std::string& name, const Type* source, const Type* dest, const std::string& alias, Type* parent)
: ValueType(PajeEventType::DefineLinkType, name, alias, parent)
{
std::string color_;
Type* parent_;
-public:
static xbt::signal<void(const EntityValue&)> on_creation;
+
+public:
+ static void on_creation_cb(const std::function<void(const EntityValue&)>& cb) { on_creation.connect(cb); }
explicit EntityValue(const std::string& name, const std::string& color, Type* parent);
long long int get_id() const { return id_; }
// always need the callbacks to zones (we need only the root zone), to create the rootContainer and the rootType
// properly
if (TRACE_needs_platform()) {
- s4u::Engine::on_platform_created.connect(on_platform_created);
- s4u::Host::on_creation.connect(on_host_creation);
- s4u::Host::on_speed_change.connect([](s4u::Host const& host) {
+ s4u::Engine::on_platform_created_cb(on_platform_created);
+ s4u::Host::on_creation_cb(on_host_creation);
+ s4u::Host::on_speed_change_cb([](s4u::Host const& host) {
Container::by_name(host.get_name())
->get_variable("speed")
->set_event(simgrid_get_clock(), host.get_core_count() * host.get_available_speed());
});
- s4u::Link::on_creation.connect(on_link_creation);
- s4u::Link::on_bandwidth_change.connect([](s4u::Link const& link) {
+ s4u::Link::on_creation_cb(on_link_creation);
+ s4u::Link::on_bandwidth_change_cb([](s4u::Link const& link) {
Container::by_name(link.get_name())
->get_variable("bandwidth")
->set_event(simgrid_get_clock(), sg_bandwidth_factor * link.get_bandwidth());
});
- s4u::NetZone::on_seal.connect([](s4u::NetZone const& /*netzone*/) { currentContainer.pop_back(); });
+ s4u::NetZone::on_seal_cb([](s4u::NetZone const& /*netzone*/) { currentContainer.pop_back(); });
kernel::routing::NetPoint::on_creation.connect([](kernel::routing::NetPoint const& netpoint) {
if (netpoint.is_router())
new RouterContainer(netpoint.get_name(), currentContainer.back());
});
}
- s4u::NetZone::on_creation.connect(on_netzone_creation);
+ s4u::NetZone::on_creation_cb(on_netzone_creation);
kernel::resource::CpuAction::on_state_change.connect(on_action_state_change);
- s4u::Link::on_communication_state_change.connect(on_action_state_change);
+ s4u::Link::on_communication_state_change_cb(on_action_state_change);
if (TRACE_actor_is_enabled()) {
- s4u::Actor::on_creation.connect(on_actor_creation);
- s4u::Actor::on_destruction.connect([](s4u::Actor const& actor) {
+ s4u::Actor::on_creation_cb(on_actor_creation);
+ s4u::Actor::on_destruction_cb([](s4u::Actor const& actor) {
auto container = Container::by_name_or_null(instr_pid(actor));
if (container != nullptr)
container->remove_from_parent();
});
- s4u::Actor::on_suspend.connect([](s4u::Actor const& actor) {
+ s4u::Actor::on_suspend_cb([](s4u::Actor const& actor) {
Container::by_name(instr_pid(actor))->get_state("ACTOR_STATE")->push_event("suspend");
});
- s4u::Actor::on_resume.connect(
+ s4u::Actor::on_resume_cb(
[](s4u::Actor const& actor) { Container::by_name(instr_pid(actor))->get_state("ACTOR_STATE")->pop_event(); });
- s4u::Actor::on_sleep.connect([](s4u::Actor const& actor) {
+ s4u::Actor::on_sleep_cb([](s4u::Actor const& actor) {
Container::by_name(instr_pid(actor))->get_state("ACTOR_STATE")->push_event("sleep");
});
- s4u::Actor::on_wake_up.connect(
+ s4u::Actor::on_wake_up_cb(
[](s4u::Actor const& actor) { Container::by_name(instr_pid(actor))->get_state("ACTOR_STATE")->pop_event(); });
- s4u::Exec::on_start.connect([](s4u::Exec const&) {
+ s4u::Exec::on_start_cb([](s4u::Exec const&) {
Container::by_name(instr_pid(*s4u::Actor::self()))->get_state("ACTOR_STATE")->push_event("execute");
});
- s4u::Activity::on_completion.connect([](const s4u::Activity&) {
+ s4u::Activity::on_completion_cb([](const s4u::Activity&) {
Container::by_name(instr_pid(*s4u::Actor::self()))->get_state("ACTOR_STATE")->pop_event();
});
- s4u::Comm::on_send.connect([](s4u::Comm const&) {
+ s4u::Comm::on_send_cb([](s4u::Comm const&) {
Container::by_name(instr_pid(*s4u::Actor::self()))->get_state("ACTOR_STATE")->push_event("send");
});
- s4u::Comm::on_recv.connect([](s4u::Comm const&) {
+ s4u::Comm::on_recv_cb([](s4u::Comm const&) {
Container::by_name(instr_pid(*s4u::Actor::self()))->get_state("ACTOR_STATE")->push_event("receive");
});
- s4u::Actor::on_host_change.connect(on_actor_host_change);
+ s4u::Actor::on_host_change_cb(on_actor_host_change);
}
if (TRACE_smpi_is_enabled() && TRACE_smpi_is_computing()) {
- s4u::Exec::on_start.connect([](s4u::Exec const& exec) {
+ s4u::Exec::on_start_cb([](s4u::Exec const& exec) {
Container::by_name(std::string("rank-") + std::to_string(s4u::Actor::self()->get_pid()))
->get_state("MPI_STATE")
->push_event("computing", new CpuTIData("compute", exec.get_cost()));
});
- s4u::Activity::on_completion.connect([](const s4u::Activity&) {
+ s4u::Activity::on_completion_cb([](const s4u::Activity&) {
Container::by_name(std::string("rank-") + std::to_string(s4u::Actor::self()->get_pid()))
->get_state("MPI_STATE")
->pop_event();
}
if (TRACE_vm_is_enabled()) {
- s4u::Host::on_creation.connect(on_vm_creation);
- s4u::VirtualMachine::on_start.connect([](s4u::VirtualMachine const& vm) {
+ s4u::Host::on_creation_cb(on_vm_creation);
+ s4u::VirtualMachine::on_start_cb([](s4u::VirtualMachine const& vm) {
Container::by_name(vm.get_name())->get_state("VM_STATE")->push_event("start");
});
- s4u::VirtualMachine::on_started.connect(
+ s4u::VirtualMachine::on_started_cb(
[](s4u::VirtualMachine const& vm) { Container::by_name(vm.get_name())->get_state("VM_STATE")->pop_event(); });
- s4u::VirtualMachine::on_suspend.connect([](s4u::VirtualMachine const& vm) {
+ s4u::VirtualMachine::on_suspend_cb([](s4u::VirtualMachine const& vm) {
Container::by_name(vm.get_name())->get_state("VM_STATE")->push_event("suspend");
});
- s4u::VirtualMachine::on_resume.connect(
+ s4u::VirtualMachine::on_resume_cb(
[](s4u::VirtualMachine const& vm) { Container::by_name(vm.get_name())->get_state("VM_STATE")->pop_event(); });
- s4u::Host::on_destruction.connect(
+ s4u::Host::on_destruction_cb(
[](s4u::Host const& host) { Container::by_name(host.get_name())->remove_from_parent(); });
}
}
/* register a function to be called by SURF after the environment creation */
sg_platf_init();
- s4u::Engine::on_platform_created.connect([this]() { this->presolve(); });
+ s4u::Engine::on_platform_created_cb([this]() { this->presolve(); });
if (config::get_value<bool>("debug/clean-atexit"))
atexit(shutdown);
VMModel::VMModel(const std::string& name) : HostModel(name)
{
- s4u::Host::on_state_change.connect(host_state_change);
- s4u::Exec::on_start.connect(add_active_exec);
- s4u::Activity::on_completion.connect(remove_active_exec);
+ s4u::Host::on_state_change_cb(host_state_change);
+ s4u::Exec::on_start_cb(add_active_exec);
+ s4u::Activity::on_completion_cb(remove_active_exec);
activity::ActivityImpl::on_resumed.connect(add_active_activity);
activity::ActivityImpl::on_suspended.connect(remove_active_activity);
}
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
+ * That is, after the last <config> tag, if any, and before the first of cluster|peer|zone|trace|trace_cb
*
- * I'm not sure for <trace> and <trace_connect>, there may be a bug here
+ * I'm not sure for <trace> and <trace_cb>, there may be a bug here
* (FIXME: check it out by creating a file beginning with one of these tags)
* but cluster and peer come down to zone creations, so putting this verification here is correct.
*/
msg_global->sent_msg = 0;
msg_global->task_copy_callback = nullptr;
msg_global->process_data_cleanup = nullptr;
- simgrid::s4u::Actor::on_termination.connect([](simgrid::s4u::Actor const& actor) {
+ simgrid::s4u::Actor::on_termination_cb([](simgrid::s4u::Actor const& actor) {
// free the data if a function was provided
void* userdata = sg_actor_get_data(&actor);
if (userdata && msg_global->process_data_cleanup)
if (not FileSystemDiskExt::EXTENSION_ID.valid()) {
FileSystemDiskExt::EXTENSION_ID = simgrid::s4u::Disk::extension_create<FileSystemDiskExt>();
- simgrid::s4u::Disk::on_creation.connect(&on_disk_creation);
+ simgrid::s4u::Disk::on_creation_cb(&on_disk_creation);
}
if (not FileDescriptorHostExt::EXTENSION_ID.valid()) {
FileDescriptorHostExt::EXTENSION_ID = simgrid::s4u::Host::extension_create<FileDescriptorHostExt>();
- simgrid::s4u::Host::on_creation.connect(&on_host_creation);
+ simgrid::s4u::Host::on_creation_cb(&on_host_creation);
}
- simgrid::s4u::Engine::on_platform_created.connect(&on_platform_created);
- simgrid::s4u::Engine::on_simulation_end.connect(&on_simulation_end);
+ simgrid::s4u::Engine::on_platform_created_cb(&on_platform_created);
+ simgrid::s4u::Engine::on_simulation_end_cb(&on_simulation_end);
}
sg_file_t sg_file_open(const char* fullpath, void* data)
task_id = 0;
}
});
- simgrid::s4u::Exec::on_start.connect([this](simgrid::s4u::Exec const& activity) {
+ simgrid::s4u::Exec::on_start_cb([this](simgrid::s4u::Exec const& activity) {
if (activity.get_host() == get_host())
pre_task();
});
- simgrid::s4u::Activity::on_completion.connect([this](simgrid::s4u::Activity& activity) {
+ simgrid::s4u::Activity::on_completion_cb([this](simgrid::s4u::Activity& activity) {
const auto* exec = dynamic_cast<simgrid::s4u::Exec*>(&activity);
if (exec == nullptr) // Only Execs are concerned here
return;
sg_host_load_plugin_init();
- simgrid::s4u::Host::on_creation.connect(&on_host_added);
+ simgrid::s4u::Host::on_creation_cb(&on_host_added);
}
HostEnergy::EXTENSION_ID = simgrid::s4u::Host::extension_create<HostEnergy>();
- simgrid::s4u::Host::on_creation.connect(&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::Engine::on_simulation_end.connect(&on_simulation_end);
+ simgrid::s4u::Host::on_creation_cb(&on_creation);
+ simgrid::s4u::Host::on_state_change_cb(&on_host_change);
+ simgrid::s4u::Host::on_speed_change_cb(&on_host_change);
+ simgrid::s4u::Host::on_destruction_cb(&on_host_destruction);
+ simgrid::s4u::Engine::on_simulation_end_cb(&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
// that the next trigger would be the 2nd compute, hence ignoring the idle time
// during the recv call. By updating at the beginning of a compute, we can
// fix that. (If the cpu is not idle, this is not required.)
- simgrid::s4u::Exec::on_start.connect([](simgrid::s4u::Exec const& activity) {
+ simgrid::s4u::Exec::on_start_cb([](simgrid::s4u::Exec const& activity) {
if (activity.get_host_number() == 1) { // We only run on one host
simgrid::s4u::Host* host = activity.get_host();
const simgrid::s4u::VirtualMachine* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host);
}
// Make sure that every future host also gets an extension (in case the platform is not loaded yet)
- simgrid::s4u::Host::on_creation.connect([](simgrid::s4u::Host& host) {
+ simgrid::s4u::Host::on_creation_cb([](simgrid::s4u::Host& host) {
if (dynamic_cast<simgrid::s4u::VirtualMachine*>(&host)) // Ignore virtual machines
return;
host.extension_set(new HostLoad(&host));
});
- simgrid::s4u::Exec::on_start.connect([](simgrid::s4u::Exec const& activity) {
+ simgrid::s4u::Exec::on_start_cb([](simgrid::s4u::Exec const& activity) {
if (activity.get_host_number() == 1) { // We only run on one host
simgrid::s4u::Host* host = activity.get_host();
const simgrid::s4u::VirtualMachine* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host);
XBT_WARN("HostLoad plugin currently does not support executions on several hosts");
}
});
- simgrid::s4u::Activity::on_completion.connect([](simgrid::s4u::Activity& activity) {
+ simgrid::s4u::Activity::on_completion_cb([](simgrid::s4u::Activity& activity) {
const auto* exec = dynamic_cast<simgrid::s4u::Exec*>(&activity);
if (exec == nullptr) // Only Execs are concerned here
return;
XBT_WARN("HostLoad plugin currently does not support executions on several hosts");
}
});
- simgrid::s4u::Host::on_state_change.connect(&on_host_change);
- simgrid::s4u::Host::on_speed_change.connect(&on_host_change);
+ simgrid::s4u::Host::on_state_change_cb(&on_host_change);
+ simgrid::s4u::Host::on_speed_change_cb(&on_host_change);
}
/** @brief Returns the current load of that host, as a ratio = achieved_flops / (core_current_speed * core_amount)
xbt_assert(sg_host_count() == 0, "Please call sg_link_energy_plugin_init() before initializing the platform.");
- simgrid::s4u::Link::on_creation.connect([](simgrid::s4u::Link& link) {
+ simgrid::s4u::Link::on_creation_cb([](simgrid::s4u::Link& link) {
if (link.get_sharing_policy() != simgrid::s4u::Link::SharingPolicy::WIFI) {
XBT_DEBUG("Wired Link created: %s", link.get_cname());
link.extension_set(new LinkEnergy(&link));
}
});
- simgrid::s4u::Link::on_state_change.connect([](simgrid::s4u::Link const& link) {
+ simgrid::s4u::Link::on_state_change_cb([](simgrid::s4u::Link const& link) {
if (link.get_sharing_policy() != simgrid::s4u::Link::SharingPolicy::WIFI)
link.extension<LinkEnergy>()->update();
});
- simgrid::s4u::Link::on_destruction.connect([](simgrid::s4u::Link const& link) {
+ simgrid::s4u::Link::on_destruction_cb([](simgrid::s4u::Link const& link) {
if (link.get_name() != "__loopback__" && link.get_sharing_policy() != simgrid::s4u::Link::SharingPolicy::WIFI)
XBT_INFO("Energy consumption of link '%s': %f Joules", link.get_cname(),
link.extension<LinkEnergy>()->get_consumed_energy());
simgrid::kernel::activity::CommImpl::on_start.connect(&on_communication);
simgrid::kernel::activity::CommImpl::on_completion.connect(&on_communication);
- simgrid::s4u::Engine::on_simulation_end.connect(&on_simulation_end);
+ simgrid::s4u::Engine::on_simulation_end_cb(&on_simulation_end);
}
/** @ingroup plugin_link_energy
* - Link::on_communication_state_change: to account for the energy when communications are updated
* - CommImpl::on_start and CommImpl::on_completion: to account for the energy during communications
*/
- simgrid::s4u::Link::on_creation.connect([](simgrid::s4u::Link& link) {
+ simgrid::s4u::Link::on_creation_cb([](simgrid::s4u::Link& link) {
// verify the link is appropriate to WiFi energy computations
if (link.get_sharing_policy() == simgrid::s4u::Link::SharingPolicy::WIFI) {
XBT_DEBUG("Wifi Link: %s, initialization of wifi energy plugin", link.get_cname());
}
});
- simgrid::s4u::Link::on_destruction.connect([](simgrid::s4u::Link const& link) {
+ simgrid::s4u::Link::on_destruction_cb([](simgrid::s4u::Link const& link) {
// output energy values if WiFi link
if (link.get_sharing_policy() == simgrid::s4u::Link::SharingPolicy::WIFI) {
link.extension<LinkEnergyWifi>()->update_destroy();
}
});
- simgrid::s4u::Link::on_communication_state_change.connect(
- [](simgrid::kernel::resource::NetworkAction const& action,
- simgrid::kernel::resource::Action::State /* previous */) {
- // update WiFi links encountered during the communication
- for (auto const* link : action.get_links()) {
- if (link != nullptr && link->get_sharing_policy() == simgrid::s4u::Link::SharingPolicy::WIFI) {
- link->get_iface()->extension<LinkEnergyWifi>()->update();
- }
- }
- });
+ simgrid::s4u::Link::on_communication_state_change_cb([](simgrid::kernel::resource::NetworkAction const& action,
+ simgrid::kernel::resource::Action::State /* previous */) {
+ // update WiFi links encountered during the communication
+ for (auto const* link : action.get_links()) {
+ if (link != nullptr && link->get_sharing_policy() == simgrid::s4u::Link::SharingPolicy::WIFI) {
+ link->get_iface()->extension<LinkEnergyWifi>()->update();
+ }
+ }
+ });
simgrid::kernel::activity::CommImpl::on_start.connect(&on_communication);
simgrid::kernel::activity::CommImpl::on_completion.connect(&on_communication);
LinkLoad::EXTENSION_ID = simgrid::s4u::Link::extension_create<LinkLoad>();
// Attach new LinkLoad links created in the future.
- simgrid::s4u::Link::on_creation.connect([](simgrid::s4u::Link& link) {
+ simgrid::s4u::Link::on_creation_cb([](simgrid::s4u::Link& link) {
if (link.get_sharing_policy() != simgrid::s4u::Link::SharingPolicy::WIFI) {
XBT_DEBUG("Wired link '%s' created. Attaching a LinkLoad to it.", link.get_cname());
link.extension_set(new LinkLoad(&link));
simgrid::kernel::activity::CommImpl::on_start.connect(&on_communication);
simgrid::kernel::activity::CommImpl::on_completion.connect(&on_communication);
- simgrid::s4u::Link::on_state_change.connect([](simgrid::s4u::Link const& link) {
+ simgrid::s4u::Link::on_state_change_cb([](simgrid::s4u::Link const& link) {
if (link.get_sharing_policy() != simgrid::s4u::Link::SharingPolicy::WIFI) {
auto link_load = link.extension<LinkLoad>();
if (link_load->is_tracked())
link_load->update();
}
});
- simgrid::s4u::Link::on_communication_state_change.connect(
- [](simgrid::kernel::resource::NetworkAction const& action,
- simgrid::kernel::resource::Action::State /* previous */) {
- for (auto const* link : action.get_links()) {
- if (link != nullptr && link->get_sharing_policy() != simgrid::s4u::Link::SharingPolicy::WIFI) {
- auto link_load = link->get_iface()->extension<LinkLoad>();
- if (link_load->is_tracked())
- link_load->update();
- }
- }
- });
+ simgrid::s4u::Link::on_communication_state_change_cb([](simgrid::kernel::resource::NetworkAction const& action,
+ simgrid::kernel::resource::Action::State /* previous */) {
+ for (auto const* link : action.get_links()) {
+ if (link != nullptr && link->get_sharing_policy() != simgrid::s4u::Link::SharingPolicy::WIFI) {
+ auto link_load = link->get_iface()->extension<LinkLoad>();
+ if (link_load->is_tracked())
+ link_load->update();
+ }
+ }
+ });
}
/**
{
sg_vm_dirty_page_tracking_init();
VmMigrationExt::ensureVmMigrationExtInstalled();
- simgrid::s4u::VirtualMachine::on_shutdown.connect(&onVirtualMachineShutdown);
+ simgrid::s4u::VirtualMachine::on_shutdown_cb(&onVirtualMachineShutdown);
}
simgrid::s4u::VirtualMachine* sg_vm_create_migratable(simgrid::s4u::Host* pm, const char* name, int coreAmount,
if (not DirtyPageTrackingExt::EXTENSION_ID.valid()) {
DirtyPageTrackingExt::EXTENSION_ID =
simgrid::kernel::resource::VirtualMachineImpl::extension_create<DirtyPageTrackingExt>();
- simgrid::s4u::VirtualMachine::on_creation.connect(&on_virtual_machine_creation);
- simgrid::s4u::Exec::on_start.connect(&on_exec_creation);
- simgrid::s4u::Activity::on_completion.connect(&on_exec_completion);
+ simgrid::s4u::VirtualMachine::on_creation_cb(&on_virtual_machine_creation);
+ simgrid::s4u::Exec::on_start_cb(&on_exec_creation);
+ simgrid::s4u::Activity::on_completion_cb(&on_exec_completion);
}
}
*ierr = MPI_Comm_call_errhandler(simgrid::smpi::Comm::f2c(*comm), *errorcode);
}
-void mpi_comm_connect_ ( char *port_name, int* info, int* root, int* comm, int*newcomm, int* ierr){
+void mpi_comm_connect_(char* port_name, int* info, int* root, int* comm, int* newcomm, int* ierr)
+{
MPI_Comm tmp;
- *ierr = MPI_Comm_connect( port_name, simgrid::smpi::Info::f2c(*info), *root, simgrid::smpi::Comm::f2c(*comm), &tmp);
+ *ierr = MPI_Comm_connect(port_name, simgrid::smpi::Info::f2c(*info), *root, simgrid::smpi::Comm::f2c(*comm), &tmp);
if(*ierr == MPI_SUCCESS) {
*newcomm = tmp->c2f();
}
UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Cart_map,(MPI_Comm comm_old, int ndims, const int* dims, const int* periods, int* newrank) ,(comm_old, ndims, dims, periods, newrank))
UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Close_port,(const char *port_name),( port_name))
UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_accept,(const char *port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *newcomm),( port_name, info, root, comm, newcomm))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_connect,(const char *port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *newcomm),( port_name, info, root, comm, newcomm))
+UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_Comm_connect,
+ (const char* port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm* newcomm),
+ (port_name, info, root, comm, newcomm))
UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_get_parent,( MPI_Comm *parent),( parent))
UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_idup,( MPI_Comm comm, MPI_Comm *newcomm, MPI_Request* request),( comm, newcomm, request))
UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_join,( int fd, MPI_Comm *intercomm),( fd, intercomm))
// Called either directly from the user code, or from the code called by smpirun
void SMPI_init(){
smpi_init_options_internal(false);
- simgrid::s4u::Actor::on_creation.connect([](simgrid::s4u::Actor& actor) {
+ simgrid::s4u::Actor::on_creation_cb([](simgrid::s4u::Actor& actor) {
if (not actor.is_daemon())
actor.extension_set<simgrid::smpi::ActorExt>(new simgrid::smpi::ActorExt(&actor));
});
- simgrid::s4u::Host::on_creation.connect(
+ simgrid::s4u::Host::on_creation_cb(
[](simgrid::s4u::Host& host) { host.extension_set(new simgrid::smpi::Host(&host)); });
for (auto const& host : simgrid::s4u::Engine::get_instance()->get_all_hosts())
host->extension_set(new simgrid::smpi::Host(host));
engine->add_model(net_model);
engine->get_netzone_root()->set_network_model(net_model);
- simgrid::s4u::Link::on_communication_state_change.connect(NetworkIBModel::IB_action_state_changed_callback);
+ simgrid::s4u::Link::on_communication_state_change_cb(NetworkIBModel::IB_action_state_changed_callback);
simgrid::kernel::activity::CommImpl::on_start.connect(NetworkIBModel::IB_comm_start_callback);
- simgrid::s4u::Host::on_creation.connect(NetworkIBModel::IB_create_host_callback);
+ simgrid::s4u::Host::on_creation_cb(NetworkIBModel::IB_create_host_callback);
simgrid::config::set_default<double>("network/weight-S", 8775);
}
XBT_VERB("Declare SimGrid's %s within ns-3", pt.get_cname());
});
- s4u::Engine::on_platform_created.connect([]() {
+ s4u::Engine::on_platform_created_cb([]() {
/* Create the ns3 topology based on routing strategy */
ns3::GlobalRouteManager::BuildGlobalRoutingDatabase();
ns3::GlobalRouteManager::InitializeRoutes();
});
routing::on_cluster_creation.connect(&clusterCreation_cb);
routing::NetZoneImpl::on_route_creation.connect(&routeCreation_cb);
- s4u::NetZone::on_seal.connect(&zoneCreation_cb);
+ s4u::NetZone::on_seal_cb(&zoneCreation_cb);
}
LinkImpl* NetworkNS3Model::create_link(const std::string& name, const std::vector<double>& bandwidths)
void sg_platf_exit()
{
simgrid::kernel::routing::on_cluster_creation.disconnect_slots();
- simgrid::s4u::Engine::on_platform_created.disconnect_slots();
+ // simgrid::s4u::Engine::on_platform_created.disconnect_slots();
surf_parse_lex_destroy();
}
void sg_platf_trace_connect(simgrid::kernel::routing::TraceConnectCreationArgs* trace_connect)
{
surf_parse_assert(traces_set_list.find(trace_connect->trace) != traces_set_list.end(),
- std::string("Cannot connect trace ")+ trace_connect->trace+ " to "+trace_connect->element+": trace unknown");
+ std::string("Cannot connect trace ") + trace_connect->trace + " to " + trace_connect->element +
+ ": trace unknown");
switch (trace_connect->kind) {
case simgrid::kernel::routing::TraceConnectKind::HOST_AVAIL:
/* connect all profiles relative to hosts */
for (auto const& elm : trace_connect_list_host_avail) {
- surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"HOST_AVAIL\">: Trace ")+elm.first+" undefined.");
+ surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(),
+ std::string("<trace_connect kind=\"HOST_AVAIL\">: Trace ") + elm.first + " undefined.");
auto profile = traces_set_list.at(elm.first);
auto host = engine->host_by_name_or_null(elm.second);
}
for (auto const& elm : trace_connect_list_host_speed) {
- surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"SPEED\">: Trace ")+elm.first+" undefined.");
+ surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(),
+ std::string("<trace_connect kind=\"SPEED\">: Trace ") + elm.first + " undefined.");
auto profile = traces_set_list.at(elm.first);
auto host = engine->host_by_name_or_null(elm.second);
}
for (auto const& elm : trace_connect_list_link_avail) {
- surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"LINK_AVAIL\">: Trace ")+elm.first+" undefined.");
+ surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(),
+ std::string("<trace_connect kind=\"LINK_AVAIL\">: Trace ") + elm.first + " undefined.");
auto profile = traces_set_list.at(elm.first);
auto link = engine->link_by_name_or_null(elm.second);
}
for (auto const& elm : trace_connect_list_link_bw) {
- surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"BANDWIDTH\">: Trace ")+elm.first+" undefined.");
+ surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(),
+ std::string("<trace_connect kind=\"BANDWIDTH\">: Trace ") + elm.first + " undefined.");
auto profile = traces_set_list.at(elm.first);
auto link = engine->link_by_name_or_null(elm.second);
}
for (auto const& elm : trace_connect_list_link_lat) {
- surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"LATENCY\">: Trace ")+elm.first+" undefined.");
+ surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(),
+ std::string("<trace_connect kind=\"LATENCY\">: Trace ") + elm.first + " undefined.");
auto profile = traces_set_list.at(elm.first);
auto link = engine->link_by_name_or_null(elm.second);
"Use simgrid_update_xml to update your file automatically. "
"This program is installed automatically with SimGrid, or "
"available in the tools/ directory of the source archive.");
- surf_parse_assert((version >= 4.0),
- std::string("******* THIS FILE IS TOO OLD (v:")+std::to_string(version)+") *********\n "
- "Changes introduced in SimGrid 3.13:\n"
- " - 'power' attribute of hosts (and others) got renamed to 'speed'.\n"
- " - In <trace_connect>, attribute kind=\"POWER\" is now kind=\"SPEED\".\n"
- " - DOCTYPE now point to the rignt URL.\n"
- " - speed, bandwidth and latency attributes now MUST have an explicit unit (f, Bps, s by default)"
- "\n\n"
- "Use simgrid_update_xml to update your file automatically. "
- "This program is installed automatically with SimGrid, or "
- "available in the tools/ directory of the source archive.");
+ surf_parse_assert(
+ (version >= 4.0),
+ std::string("******* THIS FILE IS TOO OLD (v:") + std::to_string(version) +
+ ") *********\n "
+ "Changes introduced in SimGrid 3.13:\n"
+ " - 'power' attribute of hosts (and others) got renamed to 'speed'.\n"
+ " - In <trace_connect>, attribute kind=\"POWER\" is now kind=\"SPEED\".\n"
+ " - DOCTYPE now point to the rignt URL.\n"
+ " - speed, bandwidth and latency attributes now MUST have an explicit unit (f, Bps, s by default)"
+ "\n\n"
+ "Use simgrid_update_xml to update your file automatically. "
+ "This program is installed automatically with SimGrid, or "
+ "available in the tools/ directory of the source archive.");
if (version < 4.1) {
XBT_INFO("You're using a v%.1f XML file (%s) while the current standard is v4.1 "
"That's fine, the new version is backward compatible. \n\n"
simgrid::kernel::routing::TraceConnectCreationArgs trace_connect;
trace_connect.element = A_surfxml_trace___connect_element;
- trace_connect.trace = A_surfxml_trace___connect_trace;
+ trace_connect.trace = A_surfxml_trace___connect_trace;
switch (A_surfxml_trace___connect_kind) {
- case AU_surfxml_trace___connect_kind:
- case A_surfxml_trace___connect_kind_SPEED:
- trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::SPEED;
- break;
- case A_surfxml_trace___connect_kind_BANDWIDTH:
- trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::BANDWIDTH;
- break;
- case A_surfxml_trace___connect_kind_HOST___AVAIL:
- trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::HOST_AVAIL;
- break;
- case A_surfxml_trace___connect_kind_LATENCY:
- trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::LATENCY;
- break;
- case A_surfxml_trace___connect_kind_LINK___AVAIL:
- trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::LINK_AVAIL;
- break;
- default:
- surf_parse_error("Invalid trace kind");
+ case AU_surfxml_trace___connect_kind:
+ case A_surfxml_trace___connect_kind_SPEED:
+ trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::SPEED;
+ break;
+ case A_surfxml_trace___connect_kind_BANDWIDTH:
+ trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::BANDWIDTH;
+ break;
+ case A_surfxml_trace___connect_kind_HOST___AVAIL:
+ trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::HOST_AVAIL;
+ break;
+ case A_surfxml_trace___connect_kind_LATENCY:
+ trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::LATENCY;
+ break;
+ case A_surfxml_trace___connect_kind_LINK___AVAIL:
+ trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::LINK_AVAIL;
+ break;
+ default:
+ surf_parse_error("Invalid trace kind");
}
sg_platf_trace_connect(&trace_connect);
}
void ETag_surfxml_prop(){/* Nothing to do */}
void STag_surfxml_random(){/* Nothing to do */}
void ETag_surfxml_random(){/* Nothing to do */}
-void ETag_surfxml_trace___connect(){/* Nothing to do */}
+void ETag_surfxml_trace___connect()
+{ /* Nothing to do */
+}
void STag_surfxml_trace()
{ /* Nothing to do */
}
xbt_assert(argc > 1, "Usage: %s platform_file\n\nExample: %s two_clusters.xml", argv[0], argv[0]);
e.load_platform(argv[1]);
- simgrid::s4u::Activity::on_completion.connect([](simgrid::s4u::Activity& activity) {
+ simgrid::s4u::Activity::on_completion_cb([](simgrid::s4u::Activity& activity) {
const auto* exec = dynamic_cast<simgrid::s4u::Exec*>(&activity);
if (exec == nullptr) // Only Execs are concerned here
return;