Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rename surf::Link into surf::LinkImpl to make room for s4u
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 6 Feb 2017 23:16:24 +0000 (00:16 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 6 Feb 2017 23:21:14 +0000 (00:21 +0100)
19 files changed:
include/simgrid/forward.h
src/kernel/routing/DragonflyZone.hpp
src/kernel/routing/NetZoneImpl.cpp
src/kernel/routing/NetZoneImpl.hpp
src/surf/instr_routing.cpp
src/surf/network_cm02.cpp
src/surf/network_cm02.hpp
src/surf/network_constant.cpp
src/surf/network_constant.hpp
src/surf/network_interface.cpp
src/surf/network_interface.hpp
src/surf/network_ns3.cpp
src/surf/network_ns3.hpp
src/surf/network_smpi.cpp
src/surf/network_smpi.hpp
src/surf/ptask_L07.cpp
src/surf/ptask_L07.hpp
src/surf/sg_platf.cpp
src/surf/xml/surfxml_sax_cb.cpp

index 3459fd6..5676f8a 100644 (file)
@@ -31,7 +31,7 @@ namespace simgrid {
   namespace surf {
     class Resource;
     class Cpu;
-    class Link;
+    class LinkImpl;
     class HostImpl;
   }
   namespace trace_mgr {
@@ -45,7 +45,7 @@ typedef simgrid::s4u::Host simgrid_Host;
 typedef simgrid::kernel::activity::ActivityImpl kernel_Activity;
 typedef simgrid::kernel::routing::NetPoint routing_NetPoint;
 typedef simgrid::surf::Cpu surf_Cpu;
-typedef simgrid::surf::Link Link;
+typedef simgrid::surf::LinkImpl Link;
 typedef simgrid::surf::Resource surf_Resource;
 typedef simgrid::trace_mgr::trace tmgr_Trace;
 
index bb3117d..01b07dc 100644 (file)
@@ -17,10 +17,10 @@ public:
   unsigned int group_;
   unsigned int chassis_;
   unsigned int blade_;
-  surf::Link** blueLinks_  = nullptr;
-  surf::Link** blackLinks_ = nullptr;
-  surf::Link** greenLinks_ = nullptr;
-  surf::Link** myNodes_    = nullptr;
+  surf::LinkImpl** blueLinks_  = nullptr;
+  surf::LinkImpl** blackLinks_ = nullptr;
+  surf::LinkImpl** greenLinks_ = nullptr;
+  surf::LinkImpl** myNodes_    = nullptr;
   DragonflyRouter(int i, int j, int k);
   ~DragonflyRouter();
 };
index a2cd1a8..a5175cc 100644 (file)
@@ -202,7 +202,7 @@ static void find_common_ancestors(NetPoint* src, NetPoint* dst,
 
 /* PRECONDITION: this is the common ancestor of src and dst */
 bool NetZoneImpl::getBypassRoute(routing::NetPoint* src, routing::NetPoint* dst,
-                                 /* OUT */ std::vector<surf::Link*>* links, double* latency)
+                                 /* OUT */ std::vector<surf::LinkImpl*>* links, double* latency)
 {
   // If never set a bypass route return nullptr without any further computations
   if (bypassRoutes_.empty())
@@ -212,7 +212,7 @@ bool NetZoneImpl::getBypassRoute(routing::NetPoint* src, routing::NetPoint* dst,
   if (dst->netzone() == this && src->netzone() == this) {
     if (bypassRoutes_.find({src, dst}) != bypassRoutes_.end()) {
       BypassRoute* bypassedRoute = bypassRoutes_.at({src, dst});
-      for (surf::Link* link : bypassedRoute->links) {
+      for (surf::LinkImpl* link : bypassedRoute->links) {
         links->push_back(link);
         if (latency)
           *latency += link->latency();
@@ -293,7 +293,7 @@ bool NetZoneImpl::getBypassRoute(routing::NetPoint* src, routing::NetPoint* dst,
               src->cname(), dst->cname(), bypassedRoute->links.size());
     if (src != key.first)
       getGlobalRoute(src, const_cast<NetPoint*>(bypassedRoute->gw_src), links, latency);
-    for (surf::Link* link : bypassedRoute->links) {
+    for (surf::LinkImpl* link : bypassedRoute->links) {
       links->push_back(link);
       if (latency)
         *latency += link->latency();
@@ -307,7 +307,7 @@ bool NetZoneImpl::getBypassRoute(routing::NetPoint* src, routing::NetPoint* dst,
 }
 
 void NetZoneImpl::getGlobalRoute(routing::NetPoint* src, routing::NetPoint* dst,
-                                 /* OUT */ std::vector<surf::Link*>* links, double* latency)
+                                 /* OUT */ std::vector<surf::LinkImpl*>* links, double* latency)
 {
   s_sg_platf_route_cbarg_t route;
   memset(&route, 0, sizeof(route));
@@ -333,7 +333,7 @@ void NetZoneImpl::getGlobalRoute(routing::NetPoint* src, routing::NetPoint* dst,
 
   /* Not in the same netzone, no bypass. We'll have to find our path between the netzones recursively */
 
-  route.link_list = new std::vector<surf::Link*>();
+  route.link_list = new std::vector<surf::LinkImpl*>();
 
   common_ancestor->getLocalRoute(src_ancestor->netpoint_, dst_ancestor->netpoint_, &route, latency);
   xbt_assert((route.gw_src != nullptr) && (route.gw_dst != nullptr), "bad gateways for route from \"%s\" to \"%s\"",
index 75636ad..fe97e73 100644 (file)
@@ -76,7 +76,7 @@ protected:
   /** @brief retrieves the list of all routes of size 1 (of type src x dst x Link) */
   /* returns whether we found a bypass path */
   bool getBypassRoute(routing::NetPoint * src, routing::NetPoint * dst,
-                      /* OUT */ std::vector<surf::Link*> * links, double* latency);
+                      /* OUT */ std::vector<surf::LinkImpl*> * links, double* latency);
 
 public:
   /* @brief get the route between two nodes in the full platform
@@ -87,7 +87,7 @@ public:
    * @param latency Accumulator in which the latencies should be added (caller must set it to 0)
    */
   static void getGlobalRoute(routing::NetPoint * src, routing::NetPoint * dst,
-                             /* OUT */ std::vector<surf::Link*> * links, double* latency);
+                             /* OUT */ std::vector<surf::LinkImpl*> * links, double* latency);
 
   virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) = 0;
   enum class RoutingMode {
index e443fe6..f9ebbc6 100644 (file)
@@ -206,7 +206,7 @@ void sg_instr_AS_end()
   }
 }
 
-static void instr_routing_parse_start_link(simgrid::surf::Link* link)
+static void instr_routing_parse_start_link(simgrid::surf::LinkImpl* link)
 {
   if (currentContainer.empty()) // No ongoing parsing. Are you creating the loopback?
     return;
@@ -324,7 +324,7 @@ void instr_routing_define_callbacks ()
   //always need the call backs to ASes (we need only the root AS),
   //to create the rootContainer and the rootType properly
   if (!TRACE_needs_platform()) return;
-  simgrid::surf::Link::onCreation.connect(instr_routing_parse_start_link);
+  simgrid::surf::LinkImpl::onCreation.connect(instr_routing_parse_start_link);
   simgrid::s4u::onPlatformCreated.connect(instr_routing_parse_end_platform);
 }
 
index b84aa90..72a7965 100644 (file)
@@ -170,8 +170,8 @@ NetworkCm02Model::NetworkCm02Model(void (*specificSolveFun)(lmm_system_t self))
 
 NetworkCm02Model::~NetworkCm02Model() {}
 
-Link* NetworkCm02Model::createLink(const char* name, double bandwidth, double latency,
-                                   e_surf_link_sharing_policy_t policy)
+LinkImpl* NetworkCm02Model::createLink(const char* name, double bandwidth, double latency,
+                                       e_surf_link_sharing_policy_t policy)
 {
   return new NetworkCm02Link(this, name, bandwidth, latency, policy, maxminSystem_);
 }
@@ -289,10 +289,10 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
   int failed = 0;
   double bandwidth_bound;
   double latency = 0.0;
-  std::vector<Link*> * back_route = nullptr;
+  std::vector<LinkImpl*>* back_route = nullptr;
   int constraints_per_variable = 0;
 
-  std::vector<Link*> *route = new std::vector<Link*>();
+  std::vector<LinkImpl*>* route = new std::vector<LinkImpl*>();
 
   XBT_IN("(%s,%s,%g,%g)", src->cname(), dst->cname(), size, rate);
 
@@ -306,7 +306,7 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
       failed = 1;
 
   if (sg_network_crosstraffic == 1) {
-    back_route = new std::vector<Link*>();
+    back_route = new std::vector<LinkImpl*>();
     dst->routeTo(src, back_route, nullptr);
     for (auto link: *back_route)
       if (link->isOff())
@@ -381,13 +381,12 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
   delete back_route;
   XBT_OUT();
 
-  Link::onCommunicate(action, src, dst);
+  LinkImpl::onCommunicate(action, src, dst);
   return action;
 }
 
-void NetworkCm02Model::gapAppend(double size, const Link* link, NetworkAction* action)
-{
-  // Nothing
+void NetworkCm02Model::gapAppend(double size, const LinkImpl* link, NetworkAction* action){
+    // Nothing
 };
 
 /************
@@ -395,7 +394,7 @@ void NetworkCm02Model::gapAppend(double size, const Link* link, NetworkAction* a
  ************/
 NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const char* name, double bandwidth, double latency,
                                  e_surf_link_sharing_policy_t policy, lmm_system_t system)
-    : Link(model, name, lmm_constraint_new(system, this, sg_bandwidth_factor * bandwidth))
+    : LinkImpl(model, name, lmm_constraint_new(system, this, sg_bandwidth_factor * bandwidth))
 {
   bandwidth_.scale = 1.0;
   bandwidth_.peak  = bandwidth;
@@ -406,7 +405,7 @@ NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const char* name, doub
   if (policy == SURF_LINK_FATPIPE)
     lmm_constraint_shared(getConstraint());
 
-  Link::onCreation(this);
+  LinkImpl::onCreation(this);
 }
 
 
@@ -550,10 +549,8 @@ void NetworkCm02Action::updateRemainingLazy(double now)
   lastValue_ = lmm_variable_getvalue(getVariable());
 }
 
-void NetworkCm02Link::gapAppend(double size, const Link* link, NetworkAction* action)
-{
-  // Nothing
+void NetworkCm02Link::gapAppend(double size, const LinkImpl* link, NetworkAction* action){
+    // Nothing
 };
-
 }
 }
index e231d3a..e53c1c8 100644 (file)
@@ -41,12 +41,13 @@ namespace simgrid {
       NetworkCm02Model();
       explicit NetworkCm02Model(void (*solve_fun)(lmm_system_t self));
       virtual ~NetworkCm02Model();
-      Link* createLink(const char* name, double bandwidth, double latency,
-                       e_surf_link_sharing_policy_t policy) override;
+      LinkImpl* createLink(const char* name, double bandwidth, double latency,
+                           e_surf_link_sharing_policy_t policy) override;
       void updateActionsStateLazy(double now, double delta) override;
       void updateActionsStateFull(double now, double delta) override;
       Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
-      virtual void gapAppend(double size, const Link* link, NetworkAction* action);
+      virtual void gapAppend(double size, const LinkImpl* link, NetworkAction* action);
+
     protected:
       bool haveGap_ = false;
     };
@@ -55,7 +56,7 @@ namespace simgrid {
      * Resource *
      ************/
 
-    class NetworkCm02Link : public Link {
+    class NetworkCm02Link : public LinkImpl {
     public:
       NetworkCm02Link(NetworkCm02Model* model, const char* name, double bandwidth, double latency,
                       e_surf_link_sharing_policy_t policy, lmm_system_t system);
@@ -63,7 +64,7 @@ namespace simgrid {
       void apply_event(tmgr_trace_iterator_t event, double value) override;
       void setBandwidth(double value) override;
       void setLatency(double value) override;
-      virtual void gapAppend(double size, const Link* link, NetworkAction* action);
+      virtual void gapAppend(double size, const LinkImpl* link, NetworkAction* action);
     };
 
 
index 1310bf6..7dc5c25 100644 (file)
@@ -20,7 +20,8 @@ void surf_network_model_init_Constant()
 
 namespace simgrid {
   namespace surf {
-  Link* NetworkConstantModel::createLink(const char* name, double bw, double lat, e_surf_link_sharing_policy_t policy)
+  LinkImpl* NetworkConstantModel::createLink(const char* name, double bw, double lat,
+                                             e_surf_link_sharing_policy_t policy)
   {
 
     xbt_die("Refusing to create the link %s: there is no link in the Constant network model. "
@@ -77,7 +78,7 @@ namespace simgrid {
     {
       NetworkConstantAction *action = new NetworkConstantAction(this, size, sg_latency_factor);
 
-      Link::onCommunicate(action, src, dst);
+      LinkImpl::onCommunicate(action, src, dst);
       return action;
     }
 
index ffb1659..61e36a5 100644 (file)
@@ -30,7 +30,7 @@ namespace simgrid {
       double nextOccuringEvent(double now) override;
       void updateActionsState(double now, double delta) override;
 
-      Link* createLink(const char* name, double bw, double lat, e_surf_link_sharing_policy_t policy) override;
+      LinkImpl* createLink(const char* name, double bw, double lat, e_surf_link_sharing_policy_t policy) override;
     };
 
     /**********
index 5a2e56d..efaeacc 100644 (file)
@@ -61,19 +61,22 @@ extern "C" {
 namespace simgrid {
   namespace surf {
 
-    std::unordered_map<std::string,Link *> *Link::links = new std::unordered_map<std::string,Link *>();
-    Link *Link::byName(const char* name) {
-      if (links->find(name) == links->end())
-        return nullptr;
-      return  links->at(name);
+  std::unordered_map<std::string, LinkImpl*>* LinkImpl::links = new std::unordered_map<std::string, LinkImpl*>();
+  LinkImpl* LinkImpl::byName(const char* name)
+  {
+    if (links->find(name) == links->end())
+      return nullptr;
+    return links->at(name);
     }
     /** @brief Returns the amount of links in the platform */
-    int Link::linksCount() {
+    int LinkImpl::linksCount()
+    {
       return links->size();
     }
     /** @brief Returns a list of all existing links */
-    Link **Link::linksList() {
-      Link **res = xbt_new(Link*, (int)links->size());
+    LinkImpl** LinkImpl::linksList()
+    {
+      LinkImpl** res = xbt_new(LinkImpl*, (int)links->size());
       int i=0;
       for (auto kv : *links) {
         res[i++] = kv.second;
@@ -81,7 +84,8 @@ namespace simgrid {
       return res;
     }
     /** @brief destructor of the static data */
-    void Link::linksExit() {
+    void LinkImpl::linksExit()
+    {
       for (auto kv : *links)
         (kv.second)->destroy();
       delete links;
@@ -91,12 +95,12 @@ namespace simgrid {
      * Callbacks *
      *************/
 
-    simgrid::xbt::signal<void(Link*)> Link::onCreation;
-    simgrid::xbt::signal<void(Link*)> Link::onDestruction;
-    simgrid::xbt::signal<void(Link*)> Link::onStateChange;
+    simgrid::xbt::signal<void(LinkImpl*)> LinkImpl::onCreation;
+    simgrid::xbt::signal<void(LinkImpl*)> LinkImpl::onDestruction;
+    simgrid::xbt::signal<void(LinkImpl*)> LinkImpl::onStateChange;
 
     simgrid::xbt::signal<void(NetworkAction*, Action::State, Action::State)> networkActionStateChangedCallbacks;
-    simgrid::xbt::signal<void(NetworkAction*, s4u::Host* src, s4u::Host* dst)> Link::onCommunicate;
+    simgrid::xbt::signal<void(NetworkAction*, s4u::Host* src, s4u::Host* dst)> LinkImpl::onCommunicate;
   }
 }
 
@@ -147,11 +151,11 @@ namespace simgrid {
      * Resource *
      ************/
 
-    Link::Link(simgrid::surf::NetworkModel* model, const char* name, lmm_constraint_t constraint)
+    LinkImpl::LinkImpl(simgrid::surf::NetworkModel* model, const char* name, lmm_constraint_t constraint)
         : Resource(model, name, constraint)
     {
       if (strcmp(name,"__loopback__"))
-        xbt_assert(!Link::byName(name), "Link '%s' declared several times in the platform.", name);
+        xbt_assert(!LinkImpl::byName(name), "Link '%s' declared several times in the platform.", name);
 
       latency_.scale   = 1;
       bandwidth_.scale = 1;
@@ -162,14 +166,15 @@ namespace simgrid {
     }
 
     /** @brief use destroy() instead of this destructor */
-    Link::~Link() {
+    LinkImpl::~LinkImpl()
+    {
       xbt_assert(currentlyDestroying_, "Don't delete Links directly. Call destroy() instead.");
     }
     /** @brief Fire the required callbacks and destroy the object
      *
      * Don't delete directly a Link, call l->destroy() instead.
      */
-    void Link::destroy()
+    void LinkImpl::destroy()
     {
       if (!currentlyDestroying_) {
         currentlyDestroying_ = true;
@@ -178,48 +183,51 @@ namespace simgrid {
       }
     }
 
-    bool Link::isUsed()
+    bool LinkImpl::isUsed()
     {
       return lmm_constraint_used(getModel()->getMaxminSystem(), getConstraint());
     }
 
-    double Link::latency()
+    double LinkImpl::latency()
     {
       return latency_.peak * latency_.scale;
     }
 
-    double Link::bandwidth()
+    double LinkImpl::bandwidth()
     {
       return bandwidth_.peak * bandwidth_.scale;
     }
 
-    int Link::sharingPolicy()
+    int LinkImpl::sharingPolicy()
     {
       return lmm_constraint_sharing_policy(getConstraint());
     }
 
-    void Link::turnOn(){
+    void LinkImpl::turnOn()
+    {
       if (isOff()) {
         Resource::turnOn();
         onStateChange(this);
       }
     }
-    void Link::turnOff(){
+    void LinkImpl::turnOff()
+    {
       if (isOn()) {
         Resource::turnOff();
         onStateChange(this);
       }
     }
-    void Link::setStateTrace(tmgr_trace_t trace) {
+    void LinkImpl::setStateTrace(tmgr_trace_t trace)
+    {
       xbt_assert(stateEvent_ == nullptr, "Cannot set a second state trace to Link %s", getName());
       stateEvent_ = future_evt_set->add_trace(trace, 0.0, this);
     }
-    void Link::setBandwidthTrace(tmgr_trace_t trace)
+    void LinkImpl::setBandwidthTrace(tmgr_trace_t trace)
     {
       xbt_assert(bandwidth_.event == nullptr, "Cannot set a second bandwidth trace to Link %s", getName());
       bandwidth_.event = future_evt_set->add_trace(trace, 0.0, this);
     }
-    void Link::setLatencyTrace(tmgr_trace_t trace)
+    void LinkImpl::setLatencyTrace(tmgr_trace_t trace)
     {
       xbt_assert(latency_.event == nullptr, "Cannot set a second latency trace to Link %s", getName());
       latency_.event = future_evt_set->add_trace(trace, 0.0, this);
index b94a0e0..1c86cfd 100644 (file)
@@ -31,9 +31,9 @@ namespace simgrid {
      *  Signature: `void(NetworkAction *action, simgrid::surf::Action::State old, simgrid::surf::Action::State current)` */
     XBT_PUBLIC_DATA(simgrid::xbt::signal<void(simgrid::surf::NetworkAction*, simgrid::surf::Action::State, simgrid::surf::Action::State)>) networkActionStateChangedCallbacks;
 
-/*********
- * Model *
- *********/
+    /*********
    * Model *
    *********/
 
     /** @ingroup SURF_network_interface
      * @brief SURF network model interface class
@@ -55,8 +55,8 @@ namespace simgrid {
        * @param latency The initial latency of the Link in seconds
        * @param policy The sharing policy of the Link
        */
-      virtual Link* createLink(const char* name, double bandwidth, double latency,
-                               e_surf_link_sharing_policy_t policy) = 0;
+      virtual LinkImpl* createLink(const char* name, double bandwidth, double latency,
+                                   e_surf_link_sharing_policy_t policy) = 0;
 
       /**
        * @brief Create a communication between two hosts.
@@ -114,7 +114,7 @@ namespace simgrid {
       virtual double bandwidthConstraint(double rate, double bound, double size);
       double nextOccuringEventFull(double now) override;
 
-      Link* loopback_ = nullptr;
+      LinkImpl* loopback_ = nullptr;
     };
 
     /************
@@ -124,38 +124,31 @@ namespace simgrid {
      * @brief SURF network link interface class
      * @details A Link represents the link between two [hosts](\ref simgrid::surf::HostImpl)
      */
-    class Link :
-        public simgrid::surf::Resource,
-        public simgrid::surf::PropertyHolder {
-        public:
-
+    class LinkImpl : public simgrid::surf::Resource, public simgrid::surf::PropertyHolder {
+    public:
       /** @brief Constructor of LMM links */
-          Link(simgrid::surf::NetworkModel* model, const char* name, lmm_constraint_t constraint);
+      LinkImpl(simgrid::surf::NetworkModel* model, const char* name, lmm_constraint_t constraint);
 
-          /* Link destruction logic */
-          /**************************/
-        protected:
-      ~Link() override;
-        public:
+      /* Link destruction logic */
+      /**************************/
+    protected:
+      ~LinkImpl() override;
+    public:
       void destroy(); // Must be called instead of the destructor
-        private:
+    private:
       bool currentlyDestroying_ = false;
 
-        public:
-      /** @brief Callback signal fired when a new Link is created.
-       *  Signature: void(Link*) */
-      static simgrid::xbt::signal<void(surf::Link*)> onCreation;
+    public:
+      /** @brief Callback signal fired when a new Link is created */
+      static simgrid::xbt::signal<void(surf::LinkImpl*)> onCreation;
 
-      /** @brief Callback signal fired when a Link is destroyed.
-       *  Signature: void(Link*) */
-      static simgrid::xbt::signal<void(surf::Link*)> onDestruction;
+      /** @brief Callback signal fired when a Link is destroyed */
+      static simgrid::xbt::signal<void(surf::LinkImpl*)> onDestruction;
 
-      /** @brief Callback signal fired when the state of a Link changes (when it is turned on or off)
-       *  Signature: `void(Link*)` */
-      static simgrid::xbt::signal<void(surf::Link*)> onStateChange;
+      /** @brief Callback signal fired when the state of a Link changes (when it is turned on or off) */
+      static simgrid::xbt::signal<void(surf::LinkImpl*)> onStateChange;
 
-      /** @brief Callback signal fired when a communication starts
-       *  Signature: `void(NetworkAction *action, host *src, host *dst)` */
+      /** @brief Callback signal fired when a communication starts */
       static simgrid::xbt::signal<void(surf::NetworkAction*, s4u::Host* src, s4u::Host* dst)> onCommunicate;
 
       /** @brief Get the bandwidth in bytes per second of current Link */
@@ -170,7 +163,8 @@ namespace simgrid {
       /** @brief Update the latency in seconds of current Link */
       virtual void setLatency(double value) = 0;
 
-      /** @brief The sharing policy is a @{link e_surf_link_sharing_policy_t::EType} (0: FATPIPE, 1: SHARED, 2: FULLDUPLEX) */
+      /** @brief The sharing policy is a @{link e_surf_link_sharing_policy_t::EType} (0: FATPIPE, 1: SHARED, 2:
+       * FULLDUPLEX) */
       virtual int sharingPolicy();
 
       /** @brief Check if the Link is used */
@@ -179,28 +173,32 @@ namespace simgrid {
       void turnOn() override;
       void turnOff() override;
 
-      virtual void setStateTrace(tmgr_trace_t trace); /*< setup the trace file with states events (ON or OFF). Trace must contain boolean values. */
-      virtual void setBandwidthTrace(tmgr_trace_t trace); /*< setup the trace file with bandwidth events (peak speed changes due to external load). Trace must contain percentages (value between 0 and 1). */
-      virtual void setLatencyTrace(tmgr_trace_t trace); /*< setup the trace file with latency events (peak latency changes due to external load). Trace must contain absolute values */
+      virtual void setStateTrace(tmgr_trace_t trace); /*< setup the trace file with states events (ON or OFF).
+                                                          Trace must contain boolean values. */
+      virtual void setBandwidthTrace(tmgr_trace_t trace); /*< setup the trace file with bandwidth events (peak speed changes due to external load).
+                                                              Trace must contain percentages (value between 0 and 1). */
+      virtual void setLatencyTrace(tmgr_trace_t trace); /*< setup the trace file with latency events (peak latency changes due to external load).
+                                                            Trace must contain absolute values */
 
       tmgr_trace_iterator_t stateEvent_ = nullptr;
       s_surf_metric_t latency_          = {1.0, 0, nullptr};
       s_surf_metric_t bandwidth_        = {1.0, 0, nullptr};
 
       /* User data */
-        public:
+    public:
       void *getData()        { return userData;}
       void  setData(void *d) { userData=d;}
-        private:
+    private:
       void *userData = nullptr;
 
       /* List of all links. FIXME: should move to the Engine */
-        private:
-      static std::unordered_map<std::string, Link *> *links;
-        public:
-      static Link *byName(const char* name);
+    private:
+      static std::unordered_map<std::string, LinkImpl*>* links;
+
+    public:
+      static LinkImpl* byName(const char* name);
       static int linksCount();
-      static Link **linksList();
+      static LinkImpl** linksList();
       static void linksExit();
     };
 
index 4de446c..279db86 100644 (file)
@@ -172,8 +172,8 @@ NetworkNS3Model::~NetworkNS3Model() {
   xbt_dict_free(&flowFromSock);
 }
 
-Link* NetworkNS3Model::createLink(const char* name, double bandwidth, double latency,
-                                  e_surf_link_sharing_policy_t policy)
+LinkImpl* NetworkNS3Model::createLink(const char* name, double bandwidth, double latency,
+                                      e_surf_link_sharing_policy_t policy)
 {
   return new LinkNS3(this, name, bandwidth, latency);
 }
@@ -230,7 +230,7 @@ void NetworkNS3Model::updateActionsState(double now, double delta)
         action->getState() == Action::State::running){
       double data_delta_sent = sgFlow->sentBytes_ - action->lastSent_;
 
-      std::vector<Link*> route = std::vector<Link*>();
+      std::vector<LinkImpl*> route = std::vector<LinkImpl*>();
 
       action->src_->routeTo(action->dst_, &route, nullptr);
       for (auto link : route)
@@ -263,12 +263,12 @@ void NetworkNS3Model::updateActionsState(double now, double delta)
  ************/
 
 LinkNS3::LinkNS3(NetworkNS3Model* model, const char* name, double bandwidth, double latency)
-    : Link(model, name, nullptr)
+    : LinkImpl(model, name, nullptr)
 {
   bandwidth_.peak = bandwidth;
   latency_.peak   = latency;
 
-  Link::onCreation(this);
+  LinkImpl::onCreation(this);
 }
 
 LinkNS3::~LinkNS3() = default;
@@ -297,7 +297,7 @@ NetworkNS3Action::NetworkNS3Action(Model* model, double size, s4u::Host* src, s4
   dst_ = dst;
   ns3_create_flow(src, dst, surf_get_clock(), size, this);
 
-  Link::onCommunicate(this, src, dst);
+  LinkImpl::onCommunicate(this, src, dst);
 }
 
 void NetworkNS3Action::suspend() {
index b1162b3..be32134 100644 (file)
@@ -19,7 +19,8 @@ class NetworkNS3Model : public NetworkModel {
 public:
   NetworkNS3Model();
   ~NetworkNS3Model();
-  Link* createLink(const char* name, double bandwidth, double latency, e_surf_link_sharing_policy_t policy) override;
+  LinkImpl* createLink(const char* name, double bandwidth, double latency,
+                       e_surf_link_sharing_policy_t policy) override;
   Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
   double nextOccuringEvent(double now) override;
   bool nextOccuringEventIsIdempotent() {return false;}
@@ -29,7 +30,7 @@ public:
 /************
  * Resource *
  ************/
-class LinkNS3 : public Link {
+class LinkNS3 : public LinkImpl {
 public:
   explicit LinkNS3(NetworkNS3Model* model, const char* name, double bandwidth, double latency);
   ~LinkNS3();
index e885af8..e79e6cc 100644 (file)
@@ -59,7 +59,7 @@ namespace simgrid {
       xbt_dict_free(&gap_lookup);
     }
 
-    void NetworkSmpiModel::gapAppend(double size, Link* link, NetworkAction *act)
+    void NetworkSmpiModel::gapAppend(double size, LinkImpl* link, NetworkAction* act)
     {
       const char *src = link->getName();
       xbt_fifo_t fifo;
index ce6105d..447ab48 100644 (file)
@@ -17,7 +17,7 @@ namespace simgrid {
       ~NetworkSmpiModel();
 
       using NetworkCm02Model::gapAppend; // Explicit about overloaded method (silence Woverloaded-virtual from clang)
-      void gapAppend(double size, Link* link, NetworkAction *action);
+      void gapAppend(double size, LinkImpl* link, NetworkAction* action);
       void gapRemove(Action *action);
       double latencyFactor(double size);
       double bandwidthFactor(double size);
index 60b919c..aff790d 100644 (file)
@@ -173,7 +173,7 @@ L07Action::L07Action(Model *model, int host_nb, sg_host_t *host_list,
         if (bytes_amount[i * host_nb + j] > 0) {
           double lat=0.0;
 
-          std::vector<Link*> route;
+          std::vector<LinkImpl*> route;
           hostList_->at(i)->routeTo(hostList_->at(j), &route, &lat);
           latency = MAX(latency, lat);
 
@@ -211,7 +211,7 @@ L07Action::L07Action(Model *model, int host_nb, sg_host_t *host_list,
         if (bytes_amount[i * host_nb + j] == 0.0)
           continue;
 
-        std::vector<Link*> route;
+        std::vector<LinkImpl*> route;
         hostList_->at(i)->routeTo(hostList_->at(j), &route, nullptr);
 
         for (auto link : route)
@@ -245,8 +245,8 @@ Cpu *CpuL07Model::createCpu(simgrid::s4u::Host *host,  std::vector<double> *spee
   return new CpuL07(this, host, speedPerPstate, core);
 }
 
-Link* NetworkL07Model::createLink(const char* name, double bandwidth, double latency,
-                                  e_surf_link_sharing_policy_t policy)
+LinkImpl* NetworkL07Model::createLink(const char* name, double bandwidth, double latency,
+                                      e_surf_link_sharing_policy_t policy)
 {
   return new LinkL07(this, name, bandwidth, latency, policy);
 }
@@ -265,7 +265,7 @@ CpuL07::~CpuL07()=default;
 
 LinkL07::LinkL07(NetworkL07Model* model, const char* name, double bandwidth, double latency,
                  e_surf_link_sharing_policy_t policy)
-    : Link(model, name, lmm_constraint_new(model->getMaxminSystem(), this, bandwidth))
+    : LinkImpl(model, name, lmm_constraint_new(model->getMaxminSystem(), this, bandwidth))
 {
   bandwidth_.peak = bandwidth;
   latency_.peak   = latency;
@@ -273,7 +273,7 @@ LinkL07::LinkL07(NetworkL07Model* model, const char* name, double bandwidth, dou
   if (policy == SURF_LINK_FATPIPE)
     lmm_constraint_shared(getConstraint());
 
-  Link::onCreation(this);
+  LinkImpl::onCreation(this);
 }
 
 Action *CpuL07::execution_start(double size)
@@ -405,7 +405,7 @@ void L07Action::updateBound()
 
         if (communicationAmount_[i * hostNb + j] > 0) {
           double lat = 0.0;
-          std::vector<Link*> route;
+          std::vector<LinkImpl*> route;
           hostList_->at(i)->routeTo(hostList_->at(j), &route, &lat);
 
           lat_current = MAX(lat_current, lat * communicationAmount_[i * hostNb + j]);
index 389720c..bdac362 100644 (file)
@@ -58,7 +58,8 @@ class NetworkL07Model : public NetworkModel {
 public:
   NetworkL07Model(HostL07Model *hmodel, lmm_system_t sys);
   ~NetworkL07Model();
-  Link* createLink(const char* name, double bandwidth, double latency, e_surf_link_sharing_policy_t policy) override;
+  LinkImpl* createLink(const char* name, double bandwidth, double latency,
+                       e_surf_link_sharing_policy_t policy) override;
 
   Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
 
@@ -81,7 +82,7 @@ protected:
   void onSpeedChange() override;
 };
 
-class LinkL07 : public Link {
+class LinkL07 : public LinkImpl {
 public:
   LinkL07(NetworkL07Model* model, const char* name, double bandwidth, double latency,
           e_surf_link_sharing_policy_t policy);
index 2f2f304..5e00d5e 100644 (file)
@@ -308,7 +308,8 @@ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster)
   simgrid::surf::on_cluster(cluster);
   delete cluster->radicals;
 }
-void routing_cluster_add_backbone(simgrid::surf::Link* bb) {
+void routing_cluster_add_backbone(simgrid::surf::LinkImpl* bb)
+{
   simgrid::kernel::routing::ClusterZone* cluster =
       dynamic_cast<simgrid::kernel::routing::ClusterZone*>(current_routing);
 
@@ -723,8 +724,8 @@ void sg_platf_new_hostlink(sg_platf_host_link_cbarg_t hostlink)
   xbt_assert(dynamic_cast<simgrid::kernel::routing::ClusterZone*>(current_routing),
              "Only hosts from Cluster and Vivaldi ASes can get an host_link.");
 
-  simgrid::surf::Link* linkUp   = Link::byName(hostlink->link_up);
-  simgrid::surf::Link* linkDown = Link::byName(hostlink->link_down);
+  simgrid::surf::LinkImpl* linkUp   = Link::byName(hostlink->link_up);
+  simgrid::surf::LinkImpl* linkDown = Link::byName(hostlink->link_down);
 
   xbt_assert(linkUp, "Link '%s' not found!", hostlink->link_up);
   xbt_assert(linkDown, "Link '%s' not found!", hostlink->link_down);
index e4df569..420cabf 100644 (file)
@@ -30,7 +30,8 @@ int ETag_surfxml_include_state();
 
 char* surf_parsed_filename = nullptr; // to locate parse error messages
 
-std::vector<simgrid::surf::Link *> parsed_link_list;   /* temporary store of current list link of a route */
+std::vector<simgrid::surf::LinkImpl*> parsed_link_list; /* temporary store of current list link of a route */
+
 /*
  * Helping functions
  */
@@ -683,7 +684,7 @@ void ETag_surfxml_link(){
 
 void STag_surfxml_link___ctn(){
 
-  simgrid::surf::Link *link;
+  simgrid::surf::LinkImpl* link;
   char *link_name=nullptr;
   switch (A_surfxml_link___ctn_direction) {
   case AU_surfxml_link___ctn_direction: