Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines.
[simgrid.git] / src / surf / ptask_L07.hpp
index 2caab73..18baba8 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2019. 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. */
@@ -51,7 +51,7 @@ public:
   CpuL07Model(HostL07Model* hmodel, kernel::lmm::System* sys);
   CpuL07Model(const CpuL07Model&) = delete;
   CpuL07Model& operator=(const CpuL07Model&) = delete;
-  ~CpuL07Model();
+  ~CpuL07Model() override;
 
   kernel::resource::Cpu* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate, int core) override;
   HostL07Model *hostModel_;
@@ -62,7 +62,7 @@ public:
   NetworkL07Model(HostL07Model* hmodel, kernel::lmm::System* sys);
   NetworkL07Model(const NetworkL07Model&) = delete;
   NetworkL07Model& operator=(const NetworkL07Model&) = delete;
-  ~NetworkL07Model();
+  ~NetworkL07Model() override;
   kernel::resource::LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths,
                                           double latency, s4u::Link::SharingPolicy policy) override;
 
@@ -81,7 +81,7 @@ public:
   CpuL07(const CpuL07&) = delete;
   CpuL07& operator=(const CpuL07&) = delete;
   ~CpuL07() override;
-  bool is_used() override;
+  bool is_used() const override;
   void apply_event(kernel::profile::Event* event, double value) override;
   kernel::resource::CpuAction* execution_start(double size) override;
   kernel::resource::CpuAction* execution_start(double, int) override
@@ -102,7 +102,7 @@ public:
   LinkL07(const LinkL07&) = delete;
   LinkL07& operator=(const LinkL07&) = delete;
   ~LinkL07() override;
-  bool is_used() 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;
@@ -112,6 +112,16 @@ public:
  * Action *
  **********/
 class L07Action : public kernel::resource::CpuAction {
+  std::vector<s4u::Host*> hostList_;
+  bool free_arrays_ = false; // By default, computationAmount_ and friends are freed by caller. But not for sequential
+                             // exec and regular comms
+  const double* computationAmount_;   /* pointer to the data that lives in s4u action -- do not free unless if
+                                       * free_arrays */
+  const double* communicationAmount_; /* pointer to the data that lives in s4u action -- do not free unless if
+                                       * free_arrays */
+  double latency_;
+  double rate_;
+
   friend CpuAction* CpuL07::execution_start(double size);
   friend CpuAction* CpuL07::sleep(double duration);
   friend CpuAction* HostL07Model::execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
@@ -119,25 +129,17 @@ class L07Action : public kernel::resource::CpuAction {
   friend Action* NetworkL07Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate);
 
 public:
+  L07Action() = delete;
   L07Action(kernel::resource::Model* model, const std::vector<s4u::Host*>& host_list, const double* flops_amount,
             const double* bytes_amount, double rate);
   L07Action(const L07Action&) = delete;
   L07Action& operator=(const L07Action&) = delete;
-  ~L07Action();
+  ~L07Action() override;
 
   void updateBound();
-
-  std::vector<s4u::Host*> hostList_;
-  const double* computationAmount_;   /* pointer to the data that lives in s4u action -- do not free unless if
-                                       * free_arrays */
-  const double* communicationAmount_; /* pointer to the data that lives in s4u action -- do not free unless if
-                                       * free_arrays */
-  double latency_;
-  double rate_;
-
-private:
-  bool free_arrays_ = false; // By default, computationAmount_ and friends are freed by caller. But not for sequential
-                             // exec and regular comms
+  double get_latency() const { return latency_; }
+  void set_latency(double latency) { latency_ = latency; }
+  void update_latency(double delta, double precision) { double_update(&latency_, delta, precision); }
 };
 
 } // namespace surf