Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
simplify kernel part of disk. It's really shallow now
authorSUTER Frederic <frederic.suter@cc.in2p3.fr>
Tue, 6 Apr 2021 12:23:08 +0000 (14:23 +0200)
committerSUTER Frederic <frederic.suter@cc.in2p3.fr>
Tue, 6 Apr 2021 12:23:08 +0000 (14:23 +0200)
src/kernel/resource/DiskImpl.hpp
src/surf/disk_s19.cpp
src/surf/disk_s19.hpp

index 1c22108..49a91d4 100644 (file)
@@ -102,9 +102,7 @@ class DiskAction : public Action {
 public:
   static xbt::signal<void(DiskAction const&, Action::State, Action::State)> on_state_change;
 
-  DiskAction(Model* model, double cost, bool failed, DiskImpl* disk, s4u::Io::OpType type)
-      : Action(model, cost, failed), type_(type), disk_(disk){};
-
+  DiskAction(Model* model, double cost, bool failed) : Action(model, cost, failed){};
   /**
    * @brief diskAction constructor
    *
@@ -112,17 +110,10 @@ public:
    * @param cost The cost of this DiskAction in bytes
    * @param failed [description]
    * @param var The lmm variable associated to this DiskAction if it is part of a LMM component
-   * @param disk The Disk associated to this DiskAction
-   * @param type [description]
    */
-  DiskAction(kernel::resource::Model* model, double cost, bool failed, kernel::lmm::Variable* var, DiskImpl* disk,
-             s4u::Io::OpType type)
-      : Action(model, cost, failed, var), type_(type), disk_(disk){};
-
+  DiskAction(kernel::resource::Model* model, double cost, bool failed, kernel::lmm::Variable* var)
+      : Action(model, cost, failed, var){};
   void set_state(simgrid::kernel::resource::Action::State state) override;
-
-  s4u::Io::OpType type_;
-  DiskImpl* disk_;
 };
 
 } // namespace resource
index 4899708..ae62d3f 100644 (file)
@@ -35,11 +35,6 @@ DiskImpl* DiskS19Model::create_disk(const std::string& name, double read_bandwid
   return (new DiskS19(name, read_bandwidth, write_bandwidth))->set_model(this);
 }
 
-double DiskS19Model::next_occurring_event(double now)
-{
-  return DiskModel::next_occurring_event_full(now);
-}
-
 void DiskS19Model::update_actions_state(double /*now*/, double delta)
 {
   for (auto it = std::begin(*get_started_action_set()); it != std::end(*get_started_action_set());) {
@@ -78,7 +73,7 @@ DiskAction* DiskS19::write(sg_size_t size)
  **********/
 
 DiskS19Action::DiskS19Action(Model* model, double cost, bool failed, DiskImpl* disk, s4u::Io::OpType type)
-    : DiskAction(model, cost, failed, model->get_maxmin_system()->variable_new(this, 1.0, -1.0, 3), disk, type)
+    : DiskAction(model, cost, failed, model->get_maxmin_system()->variable_new(this, 1.0, -1.0, 3))
 {
   XBT_IN("(%s,%g", disk->get_cname(), cost);
 
@@ -97,35 +92,6 @@ DiskS19Action::DiskS19Action(Model* model, double cost, bool failed, DiskImpl* d
   XBT_OUT();
 }
 
-void DiskS19Action::cancel()
-{
-  set_state(Action::State::FAILED);
-}
-
-void DiskS19Action::suspend()
-{
-  XBT_IN("(%p)", this);
-  if (is_running()) {
-    get_model()->get_maxmin_system()->update_variable_penalty(get_variable(), 0.0);
-    set_suspend_state(Action::SuspendStates::SUSPENDED);
-  }
-  XBT_OUT();
-}
-
-void DiskS19Action::resume()
-{
-  THROW_UNIMPLEMENTED;
-}
-
-void DiskS19Action::set_max_duration(double /*duration*/)
-{
-  THROW_UNIMPLEMENTED;
-}
-
-void DiskS19Action::set_sharing_penalty(double)
-{
-  THROW_UNIMPLEMENTED;
-}
 void DiskS19Action::update_remains_lazy(double /*now*/)
 {
   THROW_IMPOSSIBLE;
index a6a9ef5..845abcd 100644 (file)
@@ -30,7 +30,6 @@ class DiskS19Model : public DiskModel {
 public:
   using DiskModel::DiskModel;
   DiskImpl* create_disk(const std::string& name, double read_bandwidth, double write_bandwidth) override;
-  double next_occurring_event(double now) override;
   void update_actions_state(double now, double delta) override;
 };
 
@@ -40,7 +39,7 @@ public:
 
 class DiskS19 : public DiskImpl {
 public:
-  explicit DiskS19(const std::string& name, double read_bw, double write_bw): DiskImpl(name, read_bw, write_bw) {}
+  using DiskImpl::DiskImpl;
   DiskAction* io_start(sg_size_t size, s4u::Io::OpType type) override;
   DiskAction* read(sg_size_t size) override;
   DiskAction* write(sg_size_t size) override;
@@ -53,11 +52,6 @@ public:
 class DiskS19Action : public DiskAction {
 public:
   DiskS19Action(Model* model, double cost, bool failed, DiskImpl* disk, s4u::Io::OpType type);
-  void suspend() override;
-  void cancel() override;
-  void resume() override;
-  void set_max_duration(double duration) override;
-  void set_sharing_penalty(double sharing_penalty) override;
   void update_remains_lazy(double now) override;
 };