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/NetworkModelIntf_test.cpp
include src/kernel/resource/Resource.hpp
+include src/kernel/resource/SplitDuplexLinkImpl.cpp
+include src/kernel/resource/SplitDuplexLinkImpl.hpp
+include src/kernel/resource/SplitDuplexLinkImpl_test.cpp
+include src/kernel/resource/StandardLinkImpl.cpp
+include src/kernel/resource/StandardLinkImpl.hpp
include src/kernel/resource/VirtualMachineImpl.cpp
include src/kernel/resource/VirtualMachineImpl.hpp
+include src/kernel/resource/WifiLinkImpl.cpp
+include src/kernel/resource/WifiLinkImpl.hpp
include src/kernel/resource/profile/DatedValue.cpp
include src/kernel/resource/profile/DatedValue.hpp
include src/kernel/resource/profile/Event.hpp
include src/smpi/smpitools.sh
include src/surf/HostImpl.cpp
include src/surf/HostImpl.hpp
-include src/surf/LinkImpl.cpp
-include src/surf/LinkImpl.hpp
-include src/surf/LinkImplIntf.hpp
-include src/surf/SplitDuplexLinkImpl.cpp
-include src/surf/SplitDuplexLinkImpl.hpp
-include src/surf/SplitDuplexLinkImpl_test.cpp
include src/surf/cpu_cas01.cpp
include src/surf/cpu_cas01.hpp
include src/surf/cpu_ti.cpp
include src/surf/network_constant.hpp
include src/surf/network_ib.cpp
include src/surf/network_ib.hpp
-include src/surf/network_interface.cpp
-include src/surf/network_interface.hpp
include src/surf/network_ns3.cpp
include src/surf/network_ns3.hpp
include src/surf/network_smpi.cpp
include src/surf/network_smpi.hpp
-include src/surf/network_wifi.cpp
-include src/surf/network_wifi.hpp
include src/surf/ns3/ns3_simulator.cpp
include src/surf/ns3/ns3_simulator.hpp
include src/surf/ptask_L07.cpp
class NetworkModel;
class NetworkModelIntf;
class LinkImpl;
+class StandardLinkImpl;
class SplitDuplexLinkImpl;
-class LinkImplIntf;
class NetworkAction;
class DiskImpl;
class DiskModel;
class XBT_PRIVATE ClusterBase : public ClusterZone {
/* We use a map instead of a std::vector here because that's a sparse vector. Some values may not exist */
/* The pair is {link_up, link_down} */
- std::unordered_map<unsigned long, std::pair<resource::LinkImpl*, resource::LinkImpl*>> private_links_;
+ std::unordered_map<unsigned long, std::pair<resource::StandardLinkImpl*, resource::StandardLinkImpl*>> private_links_;
std::unordered_map<unsigned long, NetPoint*> gateways_; //!< list of gateways for leafs (if they're netzones)
- resource::LinkImpl* backbone_ = nullptr;
+ resource::StandardLinkImpl* backbone_ = nullptr;
NetPoint* router_ = nullptr;
bool has_limiter_ = false;
bool has_loopback_ = false;
protected:
using ClusterZone::ClusterZone;
void set_num_links_per_node(unsigned long num) { num_links_per_node_ = num; }
- resource::LinkImpl* get_uplink_from(unsigned long position) const { return private_links_.at(position).first; }
- resource::LinkImpl* get_downlink_to(unsigned long position) const { return private_links_.at(position).second; }
+ resource::StandardLinkImpl* get_uplink_from(unsigned long position) const
+ {
+ return private_links_.at(position).first;
+ }
+ resource::StandardLinkImpl* get_downlink_to(unsigned long position) const
+ {
+ return private_links_.at(position).second;
+ }
double get_link_latency() const { return link_lat_; }
double get_link_bandwidth() const { return link_bw_; }
bool has_loopback() const { return has_loopback_; }
void set_limiter();
bool has_limiter() const { return has_limiter_; }
- void set_backbone(resource::LinkImpl* bb) { backbone_ = bb; }
+ void set_backbone(resource::StandardLinkImpl* bb) { backbone_ = bb; }
bool has_backbone() const { return backbone_ != nullptr; }
void set_router(NetPoint* router) { router_ = router; }
/** @brief Sets gateway for the leaf */
void set_gateway(unsigned long position, NetPoint* gateway);
/** @brief Gets gateway for the leaf or nullptr */
NetPoint* get_gateway(unsigned long position);
- void add_private_link_at(unsigned long position, std::pair<resource::LinkImpl*, resource::LinkImpl*> link);
+ void add_private_link_at(unsigned long position,
+ std::pair<resource::StandardLinkImpl*, resource::StandardLinkImpl*> link);
bool private_link_exists_at(unsigned long position) const
{
return private_links_.find(position) != private_links_.end();
unsigned int group_;
unsigned int chassis_;
unsigned int blade_;
- resource::LinkImpl* blue_link_ = nullptr;
- resource::LinkImpl* limiter_ = nullptr;
- std::vector<resource::LinkImpl*> black_links_;
- std::vector<resource::LinkImpl*> green_links_;
- std::vector<resource::LinkImpl*> my_nodes_;
- DragonflyRouter(unsigned group, unsigned chassis, unsigned blade, resource::LinkImpl* limiter)
+ resource::StandardLinkImpl* blue_link_ = nullptr;
+ resource::StandardLinkImpl* limiter_ = nullptr;
+ std::vector<resource::StandardLinkImpl*> black_links_;
+ std::vector<resource::StandardLinkImpl*> green_links_;
+ std::vector<resource::StandardLinkImpl*> my_nodes_;
+ DragonflyRouter(unsigned group, unsigned chassis, unsigned blade, resource::StandardLinkImpl* limiter)
: group_(group), chassis_(chassis), blade_(blade), limiter_(limiter)
{
}
private:
void generate_routers(const s4u::ClusterCallbacks& set_callbacks);
void generate_links();
- void generate_link(const std::string& id, int numlinks, resource::LinkImpl** linkup, resource::LinkImpl** linkdown);
+ void generate_link(const std::string& id, int numlinks, resource::StandardLinkImpl** linkup,
+ resource::StandardLinkImpl** linkdown);
unsigned int num_nodes_per_blade_ = 0;
unsigned int num_blades_per_chassis_ = 0;
/** Virtual link standing for the node global capacity.
*/
- resource::LinkImpl* limiter_link_;
+ resource::StandardLinkImpl* limiter_link_;
/** If present, communications from this node to this node will pass through it
* instead of passing by an upper level switch.
*/
- resource::LinkImpl* loopback_;
- FatTreeNode(int id, int level, int position, resource::LinkImpl* limiter, resource::LinkImpl* loopback)
+ resource::StandardLinkImpl* loopback_;
+ FatTreeNode(int id, int level, int position, resource::StandardLinkImpl* limiter,
+ resource::StandardLinkImpl* loopback)
: id(id), level(level), position(position), limiter_link_(limiter), loopback_(loopback)
{
}
*/
class FatTreeLink {
public:
- FatTreeLink(FatTreeNode* src, FatTreeNode* dst, resource::LinkImpl* linkup, resource::LinkImpl* linkdown)
+ FatTreeLink(FatTreeNode* src, FatTreeNode* dst, resource::StandardLinkImpl* linkup,
+ resource::StandardLinkImpl* linkdown)
: up_node_(dst), down_node_(src), up_link_(linkup), down_link_(linkdown)
{
}
/** Lower end of the link */
FatTreeNode* down_node_;
/** Link going up in the tree */
- resource::LinkImpl* up_link_;
+ resource::StandardLinkImpl* up_link_;
/** Link going down in the tree */
- resource::LinkImpl* down_link_;
+ resource::StandardLinkImpl* down_link_;
};
/** @ingroup ROUTING_API
/** @brief Set FatTree topology */
void set_topology(unsigned int n_levels, const std::vector<unsigned int>& down_links,
const std::vector<unsigned int>& up_links, const std::vector<unsigned int>& link_count);
- void add_processing_node(int id, resource::LinkImpl* limiter, resource::LinkImpl* loopback);
+ void add_processing_node(int id, resource::StandardLinkImpl* limiter, resource::StandardLinkImpl* loopback);
/**
* @brief Build upper levels (switches) in Fat-Tree
*
NetPoint* dst_ = nullptr;
NetPoint* gw_src_ = nullptr;
NetPoint* gw_dst_ = nullptr;
- std::vector<resource::LinkImpl*> link_list_;
+ std::vector<resource::StandardLinkImpl*> link_list_;
};
class BypassRoute {
explicit BypassRoute(NetPoint* gwSrc, NetPoint* gwDst) : gw_src(gwSrc), gw_dst(gwDst) {}
NetPoint* gw_src;
NetPoint* gw_dst;
- std::vector<resource::LinkImpl*> links;
+ std::vector<resource::StandardLinkImpl*> links;
};
/** @ingroup ROUTING_API
/** @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 get_bypass_route(const routing::NetPoint* src, const routing::NetPoint* dst,
- /* OUT */ std::vector<resource::LinkImpl*>& links, double* latency,
+ /* OUT */ std::vector<resource::StandardLinkImpl*>& links, double* latency,
std::unordered_set<NetZoneImpl*>& netzones);
/** @brief Get the NetZone that is represented by the netpoint */
const NetZoneImpl* get_netzone_recursive(const NetPoint* netpoint) const;
/** @brief Get the list of LinkImpl* to add in a route, considering split-duplex links and the direction */
- std::vector<resource::LinkImpl*> get_link_list_impl(const std::vector<s4u::LinkInRoute>& link_list,
- bool backroute) const;
+ std::vector<resource::StandardLinkImpl*> get_link_list_impl(const std::vector<s4u::LinkInRoute>& link_list,
+ bool backroute) const;
public:
enum class RoutingMode {
* @param latency Accumulator in which the latencies should be added (caller must set it to 0)
*/
static void get_global_route(const NetPoint* src, const NetPoint* dst,
- /* OUT */ std::vector<resource::LinkImpl*>& links, double* latency);
+ /* OUT */ std::vector<resource::StandardLinkImpl*>& links, double* latency);
/** @brief Similar to get_global_route but get the NetZones traversed by route */
static void get_global_route_with_netzones(const NetPoint* src, const NetPoint* dst,
- /* OUT */ std::vector<resource::LinkImpl*>& links, double* latency,
+ /* OUT */ std::vector<resource::StandardLinkImpl*>& links, double* latency,
std::unordered_set<NetZoneImpl*>& netzones);
virtual void get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t, std::less<>>* nodes,
/*** Called on each newly created regular route (not on bypass routes) */
static xbt::signal<void(bool symmetrical, NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
- std::vector<resource::LinkImpl*> const& link_list)>
+ std::vector<resource::StandardLinkImpl*> const& link_list)>
on_route_creation; // XBT_ATTRIB_DEPRECATED_v332 : should be an internal signal used by NS3.. if necessary,
// callback shouldn't use LinkImpl*
protected:
Route* new_extended_route(RoutingMode hierarchy, NetPoint* gw_src, NetPoint* gw_dst,
- const std::vector<resource::LinkImpl*>& link_list, bool preserve_order);
+ const std::vector<resource::StandardLinkImpl*>& link_list, bool preserve_order);
void get_route_check_params(const NetPoint* src, const NetPoint* dst) const;
void add_route_check_params(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
const std::vector<s4u::LinkInRoute>& link_list, bool symmetrical) const;
private:
class StarRoute {
public:
- std::vector<resource::LinkImpl*> links_up; //!< list of links UP for route (can be empty)
- std::vector<resource::LinkImpl*> links_down; //!< list of links DOWN for route (can be empty)
- std::vector<resource::LinkImpl*> loopback; //!< loopback links, cannot be empty if configured
+ std::vector<resource::StandardLinkImpl*> links_up; //!< list of links UP for route (can be empty)
+ std::vector<resource::StandardLinkImpl*> links_down; //!< list of links DOWN for route (can be empty)
+ std::vector<resource::StandardLinkImpl*> loopback; //!< loopback links, cannot be empty if configured
bool links_up_set = false; //!< bool to indicate that links_up was configured (empty or not)
bool links_down_set = false; //!< same for links_down
NetPoint* gateway = nullptr;
bool has_links_down() const { return links_down_set; }
};
/** @brief Auxiliary method to add links to a route */
- void add_links_to_route(const std::vector<resource::LinkImpl*>& links, Route* route, double* latency,
- std::unordered_set<resource::LinkImpl*>& added_links) const;
+ void add_links_to_route(const std::vector<resource::StandardLinkImpl*>& links, Route* route, double* latency,
+ std::unordered_set<resource::StandardLinkImpl*>& added_links) const;
/** @brief Auxiliary methods to check params received in add_route method */
void check_add_route_param(const NetPoint* src, const NetPoint* dst, const NetPoint* gw_src, const NetPoint* gw_dst,
bool symmetrical) const;
* That link is used for all communications within the zone.
*/
class XBT_PRIVATE WifiZone : public RoutedZone {
- resource::LinkImpl* wifi_link_ = nullptr; // Representing the air media (there is no such thing in NS-3)
+ resource::StandardLinkImpl* wifi_link_ = nullptr; // Representing the air media (there is no such thing in NS-3)
NetPoint* access_point_ = nullptr; // Zone's gateway to the external world
void do_seal() override;
friend kernel::routing::NetPoint;
friend kernel::routing::NetZoneImpl;
friend kernel::resource::HostImpl;
- friend kernel::resource::LinkImpl;
+ 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);
VirtualMachine* create_vm(const std::string& name, int core_amount, size_t ramsize);
void route_to(const Host* dest, std::vector<Link*>& links, double* latency) const;
- void route_to(const Host* dest, std::vector<kernel::resource::LinkImpl*>& links, double* latency) const;
+ void route_to(const Host* dest, std::vector<kernel::resource::StandardLinkImpl*>& links, double* latency) const;
/**
* @brief Seal this host
*/
class XBT_PUBLIC Link : public xbt::Extendable<Link> {
#ifndef DOXYGEN
- friend kernel::resource::LinkImpl;
+ friend kernel::resource::StandardLinkImpl;
#endif
protected:
// Links are created from the NetZone, and destroyed by their private implementation when the simulation ends
- explicit Link(kernel::resource::LinkImplIntf* pimpl) : pimpl_(pimpl) {}
+ explicit Link(kernel::resource::LinkImpl* pimpl) : pimpl_(pimpl) {}
virtual ~Link() = default;
// The implementation that never changes
- kernel::resource::LinkImplIntf* const pimpl_;
+ kernel::resource::LinkImpl* const pimpl_;
#ifndef DOXYGEN
friend kernel::resource::NetworkAction; // signal comm_state_changed
#endif
public:
enum class SharingPolicy { NONLINEAR = 4, WIFI = 3, SPLITDUPLEX = 2, SHARED = 1, FATPIPE = 0 };
- kernel::resource::LinkImpl* get_impl() const;
+ kernel::resource::StandardLinkImpl* get_impl() const;
/** @brief Retrieve a link from its name */
static Link* by_name(const std::string& name);
*/
class XBT_PUBLIC SplitDuplexLink : public Link {
public:
- explicit SplitDuplexLink(kernel::resource::LinkImplIntf* pimpl) : Link(pimpl) {}
+ explicit SplitDuplexLink(kernel::resource::LinkImpl* pimpl) : Link(pimpl) {}
/** @brief Get the link direction up*/
Link* get_link_up() const;
/** @brief Get the link direction down */
kernel::routing::NetPoint* gw_dst, const std::vector<LinkInRoute>& link_list, bool symmetrical = true);
#ifndef DOXYGEN
- XBT_ATTRIB_DEPRECATED_v332("Please use add_route() method which uses s4u::LinkInRoute instead of "
- "LinkImpl") void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
- kernel::routing::NetPoint* gw_src,
- kernel::routing::NetPoint* gw_dst,
- const std::vector<kernel::resource::LinkImpl*>& link_list,
- bool symmetrical);
-
- XBT_ATTRIB_DEPRECATED_v332("Please use add_bypass_route() method which uses s4u::LinkInRoute instead of "
- "LinkImpl") void add_bypass_route(kernel::routing::NetPoint* src,
- kernel::routing::NetPoint* dst,
- kernel::routing::NetPoint* gw_src,
- kernel::routing::NetPoint* gw_dst,
- std::vector<kernel::resource::LinkImpl*>& link_list,
- bool /*symmetrical*/);
+ XBT_ATTRIB_DEPRECATED_v332(
+ "Please use add_route() method which uses s4u::LinkInRoute instead of "
+ "LinkImpl") void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+ kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
+ const std::vector<kernel::resource::StandardLinkImpl*>& link_list, bool symmetrical);
+
+ XBT_ATTRIB_DEPRECATED_v332(
+ "Please use add_bypass_route() method which uses s4u::LinkInRoute instead of "
+ "LinkImpl") void add_bypass_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+ kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
+ std::vector<kernel::resource::StandardLinkImpl*>& link_list,
+ bool /*symmetrical*/);
#endif
void add_bypass_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
/*** Called on each newly created regular route (not on bypass routes) */
static xbt::signal<void(bool symmetrical, kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
- std::vector<kernel::resource::LinkImpl*> const& link_list)>
+ std::vector<kernel::resource::StandardLinkImpl*> const& link_list)>
on_route_creation; // XBT_ATTRIB_DEPRECATED_v332 : should not be used by users, used by ns3.. if necessary,
// signal shouldn't use LinkImpl*
private:
#ifndef DOXYGEN
/** @brief XBT_ATTRIB_DEPRECATED_v332 Auxiliary function to convert types */
- static std::vector<LinkInRoute> convert_to_linkInRoute(const std::vector<kernel::resource::LinkImpl*>& link_list);
+ static std::vector<LinkInRoute>
+ convert_to_linkInRoute(const std::vector<kernel::resource::StandardLinkImpl*>& link_list);
#endif
};
#include <xbt/random.hpp>
#include "src/instr/instr_private.hpp"
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
#include <algorithm>
#include <cmath>
const simgrid::kernel::routing::NetPoint* dst_elm = sg_netpoint_by_name_or_null(dst);
xbt_assert(dst_elm, "Element '%s' not found!", dst);
- std::vector<simgrid::kernel::resource::LinkImpl*> route;
+ std::vector<simgrid::kernel::resource::StandardLinkImpl*> route;
simgrid::kernel::routing::NetZoneImpl::get_global_route(src_elm, dst_elm, route, nullptr);
for (auto const& link : route)
instr_user_variable(time, link->get_cname(), variable, parent_type, value, what, nullptr, &user_link_variables);
#include "src/instr/instr_private.hpp"
#include "src/kernel/resource/CpuImpl.hpp"
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
#include "src/surf/surf_interface.hpp"
#include <fstream>
resource_set_utilization("HOST", "speed_used", cpu->get_cname(), action.get_category(), value,
action.get_last_update(), simgrid_get_clock() - action.get_last_update());
- const kernel::resource::LinkImpl* link = dynamic_cast<kernel::resource::LinkImpl*>(resource);
+ const kernel::resource::StandardLinkImpl* link = dynamic_cast<kernel::resource::StandardLinkImpl*>(resource);
if (link != nullptr)
resource_set_utilization("LINK", "bandwidth_used", link->get_cname(), action.get_category(), value,
#include "mc/mc.h"
#include "src/kernel/EngineImpl.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
#include "src/kernel/resource/profile/Profile.hpp"
#include "src/mc/mc_record.hpp"
#include "src/mc/mc_replay.hpp"
#include "src/smpi/include/smpi_actor.hpp"
-#include "src/surf/network_interface.hpp"
#include "src/surf/xml/platf.hpp"
-#include "xbt/xbt_modinter.h" /* whether initialization was already done */
+#include "xbt/xbt_modinter.h" /* whether initialization was already done */
#include <boost/algorithm/string/predicate.hpp>
#ifndef _WIN32
#include "src/kernel/activity/SleepImpl.hpp"
#include "src/kernel/activity/SynchroRaw.hpp"
#include "src/kernel/actor/ActorImpl.hpp"
-#include "src/surf/SplitDuplexLinkImpl.hpp"
+#include "src/kernel/resource/SplitDuplexLinkImpl.hpp"
#include <boost/intrusive/list.hpp>
#include <map>
class EngineImpl {
std::map<std::string, s4u::Host*, std::less<>> hosts_;
- std::map<std::string, resource::LinkImpl*, std::less<>> links_;
+ std::map<std::string, resource::StandardLinkImpl*, std::less<>> links_;
/* save split-duplex links separately, keep links_ with only LinkImpl* seen by the user
* members of a split-duplex are saved in the links_ */
std::map<std::string, std::unique_ptr<resource::SplitDuplexLinkImpl>, std::less<>> split_duplex_links_;
#include "src/kernel/activity/MailboxImpl.hpp"
#include "src/kernel/context/Context.hpp"
#include "src/kernel/resource/CpuImpl.hpp"
+#include "src/kernel/resource/LinkImpl.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
#include "src/mc/mc_replay.hpp"
-#include "src/surf/network_interface.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_network, simix, "SIMIX network-related synchronization");
#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/profile/Profile.hpp"
-#include "src/surf/network_interface.hpp"
#include "src/surf/surf_interface.hpp"
#include <numeric>
}
/** @brief returns a list of all Links that this action is using */
-std::list<LinkImpl*> NetworkAction::get_links() const
+std::list<StandardLinkImpl*> NetworkAction::get_links() const
{
- std::list<LinkImpl*> retlist;
+ std::list<StandardLinkImpl*> retlist;
int llen = get_variable()->get_number_of_constraint();
for (int i = 0; i < llen; i++) {
/* Beware of composite actions: ptasks put links and cpus together */
- if (auto* link = dynamic_cast<LinkImpl*>(get_variable()->get_constraint(i)->get_id()))
+ if (auto* link = dynamic_cast<StandardLinkImpl*>(get_variable()->get_constraint(i)->get_id()))
retlist.push_back(link);
}
return retlist;
}
-static void add_latency(const std::vector<LinkImpl*>& links, double* latency)
+static void add_latency(const std::vector<StandardLinkImpl*>& links, double* latency)
{
if (latency)
*latency = std::accumulate(begin(links), end(links), *latency,
[](double lat, const auto* link) { return lat + link->get_latency(); });
}
-void add_link_latency(std::vector<LinkImpl*>& result, LinkImpl* link, double* latency)
+void add_link_latency(std::vector<StandardLinkImpl*>& result, StandardLinkImpl* link, double* latency)
{
result.push_back(link);
if (latency)
*latency += link->get_latency();
}
-void add_link_latency(std::vector<LinkImpl*>& result, const std::vector<LinkImpl*>& links, double* latency)
+void add_link_latency(std::vector<StandardLinkImpl*>& result, const std::vector<StandardLinkImpl*>& links,
+ double* latency)
{
result.insert(result.end(), begin(links), end(links));
add_latency(links, latency);
}
-void insert_link_latency(std::vector<LinkImpl*>& result, const std::vector<LinkImpl*>& links, double* latency)
+void insert_link_latency(std::vector<StandardLinkImpl*>& result, const std::vector<StandardLinkImpl*>& links,
+ double* latency)
{
result.insert(result.begin(), rbegin(links), rend(links));
add_latency(links, latency);
/* 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 SURF_NETWORK_INTERFACE_HPP_
-#define SURF_NETWORK_INTERFACE_HPP_
+#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 "src/surf/LinkImpl.hpp"
#include "xbt/PropertyHolder.hpp"
#include <list>
/***********
* Classes *
***********/
+class StandardLinkImpl;
namespace simgrid {
namespace kernel {
namespace resource {
+
/*********
* Model *
*********/
* @param name The name of the Link
* @param bandwidths The vector of bandwidths of the Link in bytes per second
*/
- virtual LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths) = 0;
+ virtual StandardLinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths) = 0;
- virtual LinkImpl* create_wifi_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.
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; }
- LinkImpl* loopback_ = nullptr;
+ StandardLinkImpl* loopback_ = nullptr;
+};
+
+/************
+ * Resource *
+ ************/
+class LinkImpl : public Resource_T<LinkImpl>, public xbt::PropertyHolder {
+public:
+ using Resource_T::Resource_T;
+ /** @brief Get the bandwidth in bytes per second of current Link */
+ virtual double get_bandwidth() const = 0;
+ /** @brief Update the bandwidth in bytes per second of current Link */
+ virtual void set_bandwidth(double value) = 0;
+
+ /** @brief Get the latency in seconds of current Link */
+ virtual double get_latency() const = 0;
+ /** @brief Update the latency in seconds of current Link */
+ virtual void set_latency(double value) = 0;
+
+ /** @brief The sharing policy */
+ virtual void set_sharing_policy(s4u::Link::SharingPolicy policy, const s4u::NonLinearResourceCb& cb) = 0;
+ virtual s4u::Link::SharingPolicy get_sharing_policy() const = 0;
+
+ /* setup the profile file with bandwidth events (peak speed changes due to external load).
+ * Profile must contain percentages (value between 0 and 1). */
+ virtual void set_bandwidth_profile(kernel::profile::Profile* profile) = 0;
+ /* setup the profile file with latency events (peak latency changes due to external load).
+ * Profile must contain absolute values */
+ 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;
};
/**********
: Action(model, cost, failed, var), src_(src), dst_(dst){};
void set_state(Action::State state) override;
- virtual std::list<LinkImpl*> get_links() const;
+ 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
/* 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<LinkImpl*>& result, LinkImpl* link, double* latency);
-void add_link_latency(std::vector<LinkImpl*>& result, const std::vector<LinkImpl*>& links, double* latency);
-void insert_link_latency(std::vector<LinkImpl*>& result, const std::vector<LinkImpl*>& links, double* latency);
+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 /* SURF_NETWORK_INTERFACE_HPP_ */
+#endif /* SIMGRID_KERNEL_RESOURCE_LINKIMPL_HPP */
/* 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/surf/SplitDuplexLinkImpl.hpp"
+#include "src/kernel/resource/SplitDuplexLinkImpl.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(res_network);
namespace kernel {
namespace resource {
-SplitDuplexLinkImpl::SplitDuplexLinkImpl(const std::string& name, LinkImpl* link_up, LinkImpl* link_down)
- : LinkImplIntf(name), piface_(this), link_up_(link_up), link_down_(link_down)
+SplitDuplexLinkImpl::SplitDuplexLinkImpl(const std::string& name, StandardLinkImpl* link_up,
+ StandardLinkImpl* link_down)
+ : LinkImpl(name), piface_(this), link_up_(link_up), link_down_(link_down)
{
}
#ifndef SIMGRID_KERNEL_RESOURCE_SDLINKIMPL_HPP
#define SIMGRID_KERNEL_RESOURCE_SDLINKIMPL_HPP
-#include "src/surf/LinkImpl.hpp"
-#include "src/surf/LinkImplIntf.hpp"
-
-/***********
- * Classes *
- ***********/
+#include "src/kernel/resource/LinkImpl.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
namespace simgrid {
namespace kernel {
namespace resource {
+
/************
* Resource *
************/
* @brief SURF network link interface class
* @details A Link represents the link between two [hosts](@ref HostImpl)
*/
-class SplitDuplexLinkImpl : public LinkImplIntf {
+class SplitDuplexLinkImpl : public LinkImpl {
s4u::SplitDuplexLink piface_;
- LinkImpl* link_up_;
- LinkImpl* link_down_;
+ StandardLinkImpl* link_up_;
+ StandardLinkImpl* link_down_;
protected:
- SplitDuplexLinkImpl(const LinkImpl&) = delete;
- SplitDuplexLinkImpl& operator=(const LinkImpl&) = delete;
+ SplitDuplexLinkImpl(const StandardLinkImpl&) = delete;
+ SplitDuplexLinkImpl& operator=(const StandardLinkImpl&) = delete;
public:
- SplitDuplexLinkImpl(const std::string& name, LinkImpl* link_up, LinkImpl* link_down);
+ SplitDuplexLinkImpl(const std::string& name, StandardLinkImpl* link_up, StandardLinkImpl* link_down);
/** @brief Public interface */
const s4u::SplitDuplexLink* get_iface() const { return &piface_; }
s4u::SplitDuplexLink* get_iface() { return &piface_; }
#include "catch.hpp"
-#include "simgrid/s4u/Engine.hpp"
-#include "simgrid/s4u/Link.hpp"
-#include "src/surf/SplitDuplexLinkImpl.hpp"
+#include <simgrid/s4u/Engine.hpp>
+#include <simgrid/s4u/Link.hpp>
+
+#include "src/kernel/resource/SplitDuplexLinkImpl.hpp"
TEST_CASE("SplitDuplexLink: create", "")
{
#include <simgrid/s4u/Engine.hpp>
#include "src/kernel/EngineImpl.hpp"
-#include "src/surf/LinkImpl.hpp"
-
+#include "src/kernel/resource/StandardLinkImpl.hpp"
#include <numeric>
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(res_network);
namespace kernel {
namespace resource {
-LinkImpl::LinkImpl(const std::string& name) : LinkImplIntf(name), piface_(this)
+StandardLinkImpl::StandardLinkImpl(const std::string& name) : LinkImpl(name), piface_(this)
{
if (name != "__loopback__")
xbt_assert(not s4u::Link::by_name_or_null(name), "Link '%s' declared several times in the platform.", name.c_str());
*
* Don't delete directly a Link, call l->destroy() instead.
*/
-void LinkImpl::destroy()
+void StandardLinkImpl::destroy()
{
s4u::Link::on_destruction(piface_);
s4u::Engine::get_instance()->link_unregister(get_name());
}
}
-void LinkImpl::set_sharing_policy(s4u::Link::SharingPolicy policy, const s4u::NonLinearResourceCb& cb)
+void StandardLinkImpl::set_sharing_policy(s4u::Link::SharingPolicy policy, const s4u::NonLinearResourceCb& cb)
{
get_constraint()->set_sharing_policy(to_maxmin_policy(policy), cb);
sharing_policy_ = policy;
}
-void LinkImpl::latency_check(double latency) const
+void StandardLinkImpl::latency_check(double latency) const
{
static double last_warned_latency = sg_surf_precision;
if (latency != 0.0 && latency < last_warned_latency) {
}
}
-void LinkImpl::turn_on()
+void StandardLinkImpl::turn_on()
{
if (not is_on()) {
Resource::turn_on();
}
}
-void LinkImpl::turn_off()
+void StandardLinkImpl::turn_off()
{
if (is_on()) {
Resource::turn_off();
}
}
-void LinkImpl::seal()
+void StandardLinkImpl::seal()
{
if (is_sealed())
return;
Resource::seal();
}
-void LinkImpl::on_bandwidth_change() const
+void StandardLinkImpl::on_bandwidth_change() const
{
s4u::Link::on_bandwidth_change(piface_);
}
-void LinkImpl::set_bandwidth_profile(profile::Profile* profile)
+void StandardLinkImpl::set_bandwidth_profile(profile::Profile* profile)
{
if (profile) {
xbt_assert(bandwidth_.event == nullptr, "Cannot set a second bandwidth profile to Link %s", get_cname());
}
}
-void LinkImpl::set_latency_profile(profile::Profile* profile)
+void StandardLinkImpl::set_latency_profile(profile::Profile* profile)
{
if (profile) {
xbt_assert(latency_.event == nullptr, "Cannot set a second latency profile to Link %s", get_cname());
}
}
-void LinkImpl::set_concurrency_limit(int limit) const
+void StandardLinkImpl::set_concurrency_limit(int limit) const
{
if (limit != -1) {
get_constraint()->reset_concurrency_maximum();
/* 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_LINKIMPL_HPP
-#define SIMGRID_KERNEL_RESOURCE_LINKIMPL_HPP
+#ifndef SIMGRID_KERNEL_RESOURCE_STANDARDLINKIMPL_HPP
+#define SIMGRID_KERNEL_RESOURCE_STANDARDLINKIMPL_HPP
-#include "src/surf/LinkImplIntf.hpp"
+#include "src/kernel/resource/LinkImpl.hpp"
/***********
* Classes *
/************
* Resource *
************/
-/** @ingroup SURF_network_interface
- * @brief SURF network link interface class
- * @details A Link represents the link between two [hosts](@ref simgrid::kernel::resource::HostImpl)
- */
-class LinkImpl : public LinkImplIntf {
+class StandardLinkImpl : public LinkImpl {
s4u::Link piface_;
s4u::Link::SharingPolicy sharing_policy_ = s4u::Link::SharingPolicy::SHARED;
protected:
- explicit LinkImpl(const std::string& name);
- LinkImpl(const LinkImpl&) = delete;
- LinkImpl& operator=(const LinkImpl&) = delete;
- ~LinkImpl() override = default; // Use destroy() instead of this destructor.
+ explicit StandardLinkImpl(const std::string& name);
+ StandardLinkImpl(const StandardLinkImpl&) = delete;
+ StandardLinkImpl& operator=(const StandardLinkImpl&) = delete;
+ ~StandardLinkImpl() override = default; // Use destroy() instead of this destructor.
Metric latency_ = {0.0, 1, nullptr};
Metric bandwidth_ = {1.0, 1, nullptr};
} // namespace kernel
} // namespace simgrid
-#endif /* SIMGRID_KERNEL_RESOURCE_LINKIMPL_HPP */
+#endif /* SIMGRID_KERNEL_RESOURCE_STANDARDLINKIMPL_HPP */
/* 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 "network_wifi.hpp"
-#include "simgrid/s4u/Host.hpp"
+#include <simgrid/s4u/Host.hpp>
+
+#include "src/kernel/resource/WifiLinkImpl.hpp"
#include "src/surf/surf_interface.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(res_network);
* Resource *
************/
-NetworkWifiLink::NetworkWifiLink(const std::string& name, const std::vector<double>& bandwidths, lmm::System* system)
- : LinkImpl(name)
+WifiLinkImpl::WifiLinkImpl(const std::string& name, const std::vector<double>& bandwidths, lmm::System* system)
+ : StandardLinkImpl(name)
{
this->set_constraint(system->constraint_new(this, 1));
for (auto bandwidth : bandwidths)
bandwidths_.push_back({bandwidth, 1.0, nullptr});
}
-void NetworkWifiLink::set_host_rate(const s4u::Host* host, int rate_level)
+void WifiLinkImpl::set_host_rate(const s4u::Host* host, int rate_level)
{
auto insert_done = host_rates_.insert(std::make_pair(host->get_name(), rate_level));
if (not insert_done.second)
refresh_decay_bandwidths();
}
-double NetworkWifiLink::get_host_rate(const s4u::Host* host) const
+double WifiLinkImpl::get_host_rate(const s4u::Host* host) const
{
auto host_rates_it = host_rates_.find(host->get_name());
return rate.peak * rate.scale;
}
-s4u::Link::SharingPolicy NetworkWifiLink::get_sharing_policy() const
+s4u::Link::SharingPolicy WifiLinkImpl::get_sharing_policy() const
{
return s4u::Link::SharingPolicy::WIFI;
}
-int NetworkWifiLink::get_host_count() const
+int WifiLinkImpl::get_host_count() const
{
return static_cast<int>(host_rates_.size());
}
-void NetworkWifiLink::refresh_decay_bandwidths(){
+void WifiLinkImpl::refresh_decay_bandwidths()
+{
// Compute number of STAtion on the Access Point
int nSTA = get_host_count();
std::vector<Metric> new_bandwidths;
for (auto const& bandwidth : bandwidths_) {
// Instantiate decay model relatively to the actual bandwidth
- double max_bw=bandwidth.peak;
- double min_bw=bandwidth.peak-(wifi_max_rate_-wifi_min_rate_);
- double model_rate=bandwidth.peak-(wifi_max_rate_-model_rate_);
+ double max_bw = bandwidth.peak;
+ double min_bw = bandwidth.peak - (wifi_max_rate_ - wifi_min_rate_);
+ double model_rate = bandwidth.peak - (wifi_max_rate_ - model_rate_);
xbt_assert(min_bw > 0, "Your WIFI link is using bandwidth(s) which is too low for the decay model.");
- double N0=max_bw-min_bw;
- double lambda=(-log(model_rate-min_bw)+log(N0))/model_n_;
+ double N0 = max_bw - min_bw;
+ double lambda = (-log(model_rate - min_bw) + log(N0)) / model_n_;
// Since decay model start at 0 we should use (nSTA-1)
- double new_peak=N0*exp(-lambda*(nSTA-1))+min_bw;
+ double new_peak = N0 * exp(-lambda * (nSTA - 1)) + min_bw;
new_bandwidths.push_back({new_peak, 1.0, nullptr});
}
- decay_bandwidths_=new_bandwidths;
+ decay_bandwidths_ = new_bandwidths;
}
-bool NetworkWifiLink::toggle_decay_model(){
+bool WifiLinkImpl::toggle_decay_model()
+{
use_decay_model_ = not use_decay_model_;
return use_decay_model_;
}
-void NetworkWifiLink::set_latency(double value)
+void WifiLinkImpl::set_latency(double value)
{
xbt_assert(value == 0, "Latency cannot be set for WiFi Links.");
}
#include <xbt/base.h>
-#include "network_cm02.hpp"
+#include "src/surf/network_cm02.hpp"
#include "xbt/string.hpp"
/***********
namespace kernel {
namespace resource {
-class XBT_PRIVATE NetworkWifiAction;
+class XBT_PRIVATE WifiLinkAction;
-class NetworkWifiLink : public LinkImpl {
+class WifiLinkImpl : public StandardLinkImpl {
/** @brief Hold every rates association between host and links (host name, rates id) */
std::map<xbt::string, int> host_rates_;
std::vector<Metric> bandwidths_;
/** @brief Should we use the decay model ? */
- bool use_decay_model_=false;
+ bool use_decay_model_ = false;
/** @brief Wifi maximal bit rate according to the ns-3 802.11n standard */
const double wifi_max_rate_ = 54 * 1e6 / 8;
/** @brief minimum bit rate observed with ns3 during our calibration experiments */
const double wifi_min_rate_ = 41.70837 * 1e6 / 8;
/** @brief Amount of stations used in the reference point to rescale SimGrid predictions to fit ns-3 ones */
- const int model_n_=5;
+ const int model_n_ = 5;
/** @brief Bit rate observed on ns3 at the reference point used for rescaling */
- const double model_rate_=42.61438*1e6 / 8;
+ const double model_rate_ = 42.61438 * 1e6 / 8;
/** @brief The bandwidth to use for each SNR level, corrected with the decay rescale mechanism */
std::vector<Metric> decay_bandwidths_;
public:
- NetworkWifiLink(const std::string& name, const std::vector<double>& bandwidths, lmm::System* system);
+ WifiLinkImpl(const std::string& name, const std::vector<double>& bandwidths, lmm::System* system);
void set_host_rate(const s4u::Host* host, int rate_level);
/** @brief Get the AP rate associated to the host (or -1 if not associated to the AP) */
int get_host_count() const;
};
-class NetworkWifiAction : public NetworkCm02Action {
- NetworkWifiLink* src_wifi_link_;
- NetworkWifiLink* dst_wifi_link_;
+class WifiLinkAction : public NetworkCm02Action {
+ WifiLinkImpl* src_wifi_link_;
+ WifiLinkImpl* dst_wifi_link_;
public:
- NetworkWifiAction() = delete;
- NetworkWifiAction(Model* model, s4u::Host& src, s4u::Host& dst, double cost, bool failed,
- NetworkWifiLink* src_wifi_link, NetworkWifiLink* dst_wifi_link)
- : NetworkCm02Action(model, src, dst, cost, failed)
- , src_wifi_link_(src_wifi_link)
- , dst_wifi_link_(dst_wifi_link)
- {}
-
- NetworkWifiLink* get_src_link() const { return src_wifi_link_; }
- NetworkWifiLink* get_dst_link() const { return dst_wifi_link_; }
+ WifiLinkAction() = delete;
+ WifiLinkAction(Model* model, s4u::Host& src, s4u::Host& dst, double cost, bool failed, WifiLinkImpl* src_wifi_link,
+ WifiLinkImpl* dst_wifi_link)
+ : NetworkCm02Action(model, src, dst, cost, failed), src_wifi_link_(src_wifi_link), dst_wifi_link_(dst_wifi_link)
+ {
+ }
+
+ WifiLinkImpl* get_src_link() const { return src_wifi_link_; }
+ WifiLinkImpl* get_dst_link() const { return dst_wifi_link_; }
};
} // namespace resource
} // namespace kernel
} // namespace simgrid
-#endif /* SURF_NETWORK_WIFI_HPP_ */
+#endif
#include "simgrid/kernel/routing/ClusterZone.hpp"
#include "simgrid/kernel/routing/NetPoint.hpp"
#include "simgrid/kernel/routing/RoutedZone.hpp"
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf");
link_lat_ = lat;
}
-void ClusterBase::add_private_link_at(unsigned long position, std::pair<resource::LinkImpl*, resource::LinkImpl*> link)
+void ClusterBase::add_private_link_at(unsigned long position,
+ std::pair<resource::StandardLinkImpl*, resource::StandardLinkImpl*> link)
{
private_links_.insert({position, link});
}
#include <simgrid/kernel/routing/NetPoint.hpp>
#include <xbt/string.hpp>
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
#include <climits>
#include <queue>
if (get_hierarchy() == RoutingMode::recursive && v != dst_node_id &&
gw_dst->get_name() != prev_gw_src->get_name()) {
- std::vector<resource::LinkImpl*> e_route_as_to_as;
+ std::vector<resource::StandardLinkImpl*> e_route_as_to_as;
const NetPoint* gw_dst_net_elm = nullptr;
const NetPoint* prev_gw_src_net_elm = nullptr;
#include "simgrid/s4u/Engine.hpp"
#include "simgrid/s4u/Host.hpp"
#include "simgrid/s4u/NetZone.hpp"
-#include "src/surf/network_interface.hpp" //LinkImpl
+#include "src/kernel/resource/LinkImpl.hpp"
TEST_CASE("kernel::routing::DijkstraZone: Creating Zone", "")
{
#include "simgrid/kernel/routing/DragonflyZone.hpp"
#include "simgrid/kernel/routing/NetPoint.hpp"
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
unsigned long id = 2UL * num_groups_ * num_chassis_per_group_ * num_blades_per_chassis_ * num_nodes_per_blade_;
/* get limiter for this router */
auto get_limiter = [this, &id, &set_callbacks](unsigned int i, unsigned int j,
- unsigned int k) -> resource::LinkImpl* {
- kernel::resource::LinkImpl* limiter = nullptr;
+ unsigned int k) -> resource::StandardLinkImpl* {
+ kernel::resource::StandardLinkImpl* limiter = nullptr;
if (set_callbacks.limiter) {
id--;
const auto* s4u_link =
}
}
-void DragonflyZone::generate_link(const std::string& id, int numlinks, resource::LinkImpl** linkup,
- resource::LinkImpl** linkdown)
+void DragonflyZone::generate_link(const std::string& id, int numlinks, resource::StandardLinkImpl** linkup,
+ resource::StandardLinkImpl** linkdown)
{
XBT_DEBUG("Generating link %s", id.c_str());
*linkup = nullptr;
void DragonflyZone::generate_links()
{
static int uniqueId = 0;
- resource::LinkImpl* linkup;
- resource::LinkImpl* linkdown;
+ resource::StandardLinkImpl* linkup;
+ resource::StandardLinkImpl* linkdown;
unsigned int numRouters = num_groups_ * num_chassis_per_group_ * num_blades_per_chassis_;
dst->id());
if ((src->id() == dst->id()) && has_loopback()) {
- resource::LinkImpl* uplink = get_uplink_from(node_pos(src->id()));
+ resource::StandardLinkImpl* uplink = get_uplink_from(node_pos(src->id()));
add_link_latency(route->link_list_, uplink, latency);
return;
#include <simgrid/kernel/routing/FatTreeZone.hpp>
#include <simgrid/kernel/routing/NetPoint.hpp>
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
#include "src/surf/xml/platf.hpp" // surf_parse_error() and surf_parse_assert()
#include <fstream>
}
/* get limiter for this router */
- auto get_limiter = [this, &set_callbacks](unsigned long i, unsigned long j, long id) -> resource::LinkImpl* {
- kernel::resource::LinkImpl* limiter = nullptr;
+ auto get_limiter = [this, &set_callbacks](unsigned long i, unsigned long j, long id) -> resource::StandardLinkImpl* {
+ kernel::resource::StandardLinkImpl* limiter = nullptr;
if (set_callbacks.limiter) {
const auto* s4u_link = set_callbacks.limiter(get_iface(), {i + 1, j}, id);
if (s4u_link) {
return tempPosition;
}
-void FatTreeZone::add_processing_node(int id, resource::LinkImpl* limiter, resource::LinkImpl* loopback)
+void FatTreeZone::add_processing_node(int id, resource::StandardLinkImpl* limiter, resource::StandardLinkImpl* loopback)
{
using std::make_pair;
static int position = 0;
#include <simgrid/kernel/routing/NetPoint.hpp>
#include <xbt/string.hpp>
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
#include <climits>
#include "simgrid/s4u/Engine.hpp"
#include "simgrid/s4u/Host.hpp"
#include "simgrid/s4u/NetZone.hpp"
-#include "src/surf/network_interface.hpp" //LinkImpl
+#include "src/kernel/resource/LinkImpl.hpp"
TEST_CASE("kernel::routing::FloydZone: Creating Zone", "")
{
#include <simgrid/kernel/routing/FullZone.hpp>
#include <simgrid/kernel/routing/NetPoint.hpp>
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf");
#include "simgrid/s4u/Engine.hpp"
#include "simgrid/s4u/Host.hpp"
#include "simgrid/s4u/NetZone.hpp"
-#include "src/surf/network_interface.hpp" //LinkImpl
+#include "src/kernel/resource/LinkImpl.hpp"
TEST_CASE("kernel::routing::FullZone: Creating Zone", "")
{
#include "src/kernel/EngineImpl.hpp"
#include "src/kernel/resource/CpuImpl.hpp"
#include "src/kernel/resource/DiskImpl.hpp"
+#include "src/kernel/resource/SplitDuplexLinkImpl.hpp"
#include "src/surf/HostImpl.hpp"
-#include "src/surf/SplitDuplexLinkImpl.hpp"
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_route);
namespace simgrid {
xbt::signal<void(bool symmetrical, kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
- std::vector<kernel::resource::LinkImpl*> const& link_list)>
+ std::vector<kernel::resource::StandardLinkImpl*> const& link_list)>
NetZoneImpl::on_route_creation;
NetZoneImpl::NetZoneImpl(const std::string& name) : piface_(this), name_(name)
return vertices_.size() - 1; // The rank of the newly created object
}
-std::vector<resource::LinkImpl*> NetZoneImpl::get_link_list_impl(const std::vector<s4u::LinkInRoute>& link_list,
- bool backroute) const
+std::vector<resource::StandardLinkImpl*> NetZoneImpl::get_link_list_impl(const std::vector<s4u::LinkInRoute>& link_list,
+ bool backroute) const
{
- std::vector<resource::LinkImpl*> links;
+ std::vector<resource::StandardLinkImpl*> links;
for (const auto& link : link_list) {
if (link.get_link()->get_sharing_policy() != s4u::Link::SharingPolicy::SPLITDUPLEX) {
const auto* sd_link = dynamic_cast<const s4u::SplitDuplexLink*>(link.get_link());
xbt_assert(sd_link,
"Add_route: cast to SpliDuplexLink impossible. This should not happen, please contact SimGrid team");
- resource::LinkImpl* link_impl;
+ resource::StandardLinkImpl* link_impl;
switch (link.get_direction()) {
case s4u::LinkInRoute::Direction::UP:
if (backroute)
/* PRECONDITION: this is the common ancestor of src and dst */
bool NetZoneImpl::get_bypass_route(const NetPoint* src, const NetPoint* dst,
- /* OUT */ std::vector<resource::LinkImpl*>& links, double* latency,
+ /* OUT */ std::vector<resource::StandardLinkImpl*>& links, double* latency,
std::unordered_set<NetZoneImpl*>& netzones)
{
// If never set a bypass route return nullptr without any further computations
}
void NetZoneImpl::get_global_route(const NetPoint* src, const NetPoint* dst,
- /* OUT */ std::vector<resource::LinkImpl*>& links, double* latency)
+ /* OUT */ std::vector<resource::StandardLinkImpl*>& links, double* latency)
{
std::unordered_set<NetZoneImpl*> netzones;
get_global_route_with_netzones(src, dst, links, latency, netzones);
}
void NetZoneImpl::get_global_route_with_netzones(const NetPoint* src, const NetPoint* dst,
- /* OUT */ std::vector<resource::LinkImpl*>& links, double* latency,
- std::unordered_set<NetZoneImpl*>& netzones)
+ /* OUT */ std::vector<resource::StandardLinkImpl*>& links,
+ double* latency, std::unordered_set<NetZoneImpl*>& netzones)
{
Route route;
#include "simgrid/kernel/routing/RoutedZone.hpp"
#include "simgrid/kernel/routing/NetPoint.hpp"
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
#include "xbt/dict.h"
#include "xbt/graph.h"
#include "xbt/log.h"
/* ************************* GENERIC AUX FUNCTIONS ************************** */
/* change a route containing link names into a route containing link entities */
Route* RoutedZone::new_extended_route(RoutingMode hierarchy, NetPoint* gw_src, NetPoint* gw_dst,
- const std::vector<resource::LinkImpl*>& link_list, bool preserve_order)
+ const std::vector<resource::StandardLinkImpl*>& link_list, bool preserve_order)
{
auto* result = new Route();
#include "simgrid/kernel/routing/StarZone.hpp"
#include "simgrid/kernel/routing/NetPoint.hpp"
#include "simgrid/kernel/routing/RoutedZone.hpp"
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
#include "xbt/string.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_star, surf, "Routing part of surf");
namespace routing {
StarZone::StarZone(const std::string& name) : ClusterZone(name) {}
-void StarZone::add_links_to_route(const std::vector<resource::LinkImpl*>& links, Route* route, double* latency,
- std::unordered_set<resource::LinkImpl*>& added_links) const
+void StarZone::add_links_to_route(const std::vector<resource::StandardLinkImpl*>& links, Route* route, double* latency,
+ std::unordered_set<resource::StandardLinkImpl*>& added_links) const
{
for (auto* link : links) {
/* do not add duplicated links in route->link_list_ */
const auto& src_route = routes_.at(src->id());
const auto& dst_route = routes_.at(dst->id());
- std::unordered_set<resource::LinkImpl*> added_links;
+ std::unordered_set<resource::StandardLinkImpl*> added_links;
/* loopback */
if (src == dst && src_route.has_loopback()) {
add_links_to_route(src_route.loopback, route, latency, added_links);
#include "simgrid/s4u/Engine.hpp"
#include "simgrid/s4u/Host.hpp"
#include "simgrid/s4u/NetZone.hpp"
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
TEST_CASE("kernel::routing::StarZone: Creating Zone", "[creation]")
{
#include "simgrid/kernel/routing/TorusZone.hpp"
#include "simgrid/kernel/routing/NetPoint.hpp"
#include "simgrid/s4u/Host.hpp"
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/LinkImpl.hpp"
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
return;
if (src->id() == dst->id() && has_loopback()) {
- resource::LinkImpl* uplink = get_uplink_from(node_pos(src->id()));
+ resource::StandardLinkImpl* uplink = get_uplink_from(node_pos(src->id()));
add_link_latency(route->link_list_, uplink, lat);
return;
route->link_list_.push_back(get_uplink_from(node_pos_with_loopback(current_node)));
}
- resource::LinkImpl* lnk;
+ resource::StandardLinkImpl* lnk;
if (use_lnk_up)
lnk = get_uplink_from(linkOffset);
else
#include <simgrid/s4u/Engine.hpp>
#include <simgrid/s4u/Host.hpp>
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
#include <boost/algorithm/string.hpp>
#include <simgrid/kernel/routing/NetPoint.hpp>
#include <simgrid/kernel/routing/WifiZone.hpp>
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_wifi, surf, "Routing part of surf");
#include "src/internal_config.h" // HAVE_SMPI
#include "src/kernel/activity/CommImpl.hpp"
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
#if HAVE_SMPI
#include "src/smpi/include/smpi_request.hpp"
#include "src/smpi/plugins/ampi/ampi.hpp"
#include <simgrid/s4u/Link.hpp>
#include "src/kernel/activity/CommImpl.hpp"
-#include "src/surf/network_interface.hpp"
-#include "src/surf/network_wifi.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
+#include "src/kernel/resource/WifiLinkImpl.hpp"
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
class XBT_PRIVATE LinkEnergyWifi {
// associative array keeping size of data already sent for a given flow (required for interleaved actions)
- std::map<kernel::resource::NetworkWifiAction*, std::pair<int, double>> flowTmp{};
+ std::map<kernel::resource::WifiLinkAction*, std::pair<int, double>> flowTmp{};
// WiFi link the plugin instance is attached to
s4u::Link* link_{};
void LinkEnergyWifi::update_destroy()
{
- auto const* wifi_link = static_cast<kernel::resource::NetworkWifiLink*>(link_->get_impl());
+ auto const* wifi_link = static_cast<kernel::resource::WifiLinkImpl*>(link_->get_impl());
double duration = simgrid::s4u::Engine::get_clock() - prev_update_;
prev_update_ = simgrid::s4u::Engine::get_clock();
if(duration < 1e-6)
return;
- auto const* wifi_link = static_cast<kernel::resource::NetworkWifiLink*>(link_->get_impl());
+ auto const* wifi_link = static_cast<kernel::resource::WifiLinkImpl*>(link_->get_impl());
const kernel::lmm::Element* elem = nullptr;
*/
double durUsage = 0;
while (const auto* var = wifi_link->get_constraint()->get_variable(&elem)) {
- auto* action = static_cast<kernel::resource::NetworkWifiAction*>(var->get_id());
+ auto* action = static_cast<kernel::resource::WifiLinkAction*>(var->get_id());
XBT_DEBUG("cost: %f action value: %f link rate 1: %f link rate 2: %f", action->get_cost(), action->get_rate(),
wifi_link->get_host_rate(&action->get_src()), wifi_link->get_host_rate(&action->get_dst()));
#include <simgrid/s4u/Engine.hpp>
#include "src/kernel/activity/CommImpl.hpp"
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
#include <limits>
#include <simgrid/s4u/VirtualMachine.hpp>
#include <xbt/parse_units.hpp>
+#include "src/kernel/resource/StandardLinkImpl.hpp"
#include "src/kernel/resource/VirtualMachineImpl.hpp"
#include "src/surf/HostImpl.hpp"
*/
void Host::route_to(const Host* dest, std::vector<Link*>& links, double* latency) const
{
- std::vector<kernel::resource::LinkImpl*> linkImpls;
+ std::vector<kernel::resource::StandardLinkImpl*> linkImpls;
this->route_to(dest, linkImpls, latency);
for (auto* l : linkImpls)
links.push_back(l->get_iface());
}
/** @brief Just like Host::routeTo, but filling an array of link implementations */
-void Host::route_to(const Host* dest, std::vector<kernel::resource::LinkImpl*>& links, double* latency) const
+void Host::route_to(const Host* dest, std::vector<kernel::resource::StandardLinkImpl*>& links, double* latency) const
{
kernel::routing::NetZoneImpl::get_global_route(pimpl_netpoint_, dest->get_netpoint(), links, latency);
if (XBT_LOG_ISENABLED(surf_route, xbt_log_priority_debug)) {
#include <xbt/config.hpp>
#include <xbt/parse_units.hpp>
-#include "src/surf/SplitDuplexLinkImpl.hpp"
-#include "src/surf/network_interface.hpp"
-#include "src/surf/network_wifi.hpp"
+#include "src/kernel/resource/LinkImpl.hpp"
+#include "src/kernel/resource/SplitDuplexLinkImpl.hpp"
+#include "src/kernel/resource/WifiLinkImpl.hpp"
namespace simgrid {
return Engine::get_instance()->link_by_name(name);
}
-kernel::resource::LinkImpl* Link::get_impl() const
+kernel::resource::StandardLinkImpl* Link::get_impl() const
{
- auto* link_impl = dynamic_cast<kernel::resource::LinkImpl*>(pimpl_);
+ auto* link_impl = dynamic_cast<kernel::resource::StandardLinkImpl*>(pimpl_);
xbt_assert(link_impl != nullptr, "Impossible to get a LinkImpl* from link. %s.",
(get_sharing_policy() == SharingPolicy::SPLITDUPLEX
? "For a Split-Duplex link, you should call this method to each UP/DOWN member"
void Link::set_host_wifi_rate(const s4u::Host* host, int level) const
{
- auto* wlink = dynamic_cast<kernel::resource::NetworkWifiLink*>(pimpl_);
+ auto* wlink = dynamic_cast<kernel::resource::WifiLinkImpl*>(pimpl_);
xbt_assert(wlink != nullptr, "Link %s does not seem to be a wifi link.", get_cname());
wlink->set_host_rate(host, level);
}
#include <simgrid/zone.h>
#include <xbt/parse_units.hpp>
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/LinkImpl.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
namespace simgrid {
namespace s4u {
xbt::signal<void(bool symmetrical, kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
- std::vector<kernel::resource::LinkImpl*> const& link_list)>
+ std::vector<kernel::resource::StandardLinkImpl*> const& link_list)>
NetZone::on_route_creation;
xbt::signal<void(NetZone const&)> NetZone::on_creation;
xbt::signal<void(NetZone const&)> NetZone::on_seal;
}
// XBT_ATTRIB_DEPRECATED_v332
-std::vector<LinkInRoute> NetZone::convert_to_linkInRoute(const std::vector<kernel::resource::LinkImpl*>& link_list)
+std::vector<LinkInRoute>
+NetZone::convert_to_linkInRoute(const std::vector<kernel::resource::StandardLinkImpl*>& link_list)
{
std::vector<LinkInRoute> links;
for (const auto* link : link_list) {
// XBT_ATTRIB_DEPRECATED_v332
void NetZone::add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
- const std::vector<kernel::resource::LinkImpl*>& link_list, bool symmetrical)
+ const std::vector<kernel::resource::StandardLinkImpl*>& link_list, bool symmetrical)
{
pimpl_->add_route(src, dst, gw_src, gw_dst, convert_to_linkInRoute(link_list), symmetrical);
}
// XBT_ATTRIB_DEPRECATED_v332
void NetZone::add_bypass_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
- std::vector<kernel::resource::LinkImpl*>& link_list, bool /*symmetrical*/)
+ std::vector<kernel::resource::StandardLinkImpl*>& link_list, bool /*symmetrical*/)
{
pimpl_->add_bypass_route(src, dst, gw_src, gw_dst, convert_to_linkInRoute(link_list));
}
#include "src/kernel/actor/ActorImpl.hpp"
#include "src/kernel/resource/CpuImpl.hpp"
#include "src/kernel/resource/DiskImpl.hpp"
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/LinkImpl.hpp"
#include <xbt/PropertyHolder.hpp>
#include <vector>
+++ /dev/null
-/* Copyright (c) 2004-2021. 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_LINKIMPLINTF_HPP
-#define SIMGRID_KERNEL_RESOURCE_LINKIMPLINTF_HPP
-
-#include "simgrid/s4u/Link.hpp"
-#include "src/kernel/resource/Resource.hpp"
-#include "xbt/PropertyHolder.hpp"
-
-/***********
- * Classes *
- ***********/
-
-namespace simgrid {
-namespace kernel {
-namespace resource {
-/************
- * Resource *
- ************/
-/** @ingroup SURF_interface
- * @brief SURF network link interface class
- * @details A Link represents the link between two [hosts](@ref HostImpl)
- */
-class LinkImplIntf : public Resource_T<LinkImplIntf>, public xbt::PropertyHolder {
-public:
- using Resource_T::Resource_T;
- /** @brief Get the bandwidth in bytes per second of current Link */
- virtual double get_bandwidth() const = 0;
- /** @brief Update the bandwidth in bytes per second of current Link */
- virtual void set_bandwidth(double value) = 0;
-
- /** @brief Get the latency in seconds of current Link */
- virtual double get_latency() const = 0;
- /** @brief Update the latency in seconds of current Link */
- virtual void set_latency(double value) = 0;
-
- /** @brief The sharing policy */
- virtual void set_sharing_policy(s4u::Link::SharingPolicy policy, const s4u::NonLinearResourceCb& cb) = 0;
- virtual s4u::Link::SharingPolicy get_sharing_policy() const = 0;
-
- /* setup the profile file with bandwidth events (peak speed changes due to external load).
- * Profile must contain percentages (value between 0 and 1). */
- virtual void set_bandwidth_profile(kernel::profile::Profile* profile) = 0;
- /* setup the profile file with latency events (peak latency changes due to external load).
- * Profile must contain absolute values */
- 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;
-};
-
-} // namespace resource
-} // namespace kernel
-} // namespace simgrid
-
-#endif /* SIMGRID_KERNEL_RESOURCE_LINKIMPLINTF_HPP */
#include "simgrid/s4u/Host.hpp"
#include "simgrid/sg_config.hpp"
#include "src/kernel/EngineImpl.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
+#include "src/kernel/resource/WifiLinkImpl.hpp"
#include "src/kernel/resource/profile/Event.hpp"
-#include "src/surf/network_wifi.hpp"
#include "src/surf/surf_interface.hpp"
#include <algorithm>
bw_factor_cb_ = cb;
}
-LinkImpl* NetworkCm02Model::create_link(const std::string& name, const std::vector<double>& bandwidths)
+StandardLinkImpl* NetworkCm02Model::create_link(const std::string& name, const std::vector<double>& bandwidths)
{
xbt_assert(bandwidths.size() == 1, "Non-WIFI links must use only 1 bandwidth.");
auto link = new NetworkCm02Link(name, bandwidths[0], get_maxmin_system());
return link;
}
-LinkImpl* NetworkCm02Model::create_wifi_link(const std::string& name, const std::vector<double>& bandwidths)
+StandardLinkImpl* NetworkCm02Model::create_wifi_link(const std::string& name, const std::vector<double>& bandwidths)
{
- auto link = new NetworkWifiLink(name, bandwidths, get_maxmin_system());
+ auto link = new WifiLinkImpl(name, bandwidths, get_maxmin_system());
link->set_model(this);
return link;
}
void NetworkCm02Model::comm_action_expand_constraints(const s4u::Host* src, const s4u::Host* dst,
const NetworkCm02Action* action,
- const std::vector<LinkImpl*>& route,
- const std::vector<LinkImpl*>& back_route) const
+ const std::vector<StandardLinkImpl*>& route,
+ const std::vector<StandardLinkImpl*>& back_route) const
{
/* expand route links constraints for route and back_route */
- const NetworkWifiLink* src_wifi_link = nullptr;
- const NetworkWifiLink* dst_wifi_link = nullptr;
+ const WifiLinkImpl* src_wifi_link = nullptr;
+ const WifiLinkImpl* dst_wifi_link = nullptr;
if (not route.empty() && route.front()->get_sharing_policy() == s4u::Link::SharingPolicy::WIFI) {
- src_wifi_link = static_cast<NetworkWifiLink*>(route.front());
+ src_wifi_link = static_cast<WifiLinkImpl*>(route.front());
}
if (route.size() > 1 && route.back()->get_sharing_policy() == s4u::Link::SharingPolicy::WIFI) {
- dst_wifi_link = static_cast<NetworkWifiLink*>(route.back());
+ dst_wifi_link = static_cast<WifiLinkImpl*>(route.back());
}
/* WI-FI links needs special treatment, do it here */
}
NetworkCm02Action* NetworkCm02Model::comm_action_create(s4u::Host* src, s4u::Host* dst, double size,
- const std::vector<LinkImpl*>& route, bool failed)
+ const std::vector<StandardLinkImpl*>& route, bool failed)
{
- NetworkWifiLink* src_wifi_link = nullptr;
- NetworkWifiLink* dst_wifi_link = nullptr;
+ WifiLinkImpl* src_wifi_link = nullptr;
+ WifiLinkImpl* dst_wifi_link = nullptr;
/* many checks related to Wi-Fi links */
if (not route.empty() && route.front()->get_sharing_policy() == s4u::Link::SharingPolicy::WIFI) {
- src_wifi_link = static_cast<NetworkWifiLink*>(route.front());
+ src_wifi_link = static_cast<WifiLinkImpl*>(route.front());
xbt_assert(src_wifi_link->get_host_rate(src) != -1,
"The route from %s to %s begins with the WIFI link %s, but the host %s does not seem attached to that "
"WIFI link. Did you call link->set_host_rate()?",
src->get_cname(), dst->get_cname(), src_wifi_link->get_cname(), src->get_cname());
}
if (route.size() > 1 && route.back()->get_sharing_policy() == s4u::Link::SharingPolicy::WIFI) {
- dst_wifi_link = static_cast<NetworkWifiLink*>(route.back());
+ dst_wifi_link = static_cast<WifiLinkImpl*>(route.back());
xbt_assert(dst_wifi_link->get_host_rate(dst) != -1,
"The route from %s to %s ends with the WIFI link %s, but the host %s does not seem attached to that "
"WIFI link. Did you call link->set_host_rate()?",
if (src_wifi_link == nullptr && dst_wifi_link == nullptr)
action = new NetworkCm02Action(this, *src, *dst, size, failed);
else
- action = new NetworkWifiAction(this, *src, *dst, size, failed, src_wifi_link, dst_wifi_link);
+ action = new WifiLinkAction(this, *src, *dst, size, failed, src_wifi_link, dst_wifi_link);
if (is_update_lazy()) {
action->set_last_update();
}
bool NetworkCm02Model::comm_get_route_info(const s4u::Host* src, const s4u::Host* dst, double& latency,
- std::vector<LinkImpl*>& route, std::vector<LinkImpl*>& back_route,
+ std::vector<StandardLinkImpl*>& route,
+ std::vector<StandardLinkImpl*>& back_route,
std::unordered_set<kernel::routing::NetZoneImpl*>& netzones) const
{
kernel::routing::NetZoneImpl::get_global_route_with_netzones(src->get_netpoint(), dst->get_netpoint(), route,
"You're trying to send data from %s to %s but there is no connecting path between these two hosts.",
src->get_cname(), dst->get_cname());
- bool failed = std::any_of(route.begin(), route.end(), [](const LinkImpl* link) { return not link->is_on(); });
+ bool failed = std::any_of(route.begin(), route.end(), [](const StandardLinkImpl* link) { return not link->is_on(); });
if (cfg_crosstraffic) {
dst->route_to(src, back_route, nullptr);
if (not failed)
- failed =
- std::any_of(back_route.begin(), back_route.end(), [](const LinkImpl* link) { return not link->is_on(); });
+ failed = std::any_of(back_route.begin(), back_route.end(),
+ [](const StandardLinkImpl* link) { return not link->is_on(); });
}
return failed;
}
void NetworkCm02Model::comm_action_set_bounds(const s4u::Host* src, const s4u::Host* dst, double size,
- NetworkCm02Action* action, const std::vector<LinkImpl*>& route,
+ NetworkCm02Action* action, const std::vector<StandardLinkImpl*>& route,
const std::unordered_set<kernel::routing::NetZoneImpl*>& netzones,
double rate)
{
/* transform data to user structures if necessary */
if (lat_factor_cb_ || bw_factor_cb_) {
- std::for_each(route.begin(), route.end(), [&s4u_route](LinkImpl* l) { s4u_route.push_back(l->get_iface()); });
+ std::for_each(route.begin(), route.end(),
+ [&s4u_route](StandardLinkImpl* l) { s4u_route.push_back(l->get_iface()); });
std::for_each(netzones.begin(), netzones.end(),
[&s4u_netzones](kernel::routing::NetZoneImpl* n) { s4u_netzones.insert(n->get_iface()); });
}
}
}
-void NetworkCm02Model::comm_action_set_variable(NetworkCm02Action* action, const std::vector<LinkImpl*>& route,
- const std::vector<LinkImpl*>& back_route)
+void NetworkCm02Model::comm_action_set_variable(NetworkCm02Action* action, const std::vector<StandardLinkImpl*>& route,
+ const std::vector<StandardLinkImpl*>& back_route)
{
size_t constraints_per_variable = route.size();
constraints_per_variable += back_route.size();
Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate)
{
double latency = 0.0;
- std::vector<LinkImpl*> back_route;
- std::vector<LinkImpl*> route;
+ std::vector<StandardLinkImpl*> back_route;
+ std::vector<StandardLinkImpl*> route;
std::unordered_set<kernel::routing::NetZoneImpl*> netzones;
XBT_IN("(%s,%s,%g,%g)", src->get_cname(), dst->get_cname(), size, rate);
action->latency_ = latency;
if (sg_weight_S_parameter > 0) {
- action->sharing_penalty_ =
- std::accumulate(route.begin(), route.end(), action->sharing_penalty_, [](double total, LinkImpl* const& link) {
- return total + sg_weight_S_parameter / link->get_bandwidth();
- });
+ action->sharing_penalty_ = std::accumulate(route.begin(), route.end(), action->sharing_penalty_,
+ [](double total, StandardLinkImpl* const& link) {
+ return total + sg_weight_S_parameter / link->get_bandwidth();
+ });
}
/* setting bandwidth and latency bounds considering route and configured bw/lat factors */
* Resource *
************/
NetworkCm02Link::NetworkCm02Link(const std::string& name, double bandwidth, kernel::lmm::System* system)
- : LinkImpl(name)
+ : StandardLinkImpl(name)
{
bandwidth_.scale = 1.0;
bandwidth_.peak = bandwidth;
get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(), (bandwidth_.peak * bandwidth_.scale));
- LinkImpl::on_bandwidth_change();
+ StandardLinkImpl::on_bandwidth_change();
if (sg_weight_S_parameter > 0) {
double delta = sg_weight_S_parameter / (bandwidth_.peak * bandwidth_.scale) -
#include <xbt/base.h>
-#include "network_interface.hpp"
#include "simgrid/kernel/resource/NetworkModelIntf.hpp"
+#include "src/kernel/resource/LinkImpl.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
#include "xbt/graph.h"
#include "xbt/string.hpp"
class NetworkCm02Model : public NetworkModel {
/** @brief Get route information (2-way) */
bool comm_get_route_info(const s4u::Host* src, const s4u::Host* dst, /* OUT */ double& latency,
- std::vector<LinkImpl*>& route, std::vector<LinkImpl*>& back_route,
+ std::vector<StandardLinkImpl*>& route, std::vector<StandardLinkImpl*>& back_route,
std::unordered_set<kernel::routing::NetZoneImpl*>& netzones) const;
/** @brief Create network action for this communication */
NetworkCm02Action* comm_action_create(s4u::Host* src, s4u::Host* dst, double size,
- const std::vector<LinkImpl*>& route, bool failed);
+ const std::vector<StandardLinkImpl*>& route, bool failed);
/** @brief Expand link contraint considering this new communication action */
void comm_action_expand_constraints(const s4u::Host* src, const s4u::Host* dst, const NetworkCm02Action* action,
- const std::vector<LinkImpl*>& route,
- const std::vector<LinkImpl*>& back_route) const;
+ const std::vector<StandardLinkImpl*>& route,
+ const std::vector<StandardLinkImpl*>& back_route) const;
/** @brief Set communication bounds for latency and bandwidth */
void comm_action_set_bounds(const s4u::Host* src, const s4u::Host* dst, double size, NetworkCm02Action* action,
- const std::vector<LinkImpl*>& route,
+ const std::vector<StandardLinkImpl*>& route,
const std::unordered_set<kernel::routing::NetZoneImpl*>& netzones, double rate);
/** @brief Create maxmin variable in communication action */
- void comm_action_set_variable(NetworkCm02Action* action, const std::vector<LinkImpl*>& route,
- const std::vector<LinkImpl*>& back_route);
+ void comm_action_set_variable(NetworkCm02Action* action, const std::vector<StandardLinkImpl*>& route,
+ const std::vector<StandardLinkImpl*>& back_route);
public:
explicit NetworkCm02Model(const std::string& name);
- LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths) final;
- LinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bandwidths) override;
+ StandardLinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths) final;
+ StandardLinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bandwidths) override;
void update_actions_state_lazy(double now, double delta) override;
void update_actions_state_full(double now, double delta) override;
Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
* Resource *
************/
-class NetworkCm02Link : public LinkImpl {
+class NetworkCm02Link : public StandardLinkImpl {
public:
NetworkCm02Link(const std::string& name, double bandwidth, lmm::System* system);
void apply_event(kernel::profile::Event* event, double value) override;
namespace kernel {
namespace resource {
-LinkImpl* NetworkConstantModel::create_link(const std::string& name, const std::vector<double>& /*bandwidth*/)
+StandardLinkImpl* NetworkConstantModel::create_link(const std::string& name, const std::vector<double>& /*bandwidth*/)
{
xbt_die("Refusing to create the link %s: there is no link in the Constant network model. "
"Please remove any link from your platform (and switch to routing='None')",
return nullptr;
}
-LinkImpl* NetworkConstantModel::create_wifi_link(const std::string& name, const std::vector<double>& bandwidths)
+StandardLinkImpl* NetworkConstantModel::create_wifi_link(const std::string& name, const std::vector<double>& bandwidths)
{
return create_link(name, bandwidths);
}
#ifndef NETWORK_CONSTANT_HPP_
#define NETWORK_CONSTANT_HPP_
-#include "network_interface.hpp"
+#include "src/kernel/resource/LinkImpl.hpp"
namespace simgrid {
namespace kernel {
double next_occurring_event(double now) override;
void update_actions_state(double now, double delta) override;
- LinkImpl* create_link(const std::string& name, const std::vector<double>& bws) override;
- LinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bws) override;
+ StandardLinkImpl* create_link(const std::string& name, const std::vector<double>& bws) override;
+ StandardLinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bws) override;
};
class NetworkConstantAction final : public NetworkAction {
static void routeCreation_cb(bool symmetrical, simgrid::kernel::routing::NetPoint* src,
simgrid::kernel::routing::NetPoint* dst, simgrid::kernel::routing::NetPoint* /*gw_src*/,
simgrid::kernel::routing::NetPoint* /*gw_dst*/,
- std::vector<simgrid::kernel::resource::LinkImpl*> const& link_list)
+ std::vector<simgrid::kernel::resource::StandardLinkImpl*> const& link_list)
{
/* ignoring routes from StarZone, not supported */
if (not src || not dst)
s4u::NetZone::on_seal_cb(&zoneCreation_cb);
}
-LinkImpl* NetworkNS3Model::create_link(const std::string& name, const std::vector<double>& bandwidths)
+StandardLinkImpl* NetworkNS3Model::create_link(const std::string& name, const std::vector<double>& bandwidths)
{
xbt_assert(bandwidths.size() == 1, "ns-3 links must use only 1 bandwidth.");
auto* link = new LinkNS3(name, bandwidths[0]);
return link;
}
-LinkImpl* NetworkNS3Model::create_wifi_link(const std::string& name, const std::vector<double>& bandwidths)
+StandardLinkImpl* NetworkNS3Model::create_wifi_link(const std::string& name, const std::vector<double>& bandwidths)
{
auto* link = create_link(name, bandwidths);
link->set_sharing_policy(s4u::Link::SharingPolicy::WIFI, {});
if (TRACE_is_enabled() && action->get_state() == kernel::resource::Action::State::STARTED) {
double data_delta_sent = sgFlow->sent_bytes_ - action->last_sent_;
- std::vector<LinkImpl*> route = std::vector<LinkImpl*>();
+ std::vector<StandardLinkImpl*> route = std::vector<StandardLinkImpl*>();
action->get_src().route_to(&action->get_dst(), route, nullptr);
for (auto const& link : route)
* Resource *
************/
-LinkNS3::LinkNS3(const std::string& name, double bandwidth) : LinkImpl(name)
+LinkNS3::LinkNS3(const std::string& name, double bandwidth) : StandardLinkImpl(name)
{
bandwidth_.peak = bandwidth;
}
THROW_UNIMPLEMENTED;
}
-std::list<LinkImpl*> NetworkNS3Action::get_links() const
+std::list<StandardLinkImpl*> NetworkNS3Action::get_links() const
{
THROW_UNIMPLEMENTED;
}
#include "xbt/base.h"
-#include "network_interface.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
namespace simgrid {
namespace kernel {
class NetworkNS3Model : public NetworkModel {
public:
explicit NetworkNS3Model(const std::string& name);
- LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidth) override;
- LinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bandwidth) override;
+ StandardLinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidth) override;
+ StandardLinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bandwidth) override;
Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
double next_occurring_event(double now) override;
bool next_occurring_event_is_idempotent() override { return false; }
/************
* Resource *
************/
-class LinkNS3 : public LinkImpl {
+class LinkNS3 : public StandardLinkImpl {
public:
explicit LinkNS3(const std::string& name, double bandwidth);
~LinkNS3() override;
void suspend() override;
void resume() override;
- std::list<LinkImpl*> get_links() const override;
+ std::list<StandardLinkImpl*> get_links() const override;
void update_remains_lazy(double now) override;
// private:
continue;
double lat = 0.0;
- std::vector<LinkImpl*> route;
+ std::vector<StandardLinkImpl*> route;
hostList_[k / host_list.size()]->route_to(hostList_[k % host_list.size()], route, &lat);
latency = std::max(latency, lat);
for (size_t k = 0; k < host_list.size() * host_list.size(); k++) {
if (bytes_amount[k] <= 0.0)
continue;
- std::vector<LinkImpl*> route;
+ std::vector<StandardLinkImpl*> route;
hostList_[k / host_list.size()]->route_to(hostList_[k % host_list.size()], route, nullptr);
for (auto const& link : route)
return (new CpuL07(host, speed_per_pstate))->set_model(this);
}
-LinkImpl* NetworkL07Model::create_link(const std::string& name, const std::vector<double>& bandwidths)
+StandardLinkImpl* NetworkL07Model::create_link(const std::string& name, const std::vector<double>& bandwidths)
{
xbt_assert(bandwidths.size() == 1, "Non WIFI link must have only 1 bandwidth.");
auto link = new LinkL07(name, bandwidths[0], get_maxmin_system());
return link;
}
-LinkImpl* NetworkL07Model::create_wifi_link(const std::string& name, const std::vector<double>& bandwidths)
+StandardLinkImpl* NetworkL07Model::create_wifi_link(const std::string& name, const std::vector<double>& bandwidths)
{
THROW_UNIMPLEMENTED;
}
CpuImpl::on_speed_change();
}
-LinkL07::LinkL07(const std::string& name, double bandwidth, lmm::System* system) : LinkImpl(name)
+LinkL07::LinkL07(const std::string& name, double bandwidth, lmm::System* system) : StandardLinkImpl(name)
{
this->set_constraint(system->constraint_new(this, bandwidth));
bandwidth_.peak = bandwidth;
void LinkL07::set_bandwidth(double value)
{
bandwidth_.peak = value;
- LinkImpl::on_bandwidth_change();
+ StandardLinkImpl::on_bandwidth_change();
get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(), bandwidth_.peak * bandwidth_.scale);
}
for (size_t j = 0; j < host_count; j++) {
if (communicationAmount_[i * host_count + j] > 0) {
double lat = 0.0;
- std::vector<LinkImpl*> route;
+ std::vector<StandardLinkImpl*> route;
hostList_.at(i)->route_to(hostList_.at(j), route, &lat);
lat_current = std::max(lat_current, lat * communicationAmount_[i * host_count + j]);
NetworkL07Model(const NetworkL07Model&) = delete;
NetworkL07Model& operator=(const NetworkL07Model&) = delete;
~NetworkL07Model() override;
- LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths) final;
- LinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bandwidths) override;
+ StandardLinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths) final;
+ StandardLinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bandwidths) override;
Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
void update_actions_state(double /*now*/, double /*delta*/) override{
void on_speed_change() override;
};
-class LinkL07 : public LinkImpl {
+class LinkL07 : public StandardLinkImpl {
public:
LinkL07(const std::string& name, double bandwidth, lmm::System* system);
LinkL07(const LinkL07&) = delete;
#include <simgrid/s4u/Engine.hpp>
#include "src/kernel/resource/CpuImpl.hpp"
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/LinkImpl.hpp"
#include "src/surf/surf_interface.hpp"
#include "src/surf/xml/platf.hpp"
#include "src/surf/xml/platf_private.hpp"
#include <xbt/parse_units.hpp>
#include "simgrid/sg_config.hpp"
+#include "src/kernel/resource/LinkImpl.hpp"
#include "src/kernel/resource/profile/FutureEvtSet.hpp"
#include "src/kernel/resource/profile/Profile.hpp"
-#include "src/surf/network_interface.hpp"
#include "src/surf/surf_interface.hpp"
#include "src/surf/xml/platf.hpp"
#include "src/surf/xml/platf_private.hpp"
#include "xbt/config.hpp"
#include "xbt/log.h"
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/WifiLinkImpl.hpp"
XBT_LOG_NEW_DEFAULT_CATEGORY(simulator, "[usage] wifi_usage <platform-file>");
#include "xbt/config.hpp"
#include "xbt/log.h"
-#include "src/surf/network_wifi.hpp"
+#include "src/kernel/resource/WifiLinkImpl.hpp"
XBT_LOG_NEW_DEFAULT_CATEGORY(simulator, "[usage] wifi_usage <platform-file>");
});
simgrid::s4u::Actor::create("receiver", simgrid::s4u::Host::by_name(dest),
[mailbox]() { mailbox->get<std::string>(); });
- auto* l = (simgrid::kernel::resource::NetworkWifiLink*)simgrid::s4u::Link::by_name("AP1")->get_impl();
+ auto* l = (simgrid::kernel::resource::WifiLinkImpl*)simgrid::s4u::Link::by_name("AP1")->get_impl();
if (not l->toggle_decay_model())
l->toggle_decay_model();
l->set_host_rate(simgrid::s4u::Host::by_name("Station 1"), 0);
#include "simgrid/s4u/Engine.hpp"
#include "simgrid/s4u/Host.hpp"
#include "simgrid/s4u/Link.hpp"
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
#include <algorithm>
#include <cstring>
for (auto src_host : hosts) { // Routes from host
const simgrid::kernel::routing::NetPoint* src = src_host->get_netpoint();
for (auto dst_host : hosts) { // Routes to host
- std::vector<simgrid::kernel::resource::LinkImpl*> route;
+ std::vector<simgrid::kernel::resource::StandardLinkImpl*> route;
const simgrid::kernel::routing::NetPoint* dst = dst_host->get_netpoint();
simgrid::kernel::routing::NetZoneImpl::get_global_route(src, dst, route, nullptr);
if (route.empty())
if (not dst->is_router())
continue;
std::printf(" <route src=\"%s\" dst=\"%s\">\n ", src_host->get_cname(), dst->get_cname());
- std::vector<simgrid::kernel::resource::LinkImpl*> route;
+ std::vector<simgrid::kernel::resource::StandardLinkImpl*> route;
simgrid::kernel::routing::NetZoneImpl::get_global_route(src, dst, route, nullptr);
for (auto const& link : route)
std::printf("<link_ctn id=\"%s\"/>", link->get_cname());
for (auto const& value2 : netpoints) { // to router
if (not value2->is_router())
continue;
- std::vector<simgrid::kernel::resource::LinkImpl*> route;
+ std::vector<simgrid::kernel::resource::StandardLinkImpl*> route;
simgrid::kernel::routing::NetZoneImpl::get_global_route(value1, value2, route, nullptr);
if (route.empty())
continue;
}
for (auto dst_host : hosts) { // Routes to host
std::printf(" <route src=\"%s\" dst=\"%s\">\n ", value1->get_cname(), dst_host->get_cname());
- std::vector<simgrid::kernel::resource::LinkImpl*> route;
+ std::vector<simgrid::kernel::resource::StandardLinkImpl*> route;
const simgrid::kernel::routing::NetPoint* netcardDst = dst_host->get_netpoint();
simgrid::kernel::routing::NetZoneImpl::get_global_route(value1, netcardDst, route, nullptr);
for (auto const& link : route)
#include "simgrid/zone.h"
#include "src/kernel/EngineImpl.hpp"
#include "src/kernel/resource/CpuImpl.hpp"
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/LinkImpl.hpp"
#include "xbt/config.hpp"
XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, "Messages specific for surf example");
#include "simgrid/zone.h"
#include "src/kernel/EngineImpl.hpp"
#include "src/kernel/resource/CpuImpl.hpp"
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/LinkImpl.hpp"
#include "src/surf/surf_interface.hpp"
#include "xbt/config.hpp"
src/include/xbt/xbt_modinter.h
src/include/catch.hpp
src/include/xxhash.hpp
+ src/kernel/resource/LinkImpl.hpp
+ src/kernel/resource/SplitDuplexLinkImpl.hpp
+ src/kernel/resource/StandardLinkImpl.hpp
+ src/kernel/resource/WifiLinkImpl.hpp
src/mc/mc_mmu.hpp
src/mc/mc_record.hpp
src/msg/msg_private.hpp
src/surf/cpu_ti.hpp
src/surf/network_cm02.hpp
src/surf/network_constant.hpp
- src/surf/network_interface.hpp
- src/surf/LinkImpl.hpp
- src/surf/LinkImplIntf.hpp
- src/surf/SplitDuplexLinkImpl.hpp
src/surf/network_ns3.hpp
src/surf/network_smpi.hpp
src/surf/network_ib.hpp
- src/surf/network_wifi.hpp
src/surf/ns3/ns3_simulator.hpp
src/surf/xml/simgrid.dtd
src/surf/xml/simgrid_dtd.h
src/kernel/resource/DiskImpl.hpp
src/kernel/resource/Model.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
src/kernel/resource/VirtualMachineImpl.cpp
+ src/kernel/resource/WifiLinkImpl.cpp
src/kernel/resource/profile/DatedValue.cpp
src/kernel/resource/profile/DatedValue.hpp
src/surf/disk_s19.cpp
src/surf/network_cm02.cpp
src/surf/network_constant.cpp
- src/surf/network_interface.cpp
- src/surf/LinkImpl.cpp
- src/surf/SplitDuplexLinkImpl.cpp
- src/surf/network_wifi.cpp
src/surf/sg_platf.cpp
src/surf/surf_interface.cpp
src/surf/xml/platf.hpp
# New tests should use the Catch Framework
set(UNIT_TESTS src/xbt/unit-tests_main.cpp
src/kernel/resource/NetworkModelIntf_test.cpp
+ src/kernel/resource/SplitDuplexLinkImpl_test.cpp
src/kernel/resource/profile/Profile_test.cpp
src/kernel/routing/DijkstraZone_test.cpp
src/kernel/routing/DragonflyZone_test.cpp
src/kernel/routing/FullZone_test.cpp
src/kernel/routing/StarZone_test.cpp
src/kernel/routing/TorusZone_test.cpp
- src/surf/SplitDuplexLinkImpl_test.cpp
src/xbt/config_test.cpp
src/xbt/dict_test.cpp
src/xbt/dynar_test.cpp