Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Separate NetworkModel from LinkImpl.
authorBruno Donassolo <bruno.donassolo@inria.fr>
Sat, 2 Apr 2022 16:28:59 +0000 (18:28 +0200)
committerBruno Donassolo <bruno.donassolo@inria.fr>
Mon, 4 Apr 2022 08:37:28 +0000 (10:37 +0200)
Fix memleak in internal loopback link

34 files changed:
MANIFEST.in
include/simgrid/kernel/routing/NetZoneImpl.hpp
include/simgrid/s4u/Engine.hpp
src/instr/instr_platform.cpp
src/kernel/activity/CommImpl.cpp
src/kernel/resource/LinkImpl.hpp
src/kernel/resource/NetworkModel.cpp [moved from src/kernel/resource/LinkImpl.cpp with 97% similarity]
src/kernel/resource/NetworkModel.hpp [new file with mode: 0644]
src/kernel/resource/StandardLinkImpl.cpp
src/kernel/resource/StandardLinkImpl.hpp
src/kernel/routing/DijkstraZone.cpp
src/kernel/routing/DragonflyZone.cpp
src/kernel/routing/FatTreeZone.cpp
src/kernel/routing/FloydZone.cpp
src/kernel/routing/FullZone.cpp
src/kernel/routing/NetZoneImpl.cpp
src/kernel/routing/StarZone.cpp
src/kernel/routing/TorusZone.cpp
src/kernel/routing/WifiZone.cpp
src/plugins/host_dvfs.cpp
src/plugins/link_load.cpp
src/s4u/s4u_Engine.cpp
src/s4u/s4u_Netzone.cpp
src/surf/HostImpl.hpp
src/surf/host_clm03.cpp
src/surf/network_cm02.cpp
src/surf/network_cm02.hpp
src/surf/network_constant.hpp
src/surf/network_ns3.hpp
src/surf/ptask_L07.cpp
src/surf/ptask_L07.hpp
teshsuite/surf/surf_usage/surf_usage.cpp
teshsuite/surf/surf_usage2/surf_usage2.cpp
tools/cmake/DefinePackages.cmake

index 7f28604..aa2f7fa 100644 (file)
@@ -2216,9 +2216,10 @@ include src/kernel/resource/CpuImpl.cpp
 include src/kernel/resource/CpuImpl.hpp
 include src/kernel/resource/DiskImpl.cpp
 include src/kernel/resource/DiskImpl.hpp
-include src/kernel/resource/LinkImpl.cpp
 include src/kernel/resource/LinkImpl.hpp
 include src/kernel/resource/Model.cpp
+include src/kernel/resource/NetworkModel.cpp
+include src/kernel/resource/NetworkModel.hpp
 include src/kernel/resource/NetworkModelIntf_test.cpp
 include src/kernel/resource/Resource.hpp
 include src/kernel/resource/SplitDuplexLinkImpl.cpp
index 047fd61..97563da 100644 (file)
@@ -77,6 +77,8 @@ class XBT_PUBLIC NetZoneImpl : public xbt::PropertyHolder {
 
   // our content, as known to our graph routing algorithm (maps vertex_id -> vertex)
   std::vector<kernel::routing::NetPoint*> vertices_;
+  // would like to use the one defined in the StandardLinkImpl file, but for some reason
+  // this hpp is exported to the users and so cannot include the other internal hpp.
   class LinkDeleter {
   public:
     void operator()(resource::StandardLinkImpl* link);
@@ -161,8 +163,23 @@ public:
   std::vector<s4u::Host*> get_all_hosts() const;
   size_t get_host_count() const;
 
+  /**
+   * @brief Recursively gets all links declared in this netzone
+   *
+   * Include children netzones.
+   * @return List of links
+   */
   std::vector<s4u::Link*> get_all_links() const;
+  /**
+   * @brief Recursively gets all links declared in this netzone.
+   *
+   * Using a filter function
+   * Include children netzones.
+   * @param filter Select links based on this filter
+   * @return List of links
+   */
   std::vector<s4u::Link*> get_filtered_links(const std::function<bool(s4u::Link*)>& filter) const;
+  /** @brief Get total number of links declared in this netzone (and its children) */
   size_t get_link_count() const;
 
   /**
index 87e1815..d20ae12 100644 (file)
@@ -107,8 +107,6 @@ protected:
   friend kernel::resource::StandardLinkImpl;
   void host_register(const std::string& name, Host* host);
   void host_unregister(const std::string& name);
-  void link_register(const std::string& name, const Link* link);
-  void link_unregister(const std::string& name);
   void netpoint_register(simgrid::kernel::routing::NetPoint* card);
   void netpoint_unregister(simgrid::kernel::routing::NetPoint* card);
   void set_netzone_root(const NetZone* netzone);
index d1a1a98..deaa01a 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "src/instr/instr_private.hpp"
 #include "src/kernel/resource/CpuImpl.hpp"
-#include "src/kernel/resource/StandardLinkImpl.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
 #include "src/surf/surf_interface.hpp"
 
 #include <fstream>
index 1e6483d..b73d706 100644 (file)
@@ -15,7 +15,7 @@
 #include "src/kernel/activity/MailboxImpl.hpp"
 #include "src/kernel/actor/SimcallObserver.hpp"
 #include "src/kernel/resource/CpuImpl.hpp"
-#include "src/kernel/resource/LinkImpl.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
 #include "src/kernel/resource/StandardLinkImpl.hpp"
 #include "src/mc/mc_replay.hpp"
 
index 1f07f85..0f2c36a 100644 (file)
@@ -6,95 +6,14 @@
 #ifndef SIMGRID_KERNEL_RESOURCE_LINKIMPL_HPP
 #define SIMGRID_KERNEL_RESOURCE_LINKIMPL_HPP
 
-#include "simgrid/kernel/resource/Model.hpp"
-#include "simgrid/kernel/resource/NetworkModelIntf.hpp"
 #include "simgrid/s4u/Link.hpp"
-#include "src/kernel/lmm/maxmin.hpp"
 #include "src/kernel/resource/Resource.hpp"
 #include "xbt/PropertyHolder.hpp"
 
-#include <list>
-#include <unordered_map>
-
-/***********
- * Classes *
- ***********/
-class StandardLinkImpl;
-
 namespace simgrid {
 namespace kernel {
 namespace resource {
 
-/*********
- * Model *
- *********/
-
-/** @ingroup SURF_network_interface
- * @brief SURF network model interface class
- * @details A model is an object which handles the interactions between its Resources and its Actions
- */
-class NetworkModel : public Model, public NetworkModelIntf {
-public:
-  static config::Flag<double> cfg_tcp_gamma;
-  static config::Flag<bool> cfg_crosstraffic;
-
-  using Model::Model;
-  NetworkModel(const NetworkModel&) = delete;
-  NetworkModel& operator=(const NetworkModel&) = delete;
-  ~NetworkModel() override;
-
-  /**
-   * @brief Create a [WiFi]Link
-   *
-   * @param name The name of the Link
-   * @param bandwidths The vector of bandwidths of the Link in bytes per second
-   */
-  virtual StandardLinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths) = 0;
-
-  virtual StandardLinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bandwidths) = 0;
-
-  /**
-   * @brief Create a communication between two hosts.
-   * @details It makes calls to the routing part, and execute the communication between the two end points.
-   *
-   * @param src The source of the communication
-   * @param dst The destination of the communication
-   * @param size The size of the communication in bytes
-   * @param rate Allows to limit the transfer rate. Negative value means unlimited.
-   * @return The action representing the communication
-   */
-  virtual Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) = 0;
-
-  /**
-   * @brief Get the right multiplicative factor for the latency.
-   * @details Depending on the model, the effective latency when sending a message might be different from the
-   * theoretical latency of the link, in function of the message size. In order to account for this, this function gets
-   * this factor.
-   *
-   * @param size The size of the message.
-   * @return The latency factor.
-   */
-  virtual double get_latency_factor(double /* size */) { return sg_latency_factor; }
-
-  /**
-   * @brief Get the right multiplicative factor for the bandwidth.
-   * @details Depending on the model, the effective bandwidth when sending a message might be different from the
-   * theoretical bandwidth of the link, in function of the message size. In order to account for this, this function
-   * gets this factor.
-   *
-   * @param size The size of the message.
-   * @return The bandwidth factor.
-   */
-  virtual double get_bandwidth_factor(double /* size*/) { return sg_bandwidth_factor; }
-
-  double next_occurring_event_full(double now) override;
-
-  void set_lat_factor_cb(const std::function<NetworkFactorCb>& cb) override { THROW_UNIMPLEMENTED; }
-  void set_bw_factor_cb(const std::function<NetworkFactorCb>& cb) override { THROW_UNIMPLEMENTED; }
-
-  StandardLinkImpl* loopback_ = nullptr;
-};
-
 /************
  * Resource *
  ************/
@@ -125,60 +44,6 @@ public:
   virtual void set_concurrency_limit(int limit) const = 0;
 };
 
-/**********
- * Action *
- **********/
-/** @ingroup SURF_network_interface
- * @brief SURF network action interface class
- * @details A NetworkAction represents a communication between two [hosts](@ref HostImpl)
- */
-class NetworkAction : public Action {
-  s4u::Host& src_;
-  s4u::Host& dst_;
-
-public:
-  /** @brief Constructor
-   *
-   * @param model The NetworkModel associated to this NetworkAction
-   * @param cost The cost of this  NetworkAction in [TODO]
-   * @param failed [description]
-   */
-  NetworkAction(Model* model, s4u::Host& src, s4u::Host& dst, double cost, bool failed)
-      : Action(model, cost, failed), src_(src), dst_(dst)
-  {
-  }
-
-  /**
-   * @brief NetworkAction constructor
-   *
-   * @param model The NetworkModel associated to this NetworkAction
-   * @param cost The cost of this  NetworkAction in bytes
-   * @param failed Actions can be created in a failed state
-   * @param var The lmm variable associated to this Action if it is part of a LMM component
-   */
-  NetworkAction(Model* model, s4u::Host& src, s4u::Host& dst, double cost, bool failed, lmm::Variable* var)
-      : Action(model, cost, failed, var), src_(src), dst_(dst){};
-
-  void set_state(Action::State state) override;
-  virtual std::list<StandardLinkImpl*> get_links() const;
-
-  double latency_         = 0.; // Delay before the action starts
-  double lat_current_     = 0.; // Used to compute the communication RTT, and accordingly limit the communication rate
-  double sharing_penalty_ = {};
-
-  s4u::Host& get_src() const { return src_; }
-  s4u::Host& get_dst() const { return dst_; }
-};
-
-/* Insert link(s) at the end of vector `result' (at the beginning, and reversed, for insert_link_latency()), and add
- * link->get_latency() to *latency when latency is not null
- */
-void add_link_latency(std::vector<StandardLinkImpl*>& result, StandardLinkImpl* link, double* latency);
-void add_link_latency(std::vector<StandardLinkImpl*>& result, const std::vector<StandardLinkImpl*>& links,
-                      double* latency);
-void insert_link_latency(std::vector<StandardLinkImpl*>& result, const std::vector<StandardLinkImpl*>& links,
-                         double* latency);
-
 } // namespace resource
 } // namespace kernel
 } // namespace simgrid
