Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
factor get_remaining across acitvities
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 2 Apr 2019 14:50:54 +0000 (16:50 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 2 Apr 2019 14:50:54 +0000 (16:50 +0200)
src/kernel/activity/ActivityImpl.cpp
src/kernel/activity/ActivityImpl.hpp
src/kernel/activity/CommImpl.cpp
src/kernel/activity/CommImpl.hpp
src/kernel/activity/ExecImpl.cpp
src/kernel/activity/ExecImpl.hpp
src/kernel/activity/IoImpl.cpp
src/kernel/activity/IoImpl.hpp

index d50f13c..2065487 100644 (file)
@@ -20,6 +20,11 @@ ActivityImpl::~ActivityImpl()
   }
 }
 
+double ActivityImpl::get_remaining() const
+{
+  return surf_action_ ? surf_action_->get_remains() : 0;
+}
+
 void ActivityImpl::suspend()
 {
   if (surf_action_ == nullptr)
index 239ef1b..a81e6ac 100644 (file)
@@ -34,6 +34,7 @@ public:
   virtual void post()   = 0; // What to do when a simcall terminates
   virtual void finish() = 0;
 
+  virtual double get_remaining() const;
   // boost::intrusive_ptr<ActivityImpl> support:
   friend XBT_PUBLIC void intrusive_ptr_add_ref(ActivityImpl* activity);
   friend XBT_PUBLIC void intrusive_ptr_release(ActivityImpl* activity);
index a878362..73cf3ac 100644 (file)
@@ -134,7 +134,7 @@ XBT_PRIVATE smx_activity_t simcall_HANDLER_comm_irecv(
       other_comm = std::move(this_synchro);
       mbox->push(other_comm);
     } else {
-      if (other_comm->surf_action_ && other_comm->remains() < 1e-12) {
+      if (other_comm->surf_action_ && other_comm->get_remaining() < 1e-12) {
         XBT_DEBUG("comm %p has been already sent, and is finished, destroy it", other_comm.get());
         other_comm->state_ = SIMIX_DONE;
         other_comm->set_type(simgrid::kernel::activity::CommImpl::Type::DONE);
@@ -518,12 +518,6 @@ void CommImpl::cancel()
   }
 }
 
-/**  @brief get the amount remaining from the communication */
-double CommImpl::remains()
-{
-  return surf_action_->get_remains();
-}
-
 /** @brief This is part of the cleanup process, probably an internal command */
 void CommImpl::cleanupSurf()
 {
index 7369c98..9bda708 100644 (file)
@@ -39,7 +39,6 @@ public:
   void post() override;
   void finish() override;
   void cancel();
-  double remains();
 
   CommImpl::Type type_;        /* Type of the communication (SIMIX_COMM_SEND or SIMIX_COMM_RECEIVE) */
   MailboxImpl* mbox = nullptr; /* Rendez-vous where the comm is queued */
index 928c959..476723f 100644 (file)
@@ -131,11 +131,6 @@ void ExecImpl::cancel()
     surf_action_->cancel();
 }
 
-double ExecImpl::get_remaining() const
-{
-  return surf_action_ ? surf_action_->get_remains() : 0;
-}
-
 double ExecImpl::get_seq_remaining_ratio()
 {
   return (surf_action_ == nullptr) ? 0 : surf_action_->get_remains() / surf_action_->get_cost();
index 7930636..88b25eb 100644 (file)
@@ -37,7 +37,6 @@ public:
   ExecImpl& set_hosts(const std::vector<s4u::Host*>& hosts);
 
   unsigned int get_host_number() const { return hosts_.size(); }
-  double get_remaining() const;
   double get_seq_remaining_ratio();
   double get_par_remaining_ratio();
   virtual ActivityImpl* migrate(s4u::Host* to);
index ebabea1..6adcc17 100644 (file)
@@ -75,11 +75,6 @@ void IoImpl::cancel()
   state_ = SIMIX_CANCELED;
 }
 
-double IoImpl::get_remaining()
-{
-  return surf_action_ ? surf_action_->get_remains() : 0;
-}
-
 void IoImpl::post()
 {
   performed_ioops_ = surf_action_->get_cost();
index ed8cf3e..fe74ccd 100644 (file)
@@ -31,7 +31,6 @@ public:
   void post() override;
   void finish() override;
   void cancel();
-  double get_remaining();
 
   static xbt::signal<void(IoImpl const&)> on_start;
   static xbt::signal<void(IoImpl const&)> on_completion;