Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add capacity to update priority of Execs too
authorSUTER Frederic <frederic.suter@cc.in2p3.fr>
Sat, 30 Oct 2021 15:59:12 +0000 (17:59 +0200)
committerSUTER Frederic <frederic.suter@cc.in2p3.fr>
Sat, 30 Oct 2021 15:59:12 +0000 (17:59 +0200)
include/simgrid/s4u/Exec.hpp
src/kernel/activity/ExecImpl.cpp
src/kernel/activity/ExecImpl.hpp
src/s4u/s4u_Exec.cpp

index c6b3898..3aa1400 100644 (file)
@@ -78,6 +78,7 @@ public:
 
   ExecPtr set_bound(double bound);
   ExecPtr set_priority(double priority);
+  ExecPtr update_priority(double priority);
 
   Host* get_host() const;
   unsigned int get_host_number() const;
index 052929c..ca3c8f2 100644 (file)
@@ -115,6 +115,13 @@ ExecImpl& ExecImpl::set_sharing_penalty(double sharing_penalty)
   return *this;
 }
 
+ExecImpl& ExecImpl::update_sharing_penalty(double sharing_penalty)
+{
+  sharing_penalty_ = sharing_penalty;
+  surf_action_->set_sharing_penalty(sharing_penalty);
+  return *this;
+}
+
 void ExecImpl::post()
 {
   xbt_assert(surf_action_ != nullptr);
index f52e203..1c00760 100644 (file)
@@ -36,6 +36,8 @@ public:
   ExecImpl& set_timeout(double timeout) override;
   ExecImpl& set_bound(double bound);
   ExecImpl& set_sharing_penalty(double sharing_penalty);
+  ExecImpl& update_sharing_penalty(double sharing_penalty);
+
   void set_cb_id(unsigned int cb_id) { cb_id_ = cb_id; }
 
   double get_start_time() const { return start_time_; }
index 57ea18a..ae4367f 100644 (file)
@@ -108,6 +108,14 @@ ExecPtr Exec::set_priority(double priority)
   return this;
 }
 
+ExecPtr Exec::update_priority(double priority)
+{
+  kernel::actor::simcall([this, priority] {
+    boost::static_pointer_cast<kernel::activity::ExecImpl>(pimpl_)->update_sharing_penalty(1. / priority);
+  });
+  return this;
+}
+
 ExecPtr Exec::set_flops_amount(double flops_amount)
 {
   xbt_assert(state_ == State::INITED || state_ == State::STARTING,