similarity index 97%
rename from src/kernel/resource/LinkImpl.cpp
rename to src/kernel/resource/NetworkModel.cpp
index 5369358..354489e 100644 (file)
@@ -6,8 +6,7 @@
 #include <simgrid/s4u/Engine.hpp>
 
 #include "simgrid/sg_config.hpp"
-#include "src/kernel/resource/LinkImpl.hpp"
-#include "src/kernel/resource/StandardLinkImpl.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
 #include "src/kernel/resource/profile/Profile.hpp"
 #include "src/surf/surf_interface.hpp"
 
diff --git a/src/kernel/resource/NetworkModel.hpp b/src/kernel/resource/NetworkModel.hpp
new file mode 100644 (file)
index 0000000..bfe6aa3
--- /dev/null
@@ -0,0 +1,147 @@
+/* Copyright (c) 2004-2022. The SimGrid Team. All rights reserved.          */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef SIMGRID_KERNEL_RESOURCE_NETWORKMODEL_HPP
+#define SIMGRID_KERNEL_RESOURCE_NETWORKMODEL_HPP
+
+#include "simgrid/kernel/resource/Model.hpp"
+#include "simgrid/kernel/resource/NetworkModelIntf.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
+
+#include <list>
+
+namespace simgrid {
+namespace kernel {
+namespace resource {
+
+/*********
+ * Model *
+ *********/
+
+/** @ingroup SURF_network_interface
+ * @brief SURF network model interface class
+ * @details A model is an object which handles the interactions between its Resources and its Actions
+ */
+class NetworkModel : public Model, public NetworkModelIntf {
+public:
+  static config::Flag<double> cfg_tcp_gamma;
+  static config::Flag<bool> cfg_crosstraffic;
+
+  using Model::Model;
+  NetworkModel(const NetworkModel&) = delete;
+  NetworkModel& operator=(const NetworkModel&) = delete;
+  ~NetworkModel() override;
+
+  /**
+   * @brief Create a [WiFi]Link
+   *
+   * @param name The name of the Link
+   * @param bandwidths The vector of bandwidths of the Link in bytes per second
+   */
+  virtual StandardLinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths) = 0;
+
+  virtual StandardLinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bandwidths) = 0;
+
+  /**
+   * @brief Create a communication between two hosts.
+   * @details It makes calls to the routing part, and execute the communication between the two end points.
+   *
+   * @param src The source of the communication
+   * @param dst The destination of the communication
+   * @param size The size of the communication in bytes
+   * @param rate Allows to limit the transfer rate. Negative value means unlimited.
+   * @return The action representing the communication
+   */
+  virtual Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) = 0;
+
+  /**
+   * @brief Get the right multiplicative factor for the latency.
+   * @details Depending on the model, the effective latency when sending a message might be different from the
+   * theoretical latency of the link, in function of the message size. In order to account for this, this function gets
+   * this factor.
+   *
+   * @param size The size of the message.
+   * @return The latency factor.
+   */
+  virtual double get_latency_factor(double /* size */) { return sg_latency_factor; }
+
+  /**
+   * @brief Get the right multiplicative factor for the bandwidth.
+   * @details Depending on the model, the effective bandwidth when sending a message might be different from the
+   * theoretical bandwidth of the link, in function of the message size. In order to account for this, this function
+   * gets this factor.
+   *
+   * @param size The size of the message.
+   * @return The bandwidth factor.
+   */
+  virtual double get_bandwidth_factor(double /* size*/) { return sg_bandwidth_factor; }
+
+  double next_occurring_event_full(double now) override;
+
+  void set_lat_factor_cb(const std::function<NetworkFactorCb>& cb) override { THROW_UNIMPLEMENTED; }
+  void set_bw_factor_cb(const std::function<NetworkFactorCb>& cb) override { THROW_UNIMPLEMENTED; }
+
+  std::unique_ptr<StandardLinkImpl, StandardLinkImpl::Deleter> loopback_;
+};
+
+/**********
+ * Action *
+ **********/
+/** @ingroup SURF_network_interface
+ * @brief SURF network action interface class
+ * @details A NetworkAction represents a communication between two [hosts](@ref HostImpl)
+ */
+class NetworkAction : public Action {
+  s4u::Host& src_;
+  s4u::Host& dst_;
+
+public:
+  /** @brief Constructor
+   *
+   * @param model The NetworkModel associated to this NetworkAction
+   * @param cost The cost of this  NetworkAction in [TODO]
+   * @param failed [description]
+   */
+  NetworkAction(Model* model, s4u::Host& src, s4u::Host& dst, double cost, bool failed)
+      : Action(model, cost, failed), src_(src), dst_(dst)
+  {
+  }
+
+  /**
+   * @brief NetworkAction constructor
+   *
+   * @param model The NetworkModel associated to this NetworkAction
+   * @param cost The cost of this  NetworkAction in bytes
+   * @param failed Actions can be created in a failed state
+   * @param var The lmm variable associated to this Action if it is part of a LMM component
+   */
+  NetworkAction(Model* model, s4u::Host& src, s4u::Host& dst, double cost, bool failed, lmm::Variable* var)
+      : Action(model, cost, failed, var), src_(src), dst_(dst){};
+
+  void set_state(Action::State state) override;
+  virtual std::list<StandardLinkImpl*> get_links() const;
+
+  double latency_         = 0.; // Delay before the action starts
+  double lat_current_     = 0.; // Used to compute the communication RTT, and accordingly limit the communication rate
+  double sharing_penalty_ = {};
+
+  s4u::Host& get_src() const { return src_; }
+  s4u::Host& get_dst() const { return dst_; }
+};
+
+/* Insert link(s) at the end of vector `result' (at the beginning, and reversed, for insert_link_latency()), and add
+ * link->get_latency() to *latency when latency is not null
+ */
+void add_link_latency(std::vector<StandardLinkImpl*>& result, StandardLinkImpl* link, double* latency);
+void add_link_latency(std::vector<StandardLinkImpl*>& result, const std::vector<StandardLinkImpl*>& links,
+                      double* latency);
+void insert_link_latency(std::vector<StandardLinkImpl*>& result, const std::vector<StandardLinkImpl*>& links,
+                         double* latency);
+
+} // namespace resource
+} // namespace kernel
+} // namespace simgrid
+
+#endif /* SIMGRID_KERNEL_RESOURCE_NETWORKMODEL_HPP */
index 8e04682..cf3dfbb 100644 (file)
@@ -24,10 +24,14 @@ StandardLinkImpl::StandardLinkImpl(const std::string& name) : LinkImpl(name), pi
   if (name != "__loopback__")
     xbt_assert(not s4u::Link::by_name_or_null(name), "Link '%s' declared several times in the platform.", name.c_str());
 
