Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' into disk
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 6 Sep 2019 15:22:14 +0000 (17:22 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 6 Sep 2019 15:22:14 +0000 (17:22 +0200)
16 files changed:
examples/platforms/wifi/1STA-1LINK-1NODE.xml [new file with mode: 0755]
examples/platforms/wifi/2STA.xml [new file with mode: 0755]
src/kernel/activity/SleepImpl.cpp
src/kernel/actor/ActorImpl.cpp
src/kernel/actor/ActorImpl.hpp
src/plugins/vm/VirtualMachineImpl.cpp
src/s4u/s4u_Actor.cpp
src/surf/network_cm02.cpp
teshsuite/surf/wifi_usage/1STA-1LINK-1NODE-CT.cpp [new file with mode: 0644]
teshsuite/surf/wifi_usage/1STA-1LINK-1NODE-CT.tesh [new file with mode: 0644]
teshsuite/surf/wifi_usage/1STA-1LINK-1NODE-NOCT.cpp [new file with mode: 0644]
teshsuite/surf/wifi_usage/1STA-1LINK-1NODE-NOCT.tesh [new file with mode: 0644]
teshsuite/surf/wifi_usage/2STA-CT.cpp [new file with mode: 0644]
teshsuite/surf/wifi_usage/2STA-CT.tesh [new file with mode: 0644]
teshsuite/surf/wifi_usage/2STA-NOCT.cpp [new file with mode: 0644]
teshsuite/surf/wifi_usage/2STA-NOCT.tesh [new file with mode: 0644]

diff --git a/examples/platforms/wifi/1STA-1LINK-1NODE.xml b/examples/platforms/wifi/1STA-1LINK-1NODE.xml
new file mode 100755 (executable)
index 0000000..5bde693
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version='1.0'?>
+
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
+<platform version="4.1">
+  <AS id="AS0" routing="Full">
+
+    <!-- WIFI cell -->
+       <AS id="AS_AP1" routing="Cluster">
+      <host id="STA1" speed="100.0Mf,50.0Mf,20.0Mf">
+      </host>
+      <router id="AP1_ROUTER"/>     
+
+      <!-- Access Point -->
+         <link id="AP1" sharing_policy="WIFI" bandwidth="54Mbps" latency="0ms">
+         </link>
+         
+      <host_link id="STA1" up="AP1" down="AP1"/>
+       </AS>
+
+
+    <!-- NODE1 AS -->
+       <AS id="AS1" routing="Full">
+      <host id="NODE1" speed="100.0Mf,50.0Mf,20.0Mf">
+      </host>
+       </AS>
+    
+
+    <!-- AS Routing -->
+    <link id="LINK1" sharing_policy="SHARED" bandwidth="100Mbps" latency="0ms">
+       </link>
+    <ASroute src="AS_AP1" dst="AS1" gw_src="AP1_ROUTER" gw_dst="NODE1">
+      <link_ctn id="LINK1" />
+    </ASroute>
+    
+  </AS>
+</platform>
diff --git a/examples/platforms/wifi/2STA.xml b/examples/platforms/wifi/2STA.xml
new file mode 100755 (executable)
index 0000000..03ba04c
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version='1.0'?>
+
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
+<platform version="4.1">
+       <AS id="AS0" routing="Cluster">
+      <host id="STA1" speed="100.0Mf,50.0Mf,20.0Mf">
+      </host>
+      <host id="STA2" speed="100.0Mf,50.0Mf,20.0Mf">
+      </host>
+      <router id="AP1_ROUTER"/>
+
+     
+      <!-- Access Point -->
+         <link id="AP1" sharing_policy="WIFI" bandwidth="54Mbps" latency="0ms">
+         </link>
+         
+      <host_link id="STA1" up="AP1" down="AP1"/>
+      <host_link id="STA2" up="AP1" down="AP1"/>
+            
+       </AS>
+</platform>
index e20cdf7..dc94cff 100644 (file)
@@ -62,7 +62,7 @@ void SleepImpl::finish()
     if (simcall->issuer_->is_suspended()) {
       XBT_DEBUG("Wait! This process is suspended and can't wake up now.");
       simcall->issuer_->suspended_ = false;
-      simcall->issuer_->suspend(simcall->issuer_);
+      simcall->issuer_->suspend();
     } else {
       simcall->issuer_->simcall_answer();
     }
index e57a46e..4c83228 100644 (file)
@@ -297,7 +297,7 @@ void ActorImpl::yield()
 
     xbt_assert(exception_ == nullptr, "Gasp! This exception may be lost by subsequent calls.");
     suspended_ = false;
-    suspend(this);
+    suspend();
   }
 
   if (exception_ != nullptr) {
@@ -357,7 +357,7 @@ s4u::Actor* ActorImpl::restart()
   return actor->ciface();
 }
 
