Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Type size_t for every variant of get_host_count().
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 21 Apr 2022 08:19:59 +0000 (10:19 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 22 Apr 2022 09:50:21 +0000 (11:50 +0200)
include/simgrid/s4u/NetZone.hpp
src/kernel/resource/WifiLinkImpl.cpp
src/kernel/resource/WifiLinkImpl.hpp
src/plugins/link_energy_wifi.cpp
src/s4u/s4u_Netzone.cpp

index bb6fb7f..e974320 100644 (file)
@@ -47,7 +47,7 @@ public:
   std::vector<NetZone*> get_children() const;
 
   std::vector<Host*> get_all_hosts() const;
-  int get_host_count() const;
+  size_t get_host_count() const;
 
   kernel::routing::NetZoneImpl* get_impl() const { return pimpl_; }
 
index 66c0652..f61fd12 100644 (file)
@@ -60,15 +60,15 @@ s4u::Link::SharingPolicy WifiLinkImpl::get_sharing_policy() const
   return s4u::Link::SharingPolicy::WIFI;
 }
 
-int WifiLinkImpl::get_host_count() const
+size_t WifiLinkImpl::get_host_count() const
 {
-  return static_cast<int>(host_rates_.size());
+  return host_rates_.size();
 }
 
 void WifiLinkImpl::refresh_decay_bandwidths()
 {
   // Compute number of STAtion on the Access Point
-  int nSTA = get_host_count();
+  size_t nSTA = get_host_count();
 
   std::vector<Metric> new_bandwidths;
   for (auto const& bandwidth : bandwidths_) {
index 234eb09..5486b33 100644 (file)
@@ -54,7 +54,7 @@ public:
   void set_latency(double) override;
   void refresh_decay_bandwidths();
   bool toggle_decay_model();
-  int get_host_count() const;
+  size_t get_host_count() const;
 };
 
 class WifiLinkAction : public NetworkCm02Action {
index 2a57a2b..76bc939 100644 (file)
@@ -108,7 +108,7 @@ void LinkEnergyWifi::update_destroy()
   eDyn_ += duration * control_duration_ * wifi_link->get_host_count() * pRx_;
   eStat_ += (duration - (duration * control_duration_)) * pIdle_ * (wifi_link->get_host_count() + 1);
 
-  XBT_DEBUG("finish eStat_ += %f * %f * (%d+1) | eStat = %f", duration, pIdle_, wifi_link->get_host_count(), eStat_);
+  XBT_DEBUG("finish eStat_ += %f * %f * (%zu+1) | eStat = %f", duration, pIdle_, wifi_link->get_host_count(), eStat_);
 }
 
 void LinkEnergyWifi::update()
@@ -188,7 +188,7 @@ void LinkEnergyWifi::update()
   if (link_->get_usage() != 0.0) {
     eDyn_ += /*duration * */ durUsage * ((wifi_link->get_host_count() * pRx_) + pTx_);
     eStat_ += (duration - durUsage) * pIdle_ * (wifi_link->get_host_count() + 1);
-    XBT_DEBUG("eDyn +=  %f * ((%d * %f) + %f) | eDyn = %f (durusage =%f)", durUsage, wifi_link->get_host_count(), pRx_,
+    XBT_DEBUG("eDyn +=  %f * ((%zu * %f) + %f) | eDyn = %f (durusage =%f)", durUsage, wifi_link->get_host_count(), pRx_,
               pTx_, eDyn_, durUsage);
     dur_TxRx_ += duration;
   } else {
@@ -196,7 +196,7 @@ void LinkEnergyWifi::update()
     eStat_ += (duration - (duration * control_duration_)) * pIdle_ * (wifi_link->get_host_count() + 1);
   }
 
-  XBT_DEBUG("eStat_ += %f * %f * (%d+1) | eStat = %f", duration, pIdle_, wifi_link->get_host_count(), eStat_);
+  XBT_DEBUG("eStat_ += %f * %f * (%zu+1) | eStat = %f", duration, pIdle_, wifi_link->get_host_count(), eStat_);
 }
 
 void LinkEnergyWifi::init_watts_range_list()
index 8f01821..d2fb7b3 100644 (file)
@@ -76,7 +76,7 @@ std::vector<Host*> NetZone::get_all_hosts() const
   return pimpl_->get_all_hosts();
 }
 
-int NetZone::get_host_count() const
+size_t NetZone::get_host_count() const
 {
   return pimpl_->get_host_count();
 }