Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix ExecImpl::get_remaining to return the right value when not started
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 14 Dec 2021 16:15:29 +0000 (17:15 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 14 Dec 2021 16:18:51 +0000 (17:18 +0100)
src/kernel/activity/ExecImpl.cpp
src/kernel/activity/ExecImpl.hpp

index 4e3f3f2..a7f68d4 100644 (file)
@@ -92,14 +92,25 @@ ExecImpl* ExecImpl::start()
   return this;
 }
 
+double ExecImpl::get_remaining() const
+{
+  if (state_ == State::WAITING)
+    return flops_amounts_.front();
+  return ActivityImpl::get_remaining();
+}
+
 double ExecImpl::get_seq_remaining_ratio()
 {
+  if (state_ == State::WAITING)
+    return 1;
   return (surf_action_ == nullptr) ? 0 : surf_action_->get_remains() / surf_action_->get_cost();
 }
 
 double ExecImpl::get_par_remaining_ratio()
 {
   // parallel task: their remain is already between 0 and 1
+  if (state_ == State::WAITING)
+    return 1;
   return (surf_action_ == nullptr) ? 0 : surf_action_->get_remains();
 }
 
index 7bfc430..ac8b8c8 100644 (file)
@@ -55,6 +55,7 @@ public:
   unsigned int get_host_number() const { return hosts_.size(); }
   double get_seq_remaining_ratio();
   double get_par_remaining_ratio();
+  double get_remaining() const override;
   virtual ActivityImpl* migrate(s4u::Host* to);
 
   ExecImpl* start();