-void ActorImpl::suspend(ActorImpl* issuer)
+void ActorImpl::suspend()
 {
   if (suspended_) {
     XBT_DEBUG("Actor '%s' is already suspended", get_cname());
index a560305..d0c75f2 100644 (file)
@@ -123,7 +123,7 @@ public:
   void daemonize();
   bool is_suspended() { return suspended_; }
   s4u::Actor* restart();
-  void suspend(ActorImpl* issuer);
+  void suspend();
   void resume();
   activity::ActivityImplPtr join(ActorImpl* actor, double timeout);
   activity::ActivityImplPtr sleep(double duration);
index b7b2002..deecf72 100644 (file)
@@ -185,7 +185,7 @@ void VirtualMachineImpl::suspend(smx_actor_t issuer)
 
   for (auto& smx_process : process_list_) {
     XBT_DEBUG("suspend %s", smx_process.get_cname());
-    smx_process.suspend(issuer);
+    smx_process.suspend();
   }
 
   XBT_DEBUG("suspend all processes on the VM done done");
index 360cc93..5f75e2a 100644 (file)
@@ -190,7 +190,7 @@ void Actor::suspend()
   auto target = pimpl_;
   s4u::Actor::on_suspend(*this);
   kernel::actor::simcall_blocking<void>([issuer, target]() {
-    target->suspend(issuer);
+    target->suspend();
     if (target != issuer) {
       /* If we are suspending ourselves, then just do not finish the simcall now */
       issuer->simcall_answer();
@@ -441,7 +441,9 @@ Host* get_host()
 
 void suspend()
 {
-  SIMIX_process_self()->iface()->suspend();
+  kernel::actor::ActorImpl* self = SIMIX_process_self();
+  s4u::Actor::on_suspend(*self->ciface());
+  kernel::actor::simcall_blocking<void>([self] { self->suspend(); });
 }
 
 void resume()
index 8ef0680..9945dbd 100644 (file)
@@ -239,25 +239,18 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
   for (auto const& link : route) {
     // Handle WIFI links
     if (link->get_sharing_policy() == s4u::Link::SharingPolicy::WIFI) {
-      xbt_assert(!cfg_crosstraffic,
-                 "Cross-traffic is not yet supported when using WIFI. Please use --cfg=network/crosstraffic:0");
       NetworkWifiLink* wifi_link = static_cast<NetworkWifiLink*>(link);
 
       double src_rate = wifi_link->get_host_rate(src);
       double dst_rate = wifi_link->get_host_rate(dst);
-
-      // TODO: What do to when src and dst are on the same AP ? (for the moment we use src rate)
-      if (src_rate != -1 && dst_rate != -1) {
+      xbt_assert(
+          !(src_rate == -1 && dst_rate == -1),
+          "Some Stations are not associated to any Access Point. Make sure to call set_host_rate on all Stations.");
+      if (src_rate != -1)
         get_maxmin_system()->expand(link->get_constraint(), action->get_variable(), 1.0 / src_rate);
-      } else {
-        xbt_assert(
-            !(src_rate == -1 && dst_rate == -1),
-            "Some Stations are not associated to any Access Point. Make sure to call set_host_rate on all Stations.");
-        if (src_rate != -1)
-          get_maxmin_system()->expand(link->get_constraint(), action->get_variable(), 1.0 / src_rate);
-        else
-          get_maxmin_system()->expand(link->get_constraint(), action->get_variable(), 1.0 / dst_rate);
-      }
+      else
+        get_maxmin_system()->expand(link->get_constraint(), action->get_variable(), 1.0 / dst_rate);
+
     } else {
       get_maxmin_system()->expand(link->get_constraint(), action->get_variable(), 1.0);
     }
@@ -265,8 +258,27 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
 
   if (cfg_crosstraffic) {
     XBT_DEBUG("Crosstraffic active: adding backward flow using 5%% of the available bandwidth");
-    for (auto const& link : back_route)
-      get_maxmin_system()->expand(link->get_constraint(), action->get_variable(), .05);
+    bool wifi_dst_assigned = false; // Used by wifi crosstraffic
+    for (auto const& link : back_route) {
+      if (link->get_sharing_policy() == s4u::Link::SharingPolicy::WIFI) {
+        NetworkWifiLink* wifi_link = static_cast<NetworkWifiLink*>(link);
+        /**
+         * For wifi links we should add 0.05/rate.
+         * However since we are using the "back_route" we should encounter in
+         * the first place the dst wifi link.
+         */
+        if (!wifi_dst_assigned && (wifi_link->get_host_rate(dst) != -1)) {
+          get_maxmin_system()->expand(link->get_constraint(), action->get_variable(),
+                                      .05 / wifi_link->get_host_rate(dst));
+          wifi_dst_assigned = true;
+        } else {
+          get_maxmin_system()->expand(link->get_constraint(), action->get_variable(),
+                                      .05 / wifi_link->get_host_rate(src));
+        }
+      } else {
+        get_maxmin_system()->expand(link->get_constraint(), action->get_variable(), .05);
+      }
+    }
 
     // Change concurrency_share here, if you want that cross-traffic is included in the SURF concurrency
     // (You would also have to change simgrid::kernel::lmm::Element::get_concurrency())
diff --git a/teshsuite/surf/wifi_usage/1STA-1LINK-1NODE-CT.cpp b/teshsuite/surf/wifi_usage/1STA-1LINK-1NODE-CT.cpp
new file mode 100644 (file)
index 0000000..5ebe484
--- /dev/null
@@ -0,0 +1,74 @@
+/* Copyright (c) 2017-2018. 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 "simgrid/s4u.hpp"
+#include "xbt/log.h"
+
+#include "simgrid/msg.h"
+#include "src/surf/network_cm02.hpp"
+#include <exception>
+#include <iostream>
+#include <random>
+#include <string>
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(simulator, "[wifi_usage] 1STA-1LINK-1NODE-CT");
+
+void setup_simulation();
+static void flowActor(std::vector<std::string> args);
+
+/**
+ * Theory says:
+ *   - AP1 is the most constraint constraint
+ *   - When two STA communicates on the same AP we have the following AP constraint:
+ *     1.05/r_STA1 * rho_STA1 <= 1
+ *   - Thus:
+ *      mu = 1 / [ 1/1 * 1.05/54Mbps ] = 51428571
+ *      simulation_time = 1000*8 / mu = 0.0001555556s
+ * BTW: SimGrid should give you: 0.000156s due to computation side effects
+ *
+ */
+int main(int argc, char** argv)
+{
+
+  // Build engine
+  simgrid::s4u::Engine engine(&argc, argv);
+  engine.load_platform(argv[1]);
+  setup_simulation();
+  engine.run();
+  XBT_INFO("Simulation took %fs", simgrid::s4u::Engine::get_clock());
+  return (0);
+}
+
+void setup_simulation()
+{
+
+  std::vector<std::string> args, noArgs;
+  args.push_back("NODE1");
+  args.push_back("1000");
+  simgrid::s4u::Actor::create("STA1", simgrid::s4u::Host::by_name("STA1"), flowActor, args);
+  simgrid::s4u::Actor::create("NODE1", simgrid::s4u::Host::by_name("NODE1"), flowActor, noArgs);
+  simgrid::kernel::resource::NetworkWifiLink* l =
+      (simgrid::kernel::resource::NetworkWifiLink*)simgrid::s4u::Link::by_name("AP1")->get_impl();
+  l->set_host_rate(simgrid::s4u::Host::by_name("STA1"), 0);
+}
+
+static void flowActor(std::vector<std::string> args)
+{
+  std::string selfName               = simgrid::s4u::this_actor::get_host()->get_name();
+  simgrid::s4u::Mailbox* selfMailbox = simgrid::s4u::Mailbox::by_name(simgrid::s4u::this_actor::get_host()->get_name());
+
+  if (args.size() > 0) { // We should send
+    simgrid::s4u::Mailbox* dstMailbox = simgrid::s4u::Mailbox::by_name(args.at(0));
+
+    int dataSize        = std::atoi(args.at(1).c_str());
+    double comStartTime = simgrid::s4u::Engine::get_clock();
+    dstMailbox->put(const_cast<char*>("message"), dataSize);
+    double comEndTime = simgrid::s4u::Engine::get_clock();
+    XBT_INFO("%s sent %d bytes to %s in %f seconds from %f to %f", selfName.c_str(), dataSize, args.at(0).c_str(),
+             comEndTime - comStartTime, comStartTime, comEndTime);
+  } else { // We should receive
+    selfMailbox->get();
+  }
+}
diff --git a/teshsuite/surf/wifi_usage/1STA-1LINK-1NODE-CT.tesh b/teshsuite/surf/wifi_usage/1STA-1LINK-1NODE-CT.tesh
new file mode 100644 (file)
index 0000000..8da4f52
--- /dev/null
@@ -0,0 +1,5 @@
+#!/usr/bin/env tesh
+
+$ ${bindir:=.}/1STA-1LINK-1NODE-CT ${platfdir}/wifi/1STA-1LINK-1NODE.xml
+> [STA1:STA1:(1) 0.000156] [simulator/INFO] STA1 sent 1000 bytes to NODE1 in 0.000156 seconds from 0.000000 to 0.000156
+> [0.000156] [simulator/INFO] Simulation took 0.000156s
diff --git a/teshsuite/surf/wifi_usage/1STA-1LINK-1NODE-NOCT.cpp b/teshsuite/surf/wifi_usage/1STA-1LINK-1NODE-NOCT.cpp
new file mode 100644 (file)
index 0000000..5d810fe
--- /dev/null
@@ -0,0 +1,74 @@
+/* Copyright (c) 2017-2018. 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 "simgrid/s4u.hpp"
+#include "xbt/log.h"
+
+#include "simgrid/msg.h"
+#include "src/surf/network_cm02.hpp"
+#include <exception>
+#include <iostream>
+#include <random>
+#include <string>
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(simulator, "[wifi_usage] 1STA-1LINK-1NODE");
+
+void setup_simulation();
+static void flowActor(std::vector<std::string> args);
+
+/**
+ * Theory says:
+ *   - AP1 is the most constraint constraint
+ *   - When two STA communicates on the same AP we have the following AP constraint:
+ *     1/r_STA1 * rho_STA1 <= 1
+ *   - Thus:
+ *      mu = 1 / [ 1/1 * 1/54Mbps ] = 5.4e+07
+ *      simulation_time = 1000*8 / mu = 0.0001481481s
+ *
+ */
+int main(int argc, char** argv)
+{
+
+  // Build engine
+  simgrid::s4u::Engine engine(&argc, argv);
+  engine.load_platform(argv[1]);
+  setup_simulation();
+  engine.run();
+  XBT_INFO("Simulation took %fs", simgrid::s4u::Engine::get_clock());
+
+  return (0);
+}
+
+void setup_simulation()
+{
+
+  std::vector<std::string> args, noArgs;
+  args.push_back("NODE1");
+  args.push_back("1000");
+  simgrid::s4u::Actor::create("STA1", simgrid::s4u::Host::by_name("STA1"), flowActor, args);
+  simgrid::s4u::Actor::create("NODE1", simgrid::s4u::Host::by_name("NODE1"), flowActor, noArgs);
+  simgrid::kernel::resource::NetworkWifiLink* l =
+      (simgrid::kernel::resource::NetworkWifiLink*)simgrid::s4u::Link::by_name("AP1")->get_impl();
+  l->set_host_rate(simgrid::s4u::Host::by_name("STA1"), 0);
+}
+
+static void flowActor(std::vector<std::string> args)
+{
+  std::string selfName               = simgrid::s4u::this_actor::get_host()->get_name();
+  simgrid::s4u::Mailbox* selfMailbox = simgrid::s4u::Mailbox::by_name(simgrid::s4u::this_actor::get_host()->get_name());
+
+  if (args.size() > 0) { // We should send
+    simgrid::s4u::Mailbox* dstMailbox = simgrid::s4u::Mailbox::by_name(args.at(0));
+
+    int dataSize        = std::atoi(args.at(1).c_str());
+    double comStartTime = simgrid::s4u::Engine::get_clock();
+    dstMailbox->put(const_cast<char*>("message"), dataSize);
+    double comEndTime = simgrid::s4u::Engine::get_clock();
+    XBT_INFO("%s sent %d bytes to %s in %f seconds from %f to %f", selfName.c_str(), dataSize, args.at(0).c_str(),
+             comEndTime - comStartTime, comStartTime, comEndTime);
+  } else { // We should receive
+    selfMailbox->get();
+  }
+}
diff --git a/teshsuite/surf/wifi_usage/1STA-1LINK-1NODE-NOCT.tesh b/teshsuite/surf/wifi_usage/1STA-1LINK-1NODE-NOCT.tesh
new file mode 100644 (file)
index 0000000..8e4a34c
--- /dev/null
@@ -0,0 +1,6 @@
+#!/usr/bin/env tesh
+
+$ ${bindir:=.}/1STA-1LINK-1NODE-NOCT ${platfdir}/wifi/1STA-1LINK-1NODE.xml --cfg=network/crosstraffic:0
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/crosstraffic' to '0'
+> [STA1:STA1:(1) 0.000148] [simulator/INFO] STA1 sent 1000 bytes to NODE1 in 0.000148 seconds from 0.000000 to 0.000148
+> [0.000148] [simulator/INFO] Simulation took 0.000148s
diff --git a/teshsuite/surf/wifi_usage/2STA-CT.cpp b/teshsuite/surf/wifi_usage/2STA-CT.cpp
new file mode 100644 (file)
index 0000000..be6b13d
--- /dev/null
@@ -0,0 +1,73 @@
+/* Copyright (c) 2017-2018. 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 "simgrid/msg.h"
+#include "simgrid/s4u.hpp"
+#include "src/surf/network_cm02.hpp"
+#include "xbt/log.h"
+#include <exception>
+#include <iostream>
+#include <random>
+#include <string>
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(simulator, "[wifi_usage] 2STA-1NODE");
+
+void setup_simulation();
+static void flowActor(std::vector<std::string> args);
+
+/**
+ * Theory says:
+ *   - When two STA communicates on the same AP we have the following AP constraint:
+ *     1.05/r_STA1 * rho_STA1 + 1.05/r_STA2 * rho_2 <= 1
+ *   - Thus:
+ *      mu = 1 / [ 1/2 * 1.05/54Mbps + 1.05/54Mbps ] =  51428571
+ *      simulation_time = 1000*8 / [ mu / 2 ] = 0.0003111111s
+ *
+ */
+int main(int argc, char** argv)
+{
+
+  // Build engine
+  simgrid::s4u::Engine engine(&argc, argv);
+  engine.load_platform(argv[1]);
+  setup_simulation();
+  engine.run();
+  XBT_INFO("Simulation took %fs", simgrid::s4u::Engine::get_clock());
+
+  return (0);
+}
+
+void setup_simulation()
+{
+
+  std::vector<std::string> args, noArgs;
+  args.push_back("STA2");
+  args.push_back("1000");
+  simgrid::s4u::Actor::create("STA1", simgrid::s4u::Host::by_name("STA1"), flowActor, args);
+  simgrid::s4u::Actor::create("STA2", simgrid::s4u::Host::by_name("STA2"), flowActor, noArgs);
+  simgrid::kernel::resource::NetworkWifiLink* l =
+      (simgrid::kernel::resource::NetworkWifiLink*)simgrid::s4u::Link::by_name("AP1")->get_impl();
+  l->set_host_rate(simgrid::s4u::Host::by_name("STA1"), 0);
+  l->set_host_rate(simgrid::s4u::Host::by_name("STA2"), 0);
+}
+
+static void flowActor(std::vector<std::string> args)
+{
+  std::string selfName               = simgrid::s4u::this_actor::get_host()->get_name();
+  simgrid::s4u::Mailbox* selfMailbox = simgrid::s4u::Mailbox::by_name(simgrid::s4u::this_actor::get_host()->get_name());
+
+  if (args.size() > 0) { // We should send
+    simgrid::s4u::Mailbox* dstMailbox = simgrid::s4u::Mailbox::by_name(args.at(0));
+
+    int dataSize        = std::atoi(args.at(1).c_str());
+    double comStartTime = simgrid::s4u::Engine::get_clock();
+    dstMailbox->put(const_cast<char*>("message"), dataSize);
+    double comEndTime = simgrid::s4u::Engine::get_clock();
+    XBT_INFO("%s sent %d bytes to %s in %f seconds from %f to %f", selfName.c_str(), dataSize, args.at(0).c_str(),
+             comEndTime - comStartTime, comStartTime, comEndTime);
+  } else { // We should receive
+    selfMailbox->get();
+  }
+}
diff --git a/teshsuite/surf/wifi_usage/2STA-CT.tesh b/teshsuite/surf/wifi_usage/2STA-CT.tesh
new file mode 100644 (file)
index 0000000..0fe49d3
--- /dev/null
@@ -0,0 +1,5 @@
+#!/usr/bin/env tesh
+
+$ ${bindir:=.}/2STA-CT ${platfdir}/wifi/2STA.xml
+> [STA1:STA1:(1) 0.000311] [simulator/INFO] STA1 sent 1000 bytes to STA2 in 0.000311 seconds from 0.000000 to 0.000311
+> [0.000311] [simulator/INFO] Simulation took 0.000311s
diff --git a/teshsuite/surf/wifi_usage/2STA-NOCT.cpp b/teshsuite/surf/wifi_usage/2STA-NOCT.cpp
new file mode 100644 (file)
index 0000000..d238dd6
--- /dev/null
@@ -0,0 +1,73 @@
+/* Copyright (c) 2017-2018. 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 "simgrid/msg.h"
+#include "simgrid/s4u.hpp"
+#include "src/surf/network_cm02.hpp"
+#include "xbt/log.h"
+#include <exception>
+#include <iostream>
+#include <random>
+#include <string>
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(simulator, "[wifi_usage] 2STA-1NODE");
+
+void setup_simulation();
+static void flowActor(std::vector<std::string> args);
+
+/**
+ * Theory says:
+ *   - When two STA communicates on the same AP we have the following AP constraint:
+ *     1/r_STA1 * rho_STA1 + 1/r_STA2 * rho_2 <= 1
+ *   - Thus:
+ *      mu = 1 / [ 1/2 * 1/54Mbps + 1/54Mbps ] = 5.4e+07
+ *      simulation_time = 1000*8 / [ mu / 2 ] = 0.0002962963s
+ *
+ */
+int main(int argc, char** argv)
+{
+
+  // Build engine
+  simgrid::s4u::Engine engine(&argc, argv);
+  engine.load_platform(argv[1]);
+  setup_simulation();
+  engine.run();
+  XBT_INFO("Simulation took %fs", simgrid::s4u::Engine::get_clock());
+
+  return (0);
+}
+
+void setup_simulation()
+{
+
+  std::vector<std::string> args, noArgs;
+  args.push_back("STA2");
+  args.push_back("1000");
+  simgrid::s4u::Actor::create("STA1", simgrid::s4u::Host::by_name("STA1"), flowActor, args);
+  simgrid::s4u::Actor::create("STA2", simgrid::s4u::Host::by_name("STA2"), flowActor, noArgs);
+  simgrid::kernel::resource::NetworkWifiLink* l =
+      (simgrid::kernel::resource::NetworkWifiLink*)simgrid::s4u::Link::by_name("AP1")->get_impl();
+  l->set_host_rate(simgrid::s4u::Host::by_name("STA1"), 0);
+  l->set_host_rate(simgrid::s4u::Host::by_name("STA2"), 0);
+}
+
+static void flowActor(std::vector<std::string> args)
+{
+  std::string selfName               = simgrid::s4u::this_actor::get_host()->get_name();
+  simgrid::s4u::Mailbox* selfMailbox = simgrid::s4u::Mailbox::by_name(simgrid::s4u::this_actor::get_host()->get_name());
+
+  if (args.size() > 0) { // We should send
+    simgrid::s4u::Mailbox* dstMailbox = simgrid::s4u::Mailbox::by_name(args.at(0));
+
+    int dataSize        = std::atoi(args.at(1).c_str());
+    double comStartTime = simgrid::s4u::Engine::get_clock();
+    dstMailbox->put(const_cast<char*>("message"), dataSize);
+    double comEndTime = simgrid::s4u::Engine::get_clock();
+    XBT_INFO("%s sent %d bytes to %s in %f seconds from %f to %f", selfName.c_str(), dataSize, args.at(0).c_str(),
+             comEndTime - comStartTime, comStartTime, comEndTime);
+  } else { // We should receive
+    selfMailbox->get();
+  }
+}
diff --git a/teshsuite/surf/wifi_usage/2STA-NOCT.tesh b/teshsuite/surf/wifi_usage/2STA-NOCT.tesh
new file mode 100644 (file)
index 0000000..064cce2
--- /dev/null
@@ -0,0 +1,6 @@
+#!/usr/bin/env tesh
+
+$ ${bindir:=.}/2STA-NOCT ${platfdir}/wifi/2STA.xml --cfg=network/crosstraffic:0
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/crosstraffic' to '0'
+> [STA1:STA1:(1) 0.000296] [simulator/INFO] STA1 sent 1000 bytes to STA2 in 0.000296 seconds from 0.000000 to 0.000296
+> [0.000296] [simulator/INFO] Simulation took 0.000296s