From: Martin Quinson Date: Sat, 11 Feb 2023 19:17:10 +0000 (+0100) Subject: Add a Link::get_concurrency_limit and use it in the flatifier X-Git-Tag: v3.34~549 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/9a4a63964b6673ab9ba406356cfdffac2f6d2489 Add a Link::get_concurrency_limit and use it in the flatifier --- diff --git a/docs/source/app_s4u.rst b/docs/source/app_s4u.rst index e5c5e71140..44f14272ba 100644 --- a/docs/source/app_s4u.rst +++ b/docs/source/app_s4u.rst @@ -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 diff --git a/include/simgrid/s4u/Link.hpp b/include/simgrid/s4u/Link.hpp index b4cda596ad..2195c694dd 100644 --- a/include/simgrid/s4u/Link.hpp +++ b/include/simgrid/s4u/Link.hpp @@ -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. * diff --git a/src/kernel/resource/LinkImpl.hpp b/src/kernel/resource/LinkImpl.hpp index e9b43c50ae..f7f269f212 100644 --- a/src/kernel/resource/LinkImpl.hpp +++ b/src/kernel/resource/LinkImpl.hpp @@ -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 diff --git a/src/kernel/resource/SplitDuplexLinkImpl.cpp b/src/kernel/resource/SplitDuplexLinkImpl.cpp index cf8c0311f2..d5b08c9a06 100644 --- a/src/kernel/resource/SplitDuplexLinkImpl.cpp +++ b/src/kernel/resource/SplitDuplexLinkImpl.cpp @@ -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); diff --git a/src/kernel/resource/SplitDuplexLinkImpl.hpp b/src/kernel/resource/SplitDuplexLinkImpl.hpp index fe81c42bce..8708018e4e 100644 --- a/src/kernel/resource/SplitDuplexLinkImpl.hpp +++ b/src/kernel/resource/SplitDuplexLinkImpl.hpp @@ -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 diff --git a/src/kernel/resource/StandardLinkImpl.cpp b/src/kernel/resource/StandardLinkImpl.cpp index 40932ef4f2..30471d020b 100644 --- a/src/kernel/resource/StandardLinkImpl.cpp +++ b/src/kernel/resource/StandardLinkImpl.cpp @@ -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 diff --git a/src/kernel/resource/StandardLinkImpl.hpp b/src/kernel/resource/StandardLinkImpl.hpp index 1c5c8b7775..4a10210074 100644 --- a/src/kernel/resource/StandardLinkImpl.hpp +++ b/src/kernel/resource/StandardLinkImpl.hpp @@ -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 diff --git a/src/s4u/s4u_Link.cpp b/src/s4u/s4u_Link.cpp index 5243121671..8d41270893 100644 --- a/src/s4u/s4u_Link.cpp +++ b/src/s4u/s4u_Link.cpp @@ -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); }); diff --git a/teshsuite/platforms/flatifier.cpp b/teshsuite/platforms/flatifier.cpp index 89ebb22776..728ddfbdfe 100644 --- a/teshsuite/platforms/flatifier.cpp +++ b/teshsuite/platforms/flatifier.cpp @@ -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 << " get_name() << "\" "; - ss << "bandwidth=\"" << link->get_bandwidth() << "\" "; - ss << "latency=\"" << link->get_latency() << "\""; + ss << " 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 {