X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9a2bd3bfc6299b922c88ee89172d7630bdf5dbb7..629bbb0ea28eee8adebd687a0ed72ca9bf110a26:/teshsuite/models/cm02-tcpgamma/cm02-tcpgamma.cpp diff --git a/teshsuite/models/cm02-tcpgamma/cm02-tcpgamma.cpp b/teshsuite/models/cm02-tcpgamma/cm02-tcpgamma.cpp index 8401592273..966f54832b 100644 --- a/teshsuite/models/cm02-tcpgamma/cm02-tcpgamma.cpp +++ b/teshsuite/models/cm02-tcpgamma/cm02-tcpgamma.cpp @@ -21,18 +21,16 @@ namespace sg4 = simgrid::s4u; XBT_LOG_NEW_DEFAULT_CATEGORY(cm02_tcpgamma, "Messages specific for this simulation"); -static sg4::Link* testlink = nullptr; - -static void run_ping_test() +static void run_ping_test(sg4::Link const* testlink) { auto* mailbox = simgrid::s4u::Mailbox::by_name("Test"); - simgrid::s4u::Actor::create("sender", simgrid::s4u::Host::by_name("host1"), [mailbox]() { + simgrid::s4u::Actor::create("sender", simgrid::s4u::Host::by_name("host1"), [mailbox, testlink]() { double start_time = simgrid::s4u::Engine::get_clock(); static auto message = std::string("message"); mailbox->put(&message, 1e10); double end_time = simgrid::s4u::Engine::get_clock(); - XBT_INFO(" Actual result: Sending 10Gb with bw=%.0eb, lat=%.0es takes %f seconds (TCP_Gamma=%.0f).", + XBT_INFO(" Actual result: Sending 10Gb with bw=%.0eb, lat=%.0es lasts %f seconds (TCP_Gamma=%.0f).", testlink->get_bandwidth(), testlink->get_latency(), end_time - start_time, simgrid::config::get_value("network/TCP-gamma")); }); @@ -42,53 +40,55 @@ static void run_ping_test() } /* We need a separate actor so that it can sleep after each test */ -static void main_dispatcher() +static void main_dispatcher(sg4::Link* testlink) { - XBT_INFO("TEST: When the latency is 0, the communication takes 1 sec"); - XBT_INFO(" "); - run_ping_test(); + XBT_INFO("-----------------------------------------------------------"); + XBT_INFO("This test set enforces the impact of the latency and TCP-gamma parameter on the bandwidth."); + XBT_INFO("See the documentation about the CM02 TCP performance model."); + XBT_INFO("-----------------------------------------------------------"); + XBT_INFO("TEST with latency = 0 sec (and the default value of Gamma):"); + XBT_INFO(" Expectation: Gamma/2lat is not defined, so the physical bandwidth is used; The communication lasts 1 sec."); + run_ping_test(testlink); XBT_INFO("-----------------------------------------------------------"); testlink->set_latency(0.00001); XBT_INFO("TEST with latency = 0.00001 sec"); - XBT_INFO(" Gamma/2lat is about 209 Gb/s, which is larger than the physical bandwidth."); - XBT_INFO(" So communication is limited by the physical bandwidth and takes 1.00001 sec.\n"); - run_ping_test(); + XBT_INFO(" Expectation: Gamma/2lat is about 209 Gb/s, which is larger than the physical bandwidth."); + XBT_INFO(" So communication is limited by the physical bandwidth and lasts 1.00001 sec."); + run_ping_test(testlink); XBT_INFO("-----------------------------------------------------------"); testlink->set_latency(0.001); XBT_INFO("TEST with latency = 0.001 sec"); - XBT_INFO(" Gamma/2lat is about 2 Gb/s, which is smaller than the physical bandwidth."); - XBT_INFO(" So the communication is limited by the latency and takes 4.768372 + 0.001 sec.\n"); - run_ping_test(); + XBT_INFO(" Expectation: Gamma/2lat is about 2 Gb/s, which is smaller than the physical bandwidth."); + XBT_INFO(" So the communication is limited by the latency and lasts 4.768372 + 0.001 sec."); + run_ping_test(testlink); XBT_INFO("-----------------------------------------------------------"); testlink->set_latency(0.1); XBT_INFO("TEST with latency = 0.1 sec"); - XBT_INFO(" Gamma/2lat is about 2 Gb/s, which is smaller than the physical bandwidth."); - XBT_INFO(" So the communication is limited by the latency and takes 476.837158 + 0.1 sec.\n"); - run_ping_test(); + XBT_INFO(" Expectation: Gamma/2lat is about 2 Gb/s, which is smaller than the physical bandwidth."); + XBT_INFO(" So the communication is limited by the latency and lasts 476.837158 + 0.1 sec."); + run_ping_test(testlink); XBT_INFO("-----------------------------------------------------------"); XBT_INFO("TEST with latency = 0.001 sec and TCP_Gamma = 0"); sg4::Engine::set_config("network/TCP-gamma:0"); testlink->set_latency(0.001); - XBT_INFO(" The latency=0.001s should make the communication to be limited by the latency, but since gamma=0, the " - "physical bandwidth is still used."); - XBT_INFO(" So the communication takes 1.001 sec.\n"); - run_ping_test(); + XBT_INFO(" Expectation: The latency=0.001s should make the communication to be limited by the latency."); + XBT_INFO(" But since gamma=0, the physical bandwidth is still used. So the communication lasts 1.001 sec."); + run_ping_test(testlink); XBT_INFO("-----------------------------------------------------------"); } int main(int argc, char** argv) { - // sg4::Engine::set_config("network/model:CM02"); sg4::Engine::set_config("network/crosstraffic:0"); simgrid::s4u::Engine engine(&argc, argv); auto* zone = sg4::create_full_zone("world"); - auto* host1 = zone->create_host("host1", 1e6)->seal(); - auto* host2 = zone->create_host("host2", 1e6)->seal(); - testlink = zone->create_link("L1", 1e10)->seal(); + auto const* host1 = zone->create_host("host1", 1e6)->seal(); + auto const* host2 = zone->create_host("host2", 1e6)->seal(); + auto* testlink = zone->create_link("L1", 1e10)->seal(); zone->add_route(host1->get_netpoint(), host2->get_netpoint(), nullptr, nullptr, {sg4::LinkInRoute(testlink)}); - simgrid::s4u::Actor::create("dispatcher", engine.host_by_name("host1"), main_dispatcher); + simgrid::s4u::Actor::create("dispatcher", engine.host_by_name("host1"), main_dispatcher, testlink); engine.run(); return 0;