From c502e0d66a1c71f817190511d1f8271aff20dcc3 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Sat, 4 Jun 2022 10:43:47 +0200 Subject: [PATCH] Propagate const attribute (sonar). --- src/surf/ptask_L07.cpp | 10 +++++----- src/surf/ptask_L07.hpp | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/surf/ptask_L07.cpp b/src/surf/ptask_L07.cpp index eafd6d2d38..209639d8d1 100644 --- a/src/surf/ptask_L07.cpp +++ b/src/surf/ptask_L07.cpp @@ -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(var->get_id()); + const auto* action = static_cast(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(var->get_id()); + const auto* action = static_cast(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::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::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()); diff --git a/src/surf/ptask_L07.hpp b/src/surf/ptask_L07.hpp index 97dd33b060..68fc050684 100644 --- a/src/surf/ptask_L07.hpp +++ b/src/surf/ptask_L07.hpp @@ -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); } -- 2.20.1