Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Propagate const attribute (sonar).
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sat, 4 Jun 2022 08:43:47 +0000 (10:43 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 5 Jun 2022 12:28:40 +0000 (14:28 +0200)
src/surf/ptask_L07.cpp
src/surf/ptask_L07.hpp

index eafd6d2..209639d 100644 (file)
@@ -295,7 +295,7 @@ void CpuL07::on_speed_change()
   get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(), get_core_count() * speed_.peak * speed_.scale);
 
   while (const auto* var = get_constraint()->get_variable(&elem)) {
-    auto* action = static_cast<L07Action*>(var->get_id());
+    const auto* action = static_cast<L07Action*>(var->get_id());
     action->update_bound();
   }
 
@@ -368,7 +368,7 @@ void LinkL07::set_latency(double value)
 
   latency_.peak = value;
   while (const auto* var = get_constraint()->get_variable(&elem)) {
-    auto* action = static_cast<L07Action*>(var->get_id());
+    const auto* action = static_cast<L07Action*>(var->get_id());
     action->update_bound();
   }
 }
@@ -386,7 +386,7 @@ L07Action::~L07Action()
   }
 }
 
-double L07Action::calculate_network_bound()
+double L07Action::calculate_network_bound() const
 {
   double lat_current = 0.0;
   double lat_bound   = std::numeric_limits<double>::max();
@@ -414,7 +414,7 @@ double L07Action::calculate_network_bound()
   return lat_bound;
 }
 
-double L07Action::calculate_cpu_bound()
+double L07Action::calculate_cpu_bound() const
 {
   double cpu_bound = std::numeric_limits<double>::max();
 
@@ -431,7 +431,7 @@ double L07Action::calculate_cpu_bound()
   return cpu_bound;
 }
 
-void L07Action::update_bound()
+void L07Action::update_bound() const
 {
   double bound = std::min(calculate_network_bound(), calculate_cpu_bound());
 
index 97dd33b..68fc050 100644 (file)
@@ -137,7 +137,7 @@ class L07Action : public CpuAction {
    * The task is bounded by the slowest CPU running the ptask, considering the current pstate of each CPU.
    * Return MAX_DOUBLE if ptask has no computation.
    */
-  double calculate_cpu_bound();
+  double calculate_cpu_bound() const;
 
   /**
    * @brief Calculate the network bound for the parallel task
@@ -145,7 +145,7 @@ class L07Action : public CpuAction {
    * The network bound depends on the largest latency between the communication in the ptask.
    * Return MAX_DOUBLE if latency is 0 (or ptask doesn't have any communication)
    */
-  double calculate_network_bound();
+  double calculate_network_bound() const;
 
 public:
   L07Action() = delete;
@@ -155,7 +155,7 @@ public:
   L07Action& operator=(const L07Action&) = delete;
   ~L07Action() override;
 
-  void update_bound();
+  void update_bound() const;
   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); }