#include "simgrid/kernel/resource/Action.hpp"
#include "src/simix/smx_io_private.hpp"
+XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_io);
+
simgrid::kernel::activity::IoImpl::IoImpl(std::string name, resource::Action* surf_action, s4u::Storage* storage)
: ActivityImpl(name), storage_(storage), surf_action_(surf_action)
{
surf_action_->set_data(this);
- XBT_DEBUG("Create exec %p", this);
+ XBT_DEBUG("Create io %p", this);
+}
+
+simgrid::kernel::activity::IoImpl::~IoImpl()
+{
+ if (surf_action_ != nullptr)
+ surf_action_->unref();
+ XBT_DEBUG("Destroy io %p", this);
}
void simgrid::kernel::activity::IoImpl::cancel()
void simgrid::kernel::activity::IoImpl::post()
{
- for (smx_simcall_t const& simcall : simcalls_) {
- switch (simcall->call) {
- case SIMCALL_STORAGE_WRITE:
- simcall_storage_write__set__result(simcall, surf_action_->get_cost());
- break;
- case SIMCALL_STORAGE_READ:
- simcall_storage_read__set__result(simcall, surf_action_->get_cost());
- break;
- default:
- break;
- }
- }
-
+ performed_ioops_ = surf_action_->get_cost();
switch (surf_action_->get_state()) {
case simgrid::kernel::resource::Action::State::FAILED:
state_ = SIMIX_FAILED;
THROW_IMPOSSIBLE;
break;
}
+ on_completion(this);
SIMIX_io_finish(this);
}
+/*************
+ * Callbacks *
+ *************/
+simgrid::xbt::signal<void(simgrid::kernel::activity::IoImplPtr)> simgrid::kernel::activity::IoImpl::on_creation;
+simgrid::xbt::signal<void(simgrid::kernel::activity::IoImplPtr)> simgrid::kernel::activity::IoImpl::on_completion;