Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add and use Link::is_shared()
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 17 Feb 2021 18:45:53 +0000 (19:45 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 17 Feb 2021 18:45:53 +0000 (19:45 +0100)
include/simgrid/s4u/Link.hpp
src/s4u/s4u_Link.cpp
teshsuite/simdag/flatifier/flatifier.cpp

index ae4335a..451accc 100644 (file)
@@ -84,6 +84,9 @@ public:
   /** @brief Check if the Link is used (at least one flow uses the link) */
   bool is_used() const;
 
+  /** @brief Check if the Link is shared (not a FATPIPE) */
+  bool is_shared() const;
+
   void turn_on();
   bool is_on() const;
   void turn_off();
index bdb1292..6d71cf2 100644 (file)
@@ -51,6 +51,11 @@ bool Link::is_used() const
   return this->pimpl_->is_used();
 }
 
+bool Link::is_shared() const
+{
+  return this->pimpl_->get_sharing_policy() != SharingPolicy::FATPIPE;
+}
+
 double Link::get_latency() const
 {
   return this->pimpl_->get_latency();
@@ -147,7 +152,7 @@ sg_link_t sg_link_by_name(const char* name)
 
 int sg_link_is_shared(const_sg_link_t link)
 {
-  return link->get_sharing_policy() != simgrid::s4u::Link::SharingPolicy::FATPIPE;
+  return link->is_shared();
 }
 
 double sg_link_get_bandwidth(const_sg_link_t link)
index d9496b9..144f7c9 100644 (file)
@@ -8,6 +8,7 @@
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
+#include "simgrid/s4u/Link.hpp"
 #include "src/surf/network_interface.hpp"
 
 #include <algorithm>
@@ -82,7 +83,7 @@ static void dump_links()
     std::printf("  <link id=\"");
 
     std::printf("%s\" bandwidth=\"%.0f\" latency=\"%.9f\"", link->get_cname(), link->get_bandwidth(), link->get_latency());
-    if (sg_link_is_shared(link)) {
+    if (link->is_shared()) {
       std::printf("/>\n");
     } else {
       std::printf(" sharing_policy=\"FATPIPE\"/>\n");