double simgrid::kernel::activity::ExecImpl::remains()
{
- return surfAction_->getRemains();
+ xbt_assert(host_ != nullptr, "Calling remains() on a parallel execution is not allowed. "
+ "We would need to return a vector instead of a scalar. "
+ "Did you meant remainingRatio() instead?");
+
+ return surfAction_ ? surfAction_->getRemains() : 0;
+}
+double simgrid::kernel::activity::ExecImpl::remainingRatio()
+{
+ if (host_ == nullptr) // parallel task: their remain is already between 0 and 1 (see comment in ExecImpl::remains())
+ return surfAction_->getRemains();
+ else // Actually compute the ratio for sequential tasks
+ return surfAction_->getRemains() / surfAction_->getCost();
}
void simgrid::kernel::activity::ExecImpl::post()