write->wait();
XBT_INFO(" Total : %.6f seconds", sg4::Engine::get_clock() - clock);
-
XBT_INFO("[Bob -> Alice] Streaming (Read bottleneck)");
clock = sg4::Engine::get_clock();
sg4::Io::streamto(bob, bob_disk, alice, alice_disk, size);
clock = sg4::Engine::get_clock();
sg4::Io::streamto(alice, alice_disk, bob, bob_disk, size);
XBT_INFO(" Total : %.6f seconds", sg4::Engine::get_clock() - clock);
+
+ XBT_INFO("Start two 10-second background traffic between Bob and Alice");
+ sg4::CommPtr bt1 = sg4::Comm::sendto_async(bob, alice, 2e7);
+ XBT_INFO("[Bob -> Alice] Streaming (Transfer bottleneck)");
+ clock = sg4::Engine::get_clock();
+ sg4::Io::streamto(bob, bob_disk, alice, alice_disk, size);
+ XBT_INFO(" Total : %.6f seconds", sg4::Engine::get_clock() - clock);
+ bt1->wait();
+
+ XBT_INFO("[Bob -> Alice] Streaming \"from disk to memory\" (no write)");
+ clock = sg4::Engine::get_clock();
+ sg4::Io::streamto(bob, bob_disk, alice, nullptr, size);
+ XBT_INFO(" Total : %.6f seconds", sg4::Engine::get_clock() - clock);
+
+ XBT_INFO("[Bob -> Alice] Streaming \"from memory to disk\" (no read)");
+ clock = sg4::Engine::get_clock();
+ sg4::Io::streamto(bob, nullptr, alice, alice_disk, size);
+ XBT_INFO(" Total : %.6f seconds", sg4::Engine::get_clock() - clock);
+
+ XBT_INFO("[Bob -> Bob] Disk to disk (no transfer)");
+ clock = sg4::Engine::get_clock();
+ sg4::Io::streamto(bob, bob_disk, bob, bob_disk, size);
+ XBT_INFO(" Total : %.6f seconds", sg4::Engine::get_clock() - clock);
+}
+
+static void background_send() {
+ sg4::this_actor::sleep_for(23.000150);
+ sg4::Mailbox::by_name("mbox")->put(new double(1), 2e7);
+}
+
+static void background_recv() {
+ double* res;
+ sg4::CommPtr comm = sg4::Mailbox::by_name("mbox")->get_async<double>(&res);
+ sg4::this_actor::sleep_for(33.1);
+ comm->wait();
+ delete res;
}
int main(int argc, char** argv)
sg4::LinkInRoute link(zone->create_link("link", "2MBps")->set_latency("50us")->seal());
zone->add_route(bob->get_netpoint(), alice->get_netpoint(), nullptr, nullptr, {link}, true);
- bob->create_disk("bob_disk", 1e6, 5e5);
+ bob->create_disk("bob_disk", "1MBps", "500kBps");
alice->create_disk("alice_disk", 4e6, 4e6);
zone->seal();
sg4::Actor::create("streamer", bob, streamer, 4e6);
+ sg4::Actor::create("background send", bob, background_send);
+ sg4::Actor::create("background recv", alice, background_recv);
e.run();