Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
- Add wifi link
authorLoic Guegan <manzerberdes@gmx.com>
Thu, 4 Jul 2019 12:55:33 +0000 (14:55 +0200)
committerLoic Guegan <manzerberdes@gmx.com>
Thu, 4 Jul 2019 12:55:33 +0000 (14:55 +0200)
- Change "bandwith" to "bandwidth"

src/surf/link_wifi.cpp [new file with mode: 0644]
src/surf/link_wifi.hpp [new file with mode: 0644]
src/surf/network_cm02.cpp
tools/cmake/DefinePackages.cmake

diff --git a/src/surf/link_wifi.cpp b/src/surf/link_wifi.cpp
new file mode 100644 (file)
index 0000000..761feaa
--- /dev/null
@@ -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 (file)
index 0000000..9a64350
--- /dev/null
@@ -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<xbt::string, int> 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
index 68bba70..7a47fa4 100644 (file)
@@ -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});
   }
 }
 
index 11bd51d..858fabc 100644 (file)
@@ -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