-  s4u::Engine::get_instance()->link_register(name, &piface_);
   XBT_DEBUG("Create link '%s'", name.c_str());
 }
 
+void StandardLinkImpl::Deleter::operator()(resource::StandardLinkImpl* link)
+{
+  link->destroy();
+}
+
 /** @brief Fire the required callbacks and destroy the object
  *
  * Don't delete directly a Link, call l->destroy() instead.
index f63b892..818df95 100644 (file)
@@ -34,6 +34,10 @@ protected:
 
 public:
   void destroy(); // Must be called instead of the destructor
+  class Deleter {
+  public:
+    void operator()(StandardLinkImpl* link);
+  };
 
   void latency_check(double latency) const;
 
index c46b5f3..e8d23ae 100644 (file)
@@ -7,7 +7,7 @@
 #include <simgrid/kernel/routing/NetPoint.hpp>
 #include <xbt/string.hpp>
 
-#include "src/kernel/resource/StandardLinkImpl.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
 
 #include <climits>
 #include <queue>
@@ -53,7 +53,7 @@ void DijkstraZone::do_seal()
 
       if (not found) {
         auto* route = new Route();
-        route->link_list_.push_back(get_network_model()->loopback_);
+        route->link_list_.push_back(get_network_model()->loopback_.get());
         xbt_graph_new_edge(route_graph_.get(), node, node, route);
       }
     }
index 8273672..de5aa58 100644 (file)
@@ -5,7 +5,7 @@
 
 #include "simgrid/kernel/routing/DragonflyZone.hpp"
 #include "simgrid/kernel/routing/NetPoint.hpp"
-#include "src/kernel/resource/StandardLinkImpl.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
 
 #include <boost/algorithm/string/classification.hpp>
 #include <boost/algorithm/string/split.hpp>
index 2183e2f..3c24baa 100644 (file)
@@ -6,7 +6,7 @@
 #include <simgrid/kernel/routing/FatTreeZone.hpp>
 #include <simgrid/kernel/routing/NetPoint.hpp>
 
-#include "src/kernel/resource/StandardLinkImpl.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
 #include "src/surf/xml/platf.hpp" // surf_parse_error() and surf_parse_assert()
 
 #include <fstream>
index 0fea4c0..867c140 100644 (file)
@@ -7,7 +7,7 @@
 #include <simgrid/kernel/routing/NetPoint.hpp>
 #include <xbt/string.hpp>
 
-#include "src/kernel/resource/StandardLinkImpl.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
 
 #include <climits>
 
@@ -135,7 +135,7 @@ void FloydZone::do_seal()
       auto& route = link_table_[i][i];
       if (not route) {
         route.reset(new Route());
-        route->link_list_.push_back(get_network_model()->loopback_);
+        route->link_list_.push_back(get_network_model()->loopback_.get());
         predecessor_table_[i][i] = i;
         cost_table_[i][i]        = 1;
       }
index c716b8f..8112081 100644 (file)
@@ -6,7 +6,7 @@
 #include <simgrid/kernel/routing/FullZone.hpp>
 #include <simgrid/kernel/routing/NetPoint.hpp>
 
-#include "src/kernel/resource/StandardLinkImpl.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ker_routing_full, ker_routing, "Kernel Full Routing");
 
@@ -35,7 +35,7 @@ void FullZone::do_seal()
       auto& route = routing_table_[i][i];
       if (not route) {
         route.reset(new Route());
-        route->link_list_.push_back(get_network_model()->loopback_);
+        route->link_list_.push_back(get_network_model()->loopback_.get());
       }
     }
   }
index 0df9d74..917f96b 100644 (file)
@@ -12,6 +12,7 @@
 #include "src/kernel/EngineImpl.hpp"
 #include "src/kernel/resource/CpuImpl.hpp"
 #include "src/kernel/resource/DiskImpl.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
 #include "src/kernel/resource/SplitDuplexLinkImpl.hpp"
 #include "src/kernel/resource/StandardLinkImpl.hpp"
 #include "src/surf/HostImpl.hpp"
index ddbbd50..489ecd9 100644 (file)
@@ -6,7 +6,7 @@
 #include "simgrid/kernel/routing/StarZone.hpp"
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/kernel/routing/RoutedZone.hpp"
-#include "src/kernel/resource/StandardLinkImpl.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
 #include "xbt/string.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ker_routing_star, ker_routing, "Kernel Star Routing");
index 4e19277..33454a5 100644 (file)
@@ -6,7 +6,7 @@
 #include "simgrid/kernel/routing/TorusZone.hpp"
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/s4u/Host.hpp"
-#include "src/kernel/resource/LinkImpl.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
 
 #include <boost/algorithm/string/classification.hpp>
 #include <boost/algorithm/string/split.hpp>
index e193b8b..a9b941c 100644 (file)
@@ -6,7 +6,7 @@
 #include <simgrid/kernel/routing/NetPoint.hpp>
 #include <simgrid/kernel/routing/WifiZone.hpp>
 
-#include "src/kernel/resource/StandardLinkImpl.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ker_routing_wifi, ker_routing, "Kernel Wifi Routing");
 
index db1af09..c6cf779 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "src/internal_config.h" // HAVE_SMPI
 #include "src/kernel/activity/CommImpl.hpp"
-#include "src/kernel/resource/StandardLinkImpl.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
 #if HAVE_SMPI
 #include "src/smpi/include/smpi_request.hpp"
 #include "src/smpi/plugins/ampi/ampi.hpp"
index d29e708..f6089c9 100644 (file)
@@ -7,7 +7,7 @@
 #include <simgrid/s4u/Engine.hpp>
 
 #include "src/kernel/activity/CommImpl.hpp"
-#include "src/kernel/resource/StandardLinkImpl.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
 
 #include <limits>
 
index ef3c17e..74d9f86 100644 (file)
@@ -15,6 +15,7 @@
 #include "mc/mc.h"
 #include "src/instr/instr_private.hpp"
 #include "src/kernel/EngineImpl.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
 #include "src/kernel/resource/SplitDuplexLinkImpl.hpp"
 #include "src/kernel/resource/StandardLinkImpl.hpp"
 #include "src/mc/mc_replay.hpp"
@@ -279,16 +280,6 @@ Mailbox* Engine::mailbox_by_name_or_create(const std::string& name) const
   return mbox->get_iface();
 }
 
-void Engine::link_register(const std::string& name, const Link* link)
-{
-  //  pimpl->links_[name] = link->get_impl(); //FIXME
-}
-
-void Engine::link_unregister(const std::string& name)
-{
-  //  pimpl->links_.erase(name); FIXME
-}
-
 /** @brief Returns the amount of links in the platform */
 size_t Engine::get_link_count() const
 {
index 699116c..8f01821 100644 (file)
@@ -12,8 +12,7 @@
 #include <simgrid/zone.h>
 #include <xbt/parse_units.hpp>
 
-#include "src/kernel/resource/LinkImpl.hpp"
-#include "src/kernel/resource/StandardLinkImpl.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
 
 namespace simgrid {
 namespace s4u {
index e9a291c..c5de6ec 100644 (file)
@@ -9,7 +9,6 @@
 #include "src/kernel/actor/ActorImpl.hpp"
 #include "src/kernel/resource/CpuImpl.hpp"
 #include "src/kernel/resource/DiskImpl.hpp"
-#include "src/kernel/resource/LinkImpl.hpp"
 #include <xbt/PropertyHolder.hpp>
 
 #include <vector>
index d7353cf..87e1ec3 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "simgrid/sg_config.hpp"
 #include "src/kernel/EngineImpl.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
 #include "src/surf/host_clm03.hpp"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(res_host);
index 2da2664..e981df7 100644 (file)
@@ -97,7 +97,7 @@ NetworkCm02Model::NetworkCm02Model(const std::string& name) : NetworkModel(name)
 
   set_maxmin_system(lmm::System::build(cfg_network_solver, select));
 
-  loopback_ = create_link("__loopback__", {config::get_value<double>("network/loopback-bw")});
+  loopback_.reset(create_link("__loopback__", {config::get_value<double>("network/loopback-bw")}));
   loopback_->set_sharing_policy(s4u::Link::SharingPolicy::FATPIPE, {});
   loopback_->set_latency(config::get_value<double>("network/loopback-lat"));
   loopback_->get_iface()->seal();
index 8cabad5..eb93747 100644 (file)
@@ -8,8 +8,7 @@
 
 #include <xbt/base.h>
 
-#include "simgrid/kernel/resource/NetworkModelIntf.hpp"
-#include "src/kernel/resource/LinkImpl.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
 #include "src/kernel/resource/StandardLinkImpl.hpp"
 #include "xbt/graph.h"
 #include "xbt/string.hpp"
index 2a8c70f..5828d69 100644 (file)
@@ -6,7 +6,7 @@
 #ifndef NETWORK_CONSTANT_HPP_
 #define NETWORK_CONSTANT_HPP_
 
-#include "src/kernel/resource/LinkImpl.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
 
 namespace simgrid {
 namespace kernel {
index 02036a3..275d45d 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "xbt/base.h"
 
+#include "src/kernel/resource/NetworkModel.hpp"
 #include "src/kernel/resource/StandardLinkImpl.hpp"
 
 namespace simgrid {
index a7030b9..e89e762 100644 (file)
@@ -76,10 +76,10 @@ NetworkL07Model::NetworkL07Model(const std::string& name, HostL07Model* hmodel,
     : NetworkModel(name), hostModel_(hmodel)
 {
   set_maxmin_system(sys);
-  loopback_ = create_link("__loopback__", {simgrid::config::get_value<double>("network/loopback-bw")});
+  loopback_.reset(create_link("__loopback__", {simgrid::config::get_value<double>("network/loopback-bw")}));
   loopback_->set_sharing_policy(s4u::Link::SharingPolicy::FATPIPE, {});
   loopback_->set_latency(simgrid::config::get_value<double>("network/loopback-lat"));
-  loopback_->seal();
+  loopback_->get_iface()->seal();
 }
 
 NetworkL07Model::~NetworkL07Model()
index fa57e85..9c0cbf2 100644 (file)
@@ -3,6 +3,7 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include "src/kernel/resource/NetworkModel.hpp"
 #include "src/surf/HostImpl.hpp"
 #include <cstdlib>
 #include <vector>
index b241ca6..ff7c14a 100644 (file)
@@ -11,7 +11,7 @@
 #include "simgrid/zone.h"
 #include "src/kernel/EngineImpl.hpp"
 #include "src/kernel/resource/CpuImpl.hpp"
-#include "src/kernel/resource/LinkImpl.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
 #include "xbt/config.hpp"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, "Messages specific for surf example");
index 4354c4a..1af5762 100644 (file)
@@ -11,7 +11,7 @@
 #include "simgrid/zone.h"
 #include "src/kernel/EngineImpl.hpp"
 #include "src/kernel/resource/CpuImpl.hpp"
-#include "src/kernel/resource/LinkImpl.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
 #include "src/surf/surf_interface.hpp"
 #include "xbt/config.hpp"
 
index 1332be4..b1f7bf7 100644 (file)
@@ -14,6 +14,7 @@ set(EXTRA_DIST
   src/include/xxhash.hpp
   src/kernel/actor/Simcall.hpp
   src/kernel/resource/LinkImpl.hpp
+  src/kernel/resource/NetworkModel.hpp
   src/kernel/resource/SplitDuplexLinkImpl.hpp
   src/kernel/resource/StandardLinkImpl.hpp
   src/kernel/resource/WifiLinkImpl.hpp
@@ -305,8 +306,8 @@ set(SURF_SRC
   src/kernel/resource/DiskImpl.cpp
   src/kernel/resource/DiskImpl.hpp
   src/kernel/resource/Model.cpp
+  src/kernel/resource/NetworkModel.cpp
   src/kernel/resource/Resource.hpp
-  src/kernel/resource/LinkImpl.cpp
   src/kernel/resource/SplitDuplexLinkImpl.cpp
   src/kernel/resource/StandardLinkImpl.cpp
   src/kernel/resource/VirtualMachineImpl.hpp