XBT_LOG_NEW_DEFAULT_CATEGORY(disk_test, "Messages specific for this simulation");
/** @brief Calculates the bandwidth for disk doing async operations */
-static void estimate_bw(sg4::Disk* disk, int n_flows, bool read)
+static void estimate_bw(const sg4::Disk* disk, int n_flows, bool read)
{
unsigned long long size = 100000;
double cur_time = sg4::Engine::get_clock();
activities.push_back(act);
}
- for (auto& act : activities)
+ for (const auto& act : activities)
act->wait();
double elapsed_time = sg4::Engine::get_clock() - cur_time;
- double estimated_bw = size * n_flows / elapsed_time;
+ double estimated_bw = static_cast<double>(size * n_flows) / elapsed_time;
XBT_INFO("Disk: %s, concurrent %s: %d, estimated bandwidth: %lf", disk->get_cname(), read ? "read" : "write", n_flows,
estimated_bw);
}
if (data.find(n) != data.end())
capacity = data.at(n);
- // XBT_INFO("Disk %s, %s operation between %d flows, capacity %lf", disk->get_cname(), op.c_str(), n, capacity);
-
return capacity;
}
*/
static double sata_dynamic_sharing(const sg4::Disk* /*disk*/, double capacity, int n)
{
- capacity = 68.3 - 1.7 * n;
- // XBT_INFO("Disk %s, read operation between %d flows, capacity %lf", disk->get_cname(), n, capacity);
-
- return capacity;
+ return 68.3 - 1.7 * n;
}
/** @brief Creates an SSD disk, setting the appropriate callback for non-linear resource sharing */
constexpr kernel::lmm::Constraint::SharingPolicy to_maxmin_policy(s4u::Disk::SharingPolicy policy)
{
- switch (policy) {
- case s4u::Disk::SharingPolicy::NONLINEAR:
- return kernel::lmm::Constraint::SharingPolicy::NONLINEAR;
- default:
- return kernel::lmm::Constraint::SharingPolicy::SHARED;
- }
+ kernel::lmm::Constraint::SharingPolicy lmm_policy = kernel::lmm::Constraint::SharingPolicy::SHARED;
+ if (policy == s4u::Disk::SharingPolicy::NONLINEAR)
+ lmm_policy = kernel::lmm::Constraint::SharingPolicy::NONLINEAR;
+ return lmm_policy;
}
void DiskImpl::set_sharing_policy(s4u::Disk::Operation op, s4u::Disk::SharingPolicy policy,
SECTION("sharing_policy: nonlinear")
{
- link->set_sharing_policy(simgrid::s4u::Link::SharingPolicy::NONLINEAR, [](double c, int n) -> double { return c; });
+ link->set_sharing_policy(simgrid::s4u::Link::SharingPolicy::NONLINEAR,
+ [](double c, int /*n*/) -> double { return c; });
REQUIRE(link_up->get_sharing_policy() == simgrid::s4u::Link::SharingPolicy::NONLINEAR);
REQUIRE(link_down->get_sharing_policy() == simgrid::s4u::Link::SharingPolicy::NONLINEAR);
}