X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b258d5c9c0df493362e405852089a923e5f450e6..a7d97238d0dca19abc00d07ccdcdf2f58c4e0d67:/examples/cpp/io-degradation/s4u-io-degradation.cpp diff --git a/examples/cpp/io-degradation/s4u-io-degradation.cpp b/examples/cpp/io-degradation/s4u-io-degradation.cpp index 0e8e4b5030..9ab897a285 100644 --- a/examples/cpp/io-degradation/s4u-io-degradation.cpp +++ b/examples/cpp/io-degradation/s4u-io-degradation.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2021. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2017-2023. 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. */ @@ -16,9 +16,8 @@ #include -namespace sg4 = simgrid::s4u; - XBT_LOG_NEW_DEFAULT_CATEGORY(disk_test, "Messages specific for this simulation"); +namespace sg4 = simgrid::s4u; /** @brief Calculates the bandwidth for disk doing async operations */ static void estimate_bw(const sg4::Disk* disk, int n_flows, bool read) @@ -89,11 +88,9 @@ static double ssd_dynamic_sharing(const sg4::Disk* /*disk*/, const std::string& {15, 239.}}}}; const auto& data = SSD_SPEED.at(op); + const auto value = data.find(n); /* no special bandwidth for this disk sharing N flows, just returns maximal capacity */ - if (data.find(n) != data.end()) - capacity = data.at(n); - - return capacity; + return value == data.end() ? capacity : value->second; } /** @@ -143,10 +140,10 @@ int main(int argc, char** argv) create_sata_disk(bob, "Griffon (SATA II)"); zone->seal(); - simgrid::s4u::Actor::create("", bob, host); + sg4::Actor::create("", bob, host); e.run(); - XBT_INFO("Simulated time: %g", simgrid::s4u::Engine::get_clock()); + XBT_INFO("Simulated time: %g", sg4::Engine::get_clock()); return 0; }