Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a Link::get_concurrency_limit and use it in the flatifier
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 11 Feb 2023 19:17:10 +0000 (20:17 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 11 Feb 2023 23:20:44 +0000 (00:20 +0100)
docs/source/app_s4u.rst
include/simgrid/s4u/Link.hpp
src/kernel/resource/LinkImpl.hpp
src/kernel/resource/SplitDuplexLinkImpl.cpp
src/kernel/resource/SplitDuplexLinkImpl.hpp
src/kernel/resource/StandardLinkImpl.cpp
src/kernel/resource/StandardLinkImpl.hpp
src/s4u/s4u_Link.cpp
teshsuite/platforms/flatifier.cpp

index e5c5e71..44f1427 100644 (file)
@@ -1582,6 +1582,7 @@ Querying info
       .. doxygenfunction:: simgrid::s4u::Link::get_latency() const
       .. doxygenfunction:: simgrid::s4u::Link::get_name() const
       .. doxygenfunction:: simgrid::s4u::Link::get_sharing_policy() const
+      .. doxygenfunction:: simgrid::s4u::Link::get_concurrency_limit() const
       .. doxygenfunction:: simgrid::s4u::Link::get_usage() const
       .. doxygenfunction:: simgrid::s4u::Link::is_used() const
 
index b4cda59..2195c69 100644 (file)
@@ -111,6 +111,7 @@ public:
    * @param limit  Number of concurrent flows
    */
   Link* set_concurrency_limit(int limit);
+  int get_concurrency_limit() const;
 
   /** @brief Set the level of communication speed of the given host on this wifi link.
    *
index e9b43c5..f7f269f 100644 (file)
@@ -40,6 +40,8 @@ public:
   virtual void set_latency_profile(kernel::profile::Profile* profile) = 0;
   /** @brief Set the concurrency limit for this link */
   virtual void set_concurrency_limit(int limit) const = 0;
+  /** @brief Get the concurrency limit of this link */
+  virtual int get_concurrency_limit() const = 0;
 };
 
 } // namespace simgrid::kernel::resource
index cf8c031..d5b08c9 100644 (file)
@@ -85,6 +85,11 @@ void SplitDuplexLinkImpl::set_latency_profile(profile::Profile* profile)
   link_down_->set_latency_profile(profile);
 }
 
+int SplitDuplexLinkImpl::get_concurrency_limit() const
+{
+  return link_up_->get_concurrency_limit();
+}
+
 void SplitDuplexLinkImpl::set_concurrency_limit(int limit) const
 {
   link_up_->set_concurrency_limit(limit);
index fe81c42..8708018 100644 (file)
@@ -66,6 +66,7 @@ public:
    * Profile must contain absolute values */
   void set_latency_profile(kernel::profile::Profile* profile) override;
   void set_concurrency_limit(int limit) const override;
+  int get_concurrency_limit() const override;
 };
 
 } // namespace simgrid::kernel::resource
index 40932ef..30471d0 100644 (file)
@@ -140,5 +140,9 @@ void StandardLinkImpl::set_concurrency_limit(int limit) const
   }
   get_constraint()->set_concurrency_limit(limit);
 }
+int StandardLinkImpl::get_concurrency_limit() const
+{
+  return get_constraint()->get_concurrency_limit();
+}
 
 } // namespace simgrid::kernel::resource
index 1c5c8b7..4a10210 100644 (file)
@@ -72,6 +72,7 @@ public:
   void set_latency_profile(kernel::profile::Profile* profile) override;
 
   void set_concurrency_limit(int limit) const override;
+  int get_concurrency_limit() const override;
 };
 
 } // namespace simgrid::kernel::resource
index 5243121..8d41270 100644 (file)
@@ -119,6 +119,11 @@ void Link::set_host_wifi_rate(const s4u::Host* host, int level) const
   wlink->set_host_rate(host, level);
 }
 
+int Link::get_concurrency_limit() const
+{
+  return pimpl_->get_concurrency_limit();
+}
+
 Link* Link::set_concurrency_limit(int limit)
 {
   kernel::actor::simcall_object_access(pimpl_, [this, limit] { pimpl_->set_concurrency_limit(limit); });
index 89ebb22..728ddfb 100644 (file)
@@ -71,9 +71,11 @@ static void dump_links(sg4::Engine& engine, std::stringstream& ss)
             [](const sg4::Link* a, const sg4::Link* b) { return a->get_name() < b->get_name(); });
 
   for (auto const* link : links) {
-    ss << "  <link id=\"" << link->get_name() << "\" ";
-    ss << "bandwidth=\"" << link->get_bandwidth() << "\" ";
-    ss << "latency=\"" << link->get_latency() << "\"";
+    ss << "  <link id=\"" << link->get_name() << "\"";
+    ss << " bandwidth=\"" << link->get_bandwidth() << "\"";
+    ss << " latency=\"" << link->get_latency() << "\"";
+    if (link->get_concurrency_limit() != -1)
+      ss << " concurrency=\"" << link->get_concurrency_limit() << "\"";
     if (link->is_shared()) {
       ss << "/>\n";
     } else {