namespace kernel {
namespace activity {
-ExecImpl::ExecImpl(const std::string& name, const std::string& tracing_category) : ActivityImpl(name)
-{
- this->state_ = SIMIX_RUNNING;
- this->set_category(tracing_category);
-
- XBT_DEBUG("Create exec %p", this);
-}
-
ExecImpl::~ExecImpl()
{
if (timeout_detector_)
return this;
}
+ExecImpl* ExecImpl::set_name(const std::string& name)
+{
+ ActivityImpl::set_name(name);
+ return this;
+}
+
+ExecImpl* ExecImpl::set_tracing_category(const std::string& category)
+{
+ ActivityImpl::set_category(category);
+ return this;
+}
+
ExecImpl* ExecImpl::set_timeout(double timeout)
{
if (timeout > 0 && not MC_is_active() && not MC_record_replay_is_active()) {
ExecImpl* ExecImpl::start(double flops_amount, double priority, double bound)
{
+ state_ = SIMIX_RUNNING;
if (not MC_is_active() && not MC_record_replay_is_active()) {
surf_action_ = host_->pimpl_cpu->execution_start(flops_amount);
surf_action_->set_data(this);
ExecImpl* ExecImpl::start(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
const std::vector<double>& bytes_amounts)
{
+ state_ = SIMIX_RUNNING;
/* set surf's synchro */
if (not MC_is_active() && not MC_record_replay_is_active()) {
surf_action_ = surf_host_model->execute_parallel(hosts, flops_amounts.data(), bytes_amounts.data(), -1);
~ExecImpl();
public:
- explicit ExecImpl(const std::string& name, const std::string& tracing_category);
ExecImpl* start(double flops_amount, double priority, double bound);
ExecImpl* start(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
const std::vector<double>& bytes_amounts);
+ ExecImpl* set_name(const std::string& name);
+ ExecImpl* set_tracing_category(const std::string& category);
ExecImpl* set_host(s4u::Host* host);
ExecImpl* set_timeout(double timeout);
void cancel();
return nullptr;
} else {
- return activity::ExecImplPtr(new activity::ExecImpl("suspend", ""))->set_host(host_)->start(0.0, 1.0, 0.0);
+ return activity::ExecImplPtr(new activity::ExecImpl())->set_name("suspend")->set_host(host_)->start(0.0, 1.0, 0.0);
}
}
Exec::Exec()
{
- pimpl_ = kernel::activity::ExecImplPtr(new kernel::activity::ExecImpl(name_, tracing_category_));
+ pimpl_ = kernel::activity::ExecImplPtr(new kernel::activity::ExecImpl());
}
bool Exec::test()
Exec* ExecSeq::start()
{
simix::simcall([this] {
- boost::static_pointer_cast<kernel::activity::ExecImpl>(pimpl_)->start(flops_amount_, 1. / priority_, bound_);
+ boost::static_pointer_cast<kernel::activity::ExecImpl>(pimpl_)
+ ->set_name(name_)
+ ->set_tracing_category(tracing_category_)
+ ->start(flops_amount_, 1. / priority_, bound_);
});
state_ = State::STARTED;
on_start(*Actor::self());
double priority, double bound, sg_host_t host)
{
return simgrid::simix::simcall([name, category, flops_amount, priority, bound, host] {
- return simgrid::kernel::activity::ExecImplPtr(
- new simgrid::kernel::activity::ExecImpl(std::move(name), std::move(category)))
+ return simgrid::kernel::activity::ExecImplPtr(new simgrid::kernel::activity::ExecImpl())
+ ->set_name(name)
+ ->set_tracing_category(category)
->set_host(host)
->start(flops_amount, priority, bound);
});
if (bytes_amount != nullptr)
bytes_parallel_amount = std::vector<double>(bytes_amount, bytes_amount + host_nb * host_nb);
return simgrid::simix::simcall([name, hosts, flops_parallel_amount, bytes_parallel_amount, timeout] {
- return simgrid::kernel::activity::ExecImplPtr(new simgrid::kernel::activity::ExecImpl(std::move(name), ""))
+ return simgrid::kernel::activity::ExecImplPtr(new simgrid::kernel::activity::ExecImpl())
+ ->set_name(name)
->set_timeout(timeout)
->start(hosts, flops_parallel_amount, bytes_parallel_amount);
});