From d243290d592d5291708a45ea34c1dfc8d232ef4b Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Thu, 4 Jul 2019 14:55:33 +0200 Subject: [PATCH 1/1] - Add wifi link - Change "bandwith" to "bandwidth" --- src/surf/link_wifi.cpp | 18 +++++++++++++++++ src/surf/link_wifi.hpp | 33 ++++++++++++++++++++++++++++++++ src/surf/network_cm02.cpp | 4 ++-- tools/cmake/DefinePackages.cmake | 1 + 4 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 src/surf/link_wifi.cpp create mode 100644 src/surf/link_wifi.hpp diff --git a/src/surf/link_wifi.cpp b/src/surf/link_wifi.cpp new file mode 100644 index 0000000000..761feaa61f --- /dev/null +++ b/src/surf/link_wifi.cpp @@ -0,0 +1,18 @@ +/* Copyright (c) 2013-2019. 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. */ + +#include "src/surf/link_wifi.hpp" + +namespace simgrid { +namespace kernel { +namespace resource { + +void NetworkWifiLink::set_host_rate(sg_host_t host, int rate_level) +{ + host_rates.insert(std::make_pair(host->get_name(), rate_level)); +} +} // namespace resource +} // namespace kernel +} // namespace simgrid diff --git a/src/surf/link_wifi.hpp b/src/surf/link_wifi.hpp new file mode 100644 index 0000000000..9a64350263 --- /dev/null +++ b/src/surf/link_wifi.hpp @@ -0,0 +1,33 @@ +/* Copyright (c) 2013-2019. 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 SURF_LINK_WIFI_HPP_ +#define SURF_LINK_WIFI_HPP_ + +#include "network_cm02.hpp" +#include "network_interface.hpp" +#include "src/surf/HostImpl.hpp" +#include "xbt/string.hpp" + +namespace simgrid { +namespace kernel { +namespace resource { + +class NetworkWifiLink : public NetworkCm02Link { + /** @brief Hold every rates association between host and links (host name, rates id) */ + std::map host_rates; + + /** @brief Hold every rates available for this Access Point */ + double* rates; + +public: + void set_host_rate(sg_host_t host, int rate_level); +}; + +} // namespace resource +} // namespace kernel +} // namespace simgrid + +#endif diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index 68bba7058f..7a47fa4c00 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -272,8 +272,8 @@ NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const std::string& nam : NetworkCm02Link(model, name, 0, 0, policy, system) { /* Setup Metrics for bandwidths_ */ - for (auto bandwith : bandwidths) { - bandwidths_.push_back({bandwith, 1.0, nullptr}); + for (auto bandwidth : bandwidths) { + bandwidths_.push_back({bandwidth, 1.0, nullptr}); } } diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 11bd51d1e2..858fabc538 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -340,6 +340,7 @@ set(SURF_SRC src/surf/cpu_interface.cpp src/surf/cpu_ti.cpp src/surf/network_cm02.cpp + src/surf/link_wifi.cpp src/surf/network_constant.cpp src/surf/network_interface.cpp src/surf/PropertyHolder.cpp -- 2.20.1