Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Initialize CPU model for VMs in init_HL13
[simgrid.git] / src / surf / ptask_L07.hpp
index 263cb8e..cf70d56 100644 (file)
@@ -1,12 +1,12 @@
-/* Copyright (c) 2013-2020. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2021. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include "src/surf/HostImpl.hpp"
 #include <cstdlib>
 #include <vector>
 #include <xbt/base.h>
-#include "src/surf/HostImpl.hpp"
 
 #ifndef HOST_L07_HPP_
 #define HOST_L07_HPP_
@@ -38,7 +38,6 @@ public:
   HostL07Model();
   HostL07Model(const HostL07Model&) = delete;
   HostL07Model& operator=(const HostL07Model&) = delete;
-  ~HostL07Model() override;
 
   double next_occurring_event(double now) override;
   void update_actions_state(double now, double delta) override;
@@ -52,9 +51,14 @@ public:
   CpuL07Model(const CpuL07Model&) = delete;
   CpuL07Model& operator=(const CpuL07Model&) = delete;
   ~CpuL07Model() override;
-
-  kernel::resource::Cpu* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate, int core) override;
-  HostL07Model *hostModel_;
+  void update_actions_state(double /*now*/, double /*delta*/) override{
+      /* this action is done by HostL07Model which shares the LMM system with the CPU model
+       * Overriding to an empty function here allows us to handle the Cpu07Model as a regular
+       * method in surf_presolve */
+  };
+
+  kernel::resource::Cpu* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate) override;
+  HostL07Model* hostModel_;
 };
 
 class NetworkL07Model : public kernel::resource::NetworkModel {
@@ -64,11 +68,16 @@ public:
   NetworkL07Model& operator=(const NetworkL07Model&) = delete;
   ~NetworkL07Model() override;
   kernel::resource::LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths,
-                                          double latency, s4u::Link::SharingPolicy policy) override;
+                                          s4u::Link::SharingPolicy policy) override;
 
   kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
+  void update_actions_state(double /*now*/, double /*delta*/) override{
+      /* this action is done by HostL07Model which shares the LMM system with the CPU model
+       * Overriding to an empty function here allows us to handle the Cpu07Model as a regular
+       * method in surf_presolve */
+  };
 
-  HostL07Model *hostModel_;
+  HostL07ModelhostModel_;
 };
 
 /************
@@ -77,10 +86,10 @@ public:
 
 class CpuL07 : public kernel::resource::Cpu {
 public:
-  CpuL07(CpuL07Model* model, s4u::Host* host, const std::vector<double>& speed_per_pstate, int core);
+  using kernel::resource::Cpu::Cpu;
   CpuL07(const CpuL07&) = delete;
   CpuL07& operator=(const CpuL07&) = delete;
-  ~CpuL07() override;
+
   bool is_used() const override;
   void apply_event(kernel::profile::Event* event, double value) override;
   kernel::resource::CpuAction* execution_start(double size) override;
@@ -97,15 +106,14 @@ protected:
 
 class LinkL07 : public kernel::resource::LinkImpl {
 public:
-  LinkL07(NetworkL07Model* model, const std::string& name, double bandwidth, double latency,
-          s4u::Link::SharingPolicy policy);
+  LinkL07(const std::string& name, double bandwidth, s4u::Link::SharingPolicy policy, kernel::lmm::System* system);
   LinkL07(const LinkL07&) = delete;
   LinkL07& operator=(const LinkL07&) = delete;
   ~LinkL07() override;
   bool is_used() const override;
   void apply_event(kernel::profile::Event* event, double value) override;
   void set_bandwidth(double value) override;
-  void set_latency(double value) override;
+  LinkImpl* set_latency(double value) override;
 };
 
 /**********