* @endrst
*/
class XBT_PUBLIC Exec : public Activity_T<Exec> {
+ friend kernel::activity::ExecImpl;
double priority_ = 1.0;
double bound_ = 0.0;
double timeout_ = 0.0;
bool parallel_ = false;
double start_time_ = -1.0;
double finish_time_ = -1.0;
- Exec();
+
+protected:
+ explicit Exec(kernel::activity::ExecImplPtr pimpl);
public:
~Exec() override = default;
Host* get_host() const;
unsigned int get_host_number() const;
double get_start_time() const { return start_time_; }
- double get_finish_time() const;
+ double get_finish_time() const { return finish_time_; }
+ void set_finish_time(double finish_time) { finish_time_ = finish_time; }
double get_cost() const;
bool is_parallel() const { return parallel_; }
bool is_assigned() const override { return not hosts_.empty(); }
/* 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 "simgrid/s4u/Exec.hpp"
#include "src/kernel/activity/ExecImpl.hpp"
#include "simgrid/Exception.hpp"
#include "simgrid/modelchecker.h"
ExecImpl::ExecImpl()
{
+ piface_ = new s4u::Exec(this);
actor::ActorImpl* self = actor::ActorImpl::self();
if (self) {
actor_ = self;
state_ = State::DONE;
}
+ get_iface()->set_finish_time(surf_action_->get_finish_time());
+
clean_action();
timeout_detector_.reset();
if (actor_) {
simcall_execution_waitany_for__set__result(simcall, rank);
}
}
-
switch (state_) {
case State::DONE:
/* do nothing, synchro done */
#ifndef SIMGRID_KERNEL_ACTIVITY_EXEC_HPP
#define SIMGRID_KERNEL_ACTIVITY_EXEC_HPP
+#include "simgrid/s4u/Exec.hpp"
#include "src/kernel/activity/ActivityImpl.hpp"
#include "src/kernel/context/Context.hpp"
#include "surf/surf.hpp"
std::vector<s4u::Host*> hosts_;
std::vector<double> flops_amounts_;
std::vector<double> bytes_amounts_;
-
+ s4u::Exec* piface_;
public:
ExecImpl();
+ s4u::Exec* get_iface() { return piface_; }
ExecImpl& set_timeout(double timeout) override;
ExecImpl& set_bound(double bound);
xbt::signal<void(Exec const&)> Exec::on_start;
xbt::signal<void(Exec const&)> Exec::on_completion;
-Exec::Exec()
+Exec::Exec(kernel::activity::ExecImplPtr pimpl)
{
- pimpl_ = kernel::activity::ExecImplPtr(new kernel::activity::ExecImpl());
+ pimpl_ = pimpl;
}
ExecPtr Exec::init()
{
- return ExecPtr(new Exec());
+ auto pimpl = kernel::activity::ExecImplPtr(new kernel::activity::ExecImpl());
+ return ExecPtr(pimpl->get_iface());
}
Exec* Exec::wait()
{
return static_cast<kernel::activity::ExecImpl*>(pimpl_.get())->get_host_number();
}
-double Exec::get_finish_time() const
-{
- return (pimpl_->surf_action_ == nullptr) ? -1 : pimpl_->surf_action_->get_finish_time();
-}
double Exec::get_cost() const
{
return (pimpl_->surf_action_ == nullptr) ? -1 : pimpl_->surf_action_->get_cost();