- :cpp:func:`Comm::on_send <simgrid::s4u::Comm::on_send_cb>`
:cpp:func:`Comm::on_recv <simgrid::s4u::Comm::on_recv_cb>`
- :cpp:func:`Comm::on_start <simgrid::s4u::Comm::on_start_cb>`
+ :cpp:func:`Comm::on_this_start <simgrid::s4u::Comm::on_this_start_cb>`
:cpp:func:`Comm::on_completion <simgrid::s4u::Comm::on_completion_cb>`
+ :cpp:func:`Comm::on_this_completion <simgrid::s4u::Comm::on_this_completion_cb>`
:cpp:func:`Comm::on_suspend <simgrid::s4u::Comm::on_suspend_cb>`
+ :cpp:func:`Comm::on_this_suspend <simgrid::s4u::Comm::on_this_suspend_cb>`
:cpp:func:`Comm::on_resume <simgrid::s4u::Comm::on_resume_cb>`
+ :cpp:func:`Comm::on_this_resume <simgrid::s4u::Comm::on_this_resume_cb>`
:cpp:func:`Comm::on_veto <simgrid::s4u::Comm::on_veto_cb>`
+ :cpp:func:`Comm::on_this_veto <simgrid::s4u::Comm::on_this_veto_cb>`
- :cpp:func:`Exec::on_start <simgrid::s4u::Exec::on_start_cb>`
+ :cpp:func:`Exec::on_this_start <simgrid::s4u::Exec::on_this_start_cb>`
:cpp:func:`Exec::on_completion <simgrid::s4u::Exec::on_completion_cb>`
+ :cpp:func:`Exec::on_this_completion <simgrid::s4u::Exec::on_this_completion_cb>`
:cpp:func:`Exec::on_suspend <simgrid::s4u::Exec::on_suspend_cb>`
+ :cpp:func:`Exec::on_this_suspend <simgrid::s4u::Exec::on_this_suspend_cb>`
:cpp:func:`Exec::on_resume <simgrid::s4u::Exec::on_resume_cb>`
+ :cpp:func:`Exec::on_this_resume <simgrid::s4u::Exec::on_this_resume_cb>`
:cpp:func:`Exec::on_veto <simgrid::s4u::Exec::on_veto_cb>`
+ :cpp:func:`Exec::on_this_veto <simgrid::s4u::Exec::on_this_veto_cb>`
- :cpp:func:`Io::on_start <simgrid::s4u::Io::on_start_cb>`
+ :cpp:func:`Io::on_this_start <simgrid::s4u::Io::on_this_start_cb>`
:cpp:func:`Io::on_completion <simgrid::s4u::Io::on_completion_cb>`
+ :cpp:func:`Io::on_this_completion <simgrid::s4u::Io::on_this_completion_cb>`
:cpp:func:`Io::on_suspend <simgrid::s4u::Io::on_suspend_cb>`
+ :cpp:func:`Io::on_this_suspend <simgrid::s4u::Io::on_this_suspend_cb>`
:cpp:func:`Io::on_resume <simgrid::s4u::Io::on_resume_cb>`
+ :cpp:func:`Io::on_this_resume <simgrid::s4u::Io::on_this_resume_cb>`
:cpp:func:`Io::on_veto <simgrid::s4u::Io::on_veto_cb>`
+ :cpp:func:`Io::on_this_veto <simgrid::s4u::Io::on_this_veto_cb>`
Existing Plugins
****************
auto fafard = e.host_by_name("Fafard");
// Display the details on vetoed activities
- sg4::Exec::on_veto_cb([](sg4::Exec const& a) {
- const auto& exec = static_cast<const sg4::Exec&>(a); // all activities are execs in this example
-
+ sg4::Exec::on_veto_cb([](sg4::Exec const& exec) {
XBT_INFO("Execution '%s' vetoed. Dependencies: %s; Ressources: %s", exec.get_cname(),
(exec.dependencies_solved() ? "solved" : "NOT solved"),
(exec.is_assigned() ? "assigned" : "NOT assigned"));
#ifndef _KADEMLIA_TASK_HPP_
#define _KADEMLIA_TASK_HPP_
+#include "answer.hpp"
#include "s4u-dht-kademlia.hpp"
#include "simgrid/s4u.hpp"
Activity* set_remaining(double remains);
virtual void fire_on_completion() const = 0;
- virtual void fire_on_veto() const = 0;
+ virtual void fire_on_this_completion() const = 0;
virtual void fire_on_suspend() const = 0;
+ virtual void fire_on_this_suspend() const = 0;
virtual void fire_on_resume() const = 0;
+ virtual void fire_on_this_resume() const = 0;
+ virtual void fire_on_veto() const = 0;
+ virtual void fire_on_this_veto() const = 0;
public:
XBT_ATTRIB_DEPRECATED_v334("All start() are vetoable now. Please use start() ") void vetoable_start()
if (vetoed_activities_ != nullptr)
vetoed_activities_->insert(this);
fire_on_veto();
+ fire_on_this_veto();
}
}
ActivityPtr keepalive(this);
state_ = state;
fire_on_completion();
+ fire_on_this_completion();
if (state == State::FINISHED)
release_dependencies();
}
protected:
inline static xbt::signal<void(AnyActivity const&)> on_completion;
- inline static xbt::signal<void(AnyActivity&)> on_veto;
+ xbt::signal<void(AnyActivity const&)> on_this_completion;
inline static xbt::signal<void(AnyActivity const&)> on_suspend;
+ xbt::signal<void(AnyActivity const&)> on_this_suspend;
inline static xbt::signal<void(AnyActivity const&)> on_resume;
+ xbt::signal<void(AnyActivity const&)> on_this_resume;
+ inline static xbt::signal<void(AnyActivity&)> on_veto;
+ xbt::signal<void(AnyActivity&)> on_this_veto;
public:
/*! Add a callback fired when the activity completes (either normally, cancelled or failed) */
static void on_completion_cb(const std::function<void(AnyActivity const&)>& cb) { on_completion.connect(cb); }
- /*! 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(AnyActivity&)>& cb) { on_veto.connect(cb); }
+ void on_this_completion_cb(const std::function<void(AnyActivity const&)>& cb) { on_this_completion.connect(cb); }
/*! Add a callback fired when the activity is suspended */
static void on_suspend_cb(const std::function<void(AnyActivity const&)>& cb) { on_suspend.connect(cb); }
+ void on_this_suspend_cb(const std::function<void(AnyActivity const&)>& cb) { on_this_suspend.connect(cb); }
/*! Add a callback fired when the activity is resumed after being suspended */
static void on_resume_cb(const std::function<void(AnyActivity const&)>& cb) { on_resume.connect(cb); }
+ void on_this_resume_cb(const std::function<void(AnyActivity const&)>& cb) { on_this_resume.connect(cb); }
+ /*! 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(AnyActivity&)>& cb) { on_veto.connect(cb); }
+ void on_this_veto_cb(const std::function<void(AnyActivity&)>& cb) { on_this_veto.connect(cb); }
XBT_ATTRIB_DEPRECATED_v337("Please use on_suspend_cb() instead") static void on_suspended_cb(
const std::function<void(Activity const&)>& cb) { on_suspend.connect(cb); }
protected:
static xbt::signal<void(Comm const&)> on_send;
static xbt::signal<void(Comm const&)> on_recv;
- static xbt::signal<void(Comm const&)> on_start;
+ inline static xbt::signal<void(Comm const&)> on_start;
+ xbt::signal<void(Comm const&)> on_this_start;
- void fire_on_completion() const override { /* Do nothing */ }
- void fire_on_veto() const override { on_veto(const_cast<Comm&>(*this)); }
+ void fire_on_completion() const override {
+ /* The completion signal of a Comm has to be thrown only once and not by the sender AND the receiver.
+ then Comm::on_completion is thrown in the kernel in CommImpl::finish.
+ */
+ }
+ void fire_on_this_completion() const override {
+ /* The completion signal of a Comm has to be thrown only once and not by the sender AND the receiver.
+ then Comm::on_completion is thrown in the kernel in CommImpl::finish.
+ */
+ }
void fire_on_suspend() const override { on_suspend(*this); }
+ void fire_on_this_suspend() const override { on_this_suspend(*this); }
void fire_on_resume() const override { on_resume(*this); }
+ void fire_on_this_resume() const override { on_this_resume(*this); }
+ void fire_on_veto() const override { on_veto(const_cast<Comm&>(*this)); }
+ void fire_on_this_veto() const override { on_this_veto(const_cast<Comm&>(*this)); }
public:
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); }
+ void on_this_start_cb(const std::function<void(Comm const&)>& cb) { on_this_start.connect(cb); }
CommPtr set_copy_data_callback(const std::function<void(kernel::activity::CommImpl*, void*, size_t)>& callback);
XBT_ATTRIB_DEPRECATED_v337("Please manifest if you actually need this function") static void copy_buffer_callback(
void reset() const;
- static xbt::signal<void(Exec const&)> on_start;
+ inline static xbt::signal<void(Exec const&)> on_start;
+ xbt::signal<void(Exec const&)> on_this_start;
void fire_on_completion() const override { on_completion(*this); }
- void fire_on_veto() const override { on_veto(const_cast<Exec&>(*this)); }
+ void fire_on_this_completion() const override { on_this_completion(*this); }
void fire_on_suspend() const override { on_suspend(*this); }
+ void fire_on_this_suspend() const override { on_this_suspend(*this); }
void fire_on_resume() const override { on_resume(*this); }
+ void fire_on_this_resume() const override { on_this_resume(*this); }
+ void fire_on_veto() const override { on_veto(const_cast<Exec&>(*this)); }
+ void fire_on_this_veto() const override { on_this_veto(const_cast<Exec&>(*this)); }
public:
#ifndef DOXYGEN
#endif
/*! Signal fired each time that an execution actually starts (no veto) */
static void on_start_cb(const std::function<void(Exec const&)>& cb) { on_start.connect(cb); }
+ void on_this_start_cb(const std::function<void(Exec const&)>& cb) { on_this_start.connect(cb); }
static ExecPtr init();
friend kernel::EngineImpl;
#endif
- static xbt::signal<void(Io const&)> on_start;
+ inline static xbt::signal<void(Io const&)> on_start;
+ xbt::signal<void(Io const&)> on_this_start;
protected:
explicit Io(kernel::activity::IoImplPtr pimpl);
Io* do_start() override;
void fire_on_completion() const override { on_completion(*this); }
- void fire_on_veto() const override { on_veto(const_cast<Io&>(*this)); }
+ void fire_on_this_completion() const override { on_this_completion(*this); }
void fire_on_suspend() const override { on_suspend(*this); }
+ void fire_on_this_suspend() const override { on_this_suspend(*this); }
void fire_on_resume() const override { on_resume(*this); }
+ void fire_on_this_resume() const override { on_this_resume(*this); }
+ void fire_on_veto() const override { on_veto(const_cast<Io&>(*this)); }
+ void fire_on_this_veto() const override { on_this_veto(const_cast<Io&>(*this)); }
public:
enum class OpType { READ, WRITE };
static void on_start_cb(const std::function<void(Io const&)>& cb) { on_start.connect(cb); }
+ void on_this_start_cb(const std::function<void(Io const&)>& cb) { on_this_start.connect(cb); }
static IoPtr init();
/*! take a vector of s4u::IoPtr and return when one of them is finished.
}
XBT_VERB("This activity is suspended (remain: %f)", model_action_->get_remains());
get_iface()->fire_on_suspend();
+ get_iface()->fire_on_this_suspend();
model_action_->suspend();
}
return;
XBT_VERB("This activity is resumed (remain: %f)", model_action_->get_remains());
get_iface()->fire_on_resume();
+ get_iface()->fire_on_this_resume();
model_action_->resume();
}
XBT_DEBUG("CommImpl::finish() comm %p, state %s, src_proc %p, dst_proc %p, detached: %d", this, get_state_str(),
src_actor_.get(), dst_actor_.get(), detached_);
- s4u::Comm::on_completion(static_cast<const s4u::Comm&>(*this->get_iface()));
+ const s4u::Comm& piface = static_cast<const s4u::Comm&>(*this->get_iface());
+ s4u::Comm::on_completion(piface);
+ //piface.on_this_completion(piface);
/* Update synchro state */
if (src_timeout_ && src_timeout_->get_state() == resource::Action::State::FINISHED)
/* 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 HOST_L07_HPP_
+#define HOST_L07_HPP_
+
#include "src/kernel/resource/HostImpl.hpp"
#include "src/kernel/resource/NetworkModel.hpp"
+#include "src/simgrid/math_utils.h"
#include <cstdlib>
#include <vector>
#include <xbt/base.h>
-#ifndef HOST_L07_HPP_
-#define HOST_L07_HPP_
-
namespace simgrid::kernel::resource {
/***********
#include "src/kernel/xml/simgrid_dtd.h"
#include <map>
+#include <memory>
#include <string>
#include <vector>
#ifndef SIMGRID_MC_BASICSTRATEGY_HPP
#define SIMGRID_MC_BASICSTRATEGY_HPP
+#include "Strategy.hpp"
+
namespace simgrid::mc {
/** Basic MC guiding class which corresponds to no guide at all (random choice) */
/* 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. */
-#include "xbt/asserts.h"
-
#ifndef SIMGRID_MC_STRATEGY_HPP
#define SIMGRID_MC_STRATEGY_HPP
+#include "simgrid/forward.h"
+#include "src/mc/api/RemoteApp.hpp"
+#include "xbt/asserts.h"
+#include <map>
+#include <utility>
+
namespace simgrid::mc {
class Strategy {
#ifndef SIMGRID_MC_WAITSTRATEGY_HPP
#define SIMGRID_MC_WAITSTRATEGY_HPP
+#include "Strategy.hpp"
#include "src/mc/transition/Transition.hpp"
namespace simgrid::mc {
public:
WaitStrategy() = default;
~WaitStrategy() override = default;
- WaitStrategy(const BasicStrategy&) = delete;
+ WaitStrategy(const WaitStrategy&) = delete;
WaitStrategy& operator=(const WaitStrategy& guide)
{
taken_wait_ = guide.taken_wait_;
#ifndef SIMGRID_MC_UDPOR_CHECKER_HPP
#define SIMGRID_MC_UDPOR_CHECKER_HPP
+#include "src/mc/api/State.hpp"
#include "src/mc/explo/Exploration.hpp"
#include "src/mc/explo/udpor/Configuration.hpp"
#include "src/mc/explo/udpor/EventSet.hpp"
namespace simgrid::s4u {
xbt::signal<void(Comm const&)> Comm::on_send;
xbt::signal<void(Comm const&)> Comm::on_recv;
-xbt::signal<void(Comm const&)> Comm::on_start;
CommPtr Comm::set_copy_data_callback(const std::function<void(kernel::activity::CommImpl*, void*, size_t)>& callback)
{
pimpl_->set_iface(this);
pimpl_->set_actor(sender_);
// Only throw the signal when both sides are here and the status is READY
- if (pimpl_->get_state() != kernel::activity::State::WAITING)
+ if (pimpl_->get_state() != kernel::activity::State::WAITING) {
on_start(*this);
+ on_this_start(*this);
+ }
}
state_ = State::STARTED;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_exec, s4u_activity, "S4U asynchronous executions");
namespace simgrid::s4u {
-xbt::signal<void(Exec const&)> Exec::on_start;
Exec::Exec(kernel::activity::ExecImplPtr pimpl)
{
state_ = State::STARTED;
on_start(*this);
+ on_this_start(*this);
return this;
}
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_io, s4u_activity, "S4U asynchronous I/Os");
namespace simgrid::s4u {
-xbt::signal<void(Io const&)> Io::on_start;
Io::Io(kernel::activity::IoImplPtr pimpl)
{
state_ = State::STARTED;
on_start(*this);
+ on_this_start(*this);
return this;
}
#ifndef SMPI_TOPO_HPP_INCLUDED
#define SMPI_TOPO_HPP_INCLUDED
-#include "smpi_comm.hpp"
#include "smpi_status.hpp"
#include <memory>
odr_violation:^on_suspend$
# size=56 'on_resume' ../include/simgrid/s4u/Activity.hpp:238:55
odr_violation:^on_resume$
+
+# size=56 'on_start' ../include/simgrid/s4u/Comm.hpp:45:48
+# size=56 'on_start' ../include/simgrid/s4u/Exec.hpp:45:48
+odr_violation:^on_start$