]> AND Public Git Repository - simgrid.git/blobdiff - src/kernel/activity/IoImpl.cpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
move Cpu resource definition where it belongs
[simgrid.git] / src / kernel / activity / IoImpl.cpp
index cb274dcdb6ef576011c234b38e99ccd94bc291a0..5daae909fa730f0a1b7189269c56bff24a3ce021 100644 (file)
@@ -13,9 +13,9 @@
 #include "src/kernel/actor/ActorImpl.hpp"
 #include "src/kernel/actor/SimcallObserver.hpp"
 #include "src/kernel/context/Context.hpp"
+#include "src/kernel/resource/CpuImpl.hpp"
 #include "src/kernel/resource/DiskImpl.hpp"
 #include "src/mc/mc_replay.hpp"
-#include "src/surf/cpu_interface.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_io, simix, "Logging specific to SIMIX (io)");
 
@@ -28,6 +28,19 @@ IoImpl::IoImpl()
   piface_ = new s4u::Io(this);
 }
 
+IoImpl& IoImpl::set_sharing_penalty(double sharing_penalty)
+{
+  sharing_penalty_ = sharing_penalty;
+  return *this;
+}
+
+IoImpl& IoImpl::update_sharing_penalty(double sharing_penalty)
+{
+  sharing_penalty_ = sharing_penalty;
+  surf_action_->set_sharing_penalty(sharing_penalty);
+  return *this;
+}
+
 IoImpl& IoImpl::set_timeout(double timeout)
 {
   const s4u::Host* host = get_disk()->get_host();
@@ -59,6 +72,7 @@ IoImpl* IoImpl::start()
   state_ = State::RUNNING;
   surf_action_ =
       disk_->get_host()->get_netpoint()->get_englobing_zone()->get_disk_model()->io_start(disk_, size_, type_);
+  surf_action_->set_sharing_penalty(sharing_penalty_);
   surf_action_->set_activity(this);
 
   XBT_DEBUG("Create IO synchro %p %s", this, get_cname());