Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'pikachuyann/simgrid-xbt_random'
[simgrid.git] / src / surf / ptask_L07.hpp
index 83f62f3..4025bee 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2020. 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. */
@@ -40,7 +40,7 @@ public:
   HostL07Model& operator=(const HostL07Model&) = delete;
   ~HostL07Model() override;
 
-  double next_occuring_event(double now) override;
+  double next_occurring_event(double now) override;
   void update_actions_state(double now, double delta) override;
   kernel::resource::CpuAction* execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
                                                 const double* bytes_amount, double rate) override;
@@ -63,8 +63,8 @@ public:
   NetworkL07Model(const NetworkL07Model&) = delete;
   NetworkL07Model& operator=(const NetworkL07Model&) = delete;
   ~NetworkL07Model();
-  kernel::resource::LinkImpl* create_link(const std::string& name, std::vector<double> bandwidths, double latency,
-                                          s4u::Link::SharingPolicy policy) override;
+  kernel::resource::LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths,
+                                          double latency, s4u::Link::SharingPolicy policy) override;
 
   kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) 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,
@@ -126,18 +136,9 @@ public:
   ~L07Action();
 
   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