-/* 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. */
#include "src/kernel/activity/ExecImpl.hpp"
#include "src/kernel/resource/VirtualMachineImpl.hpp"
-namespace simgrid {
-namespace plugin {
-namespace vm {
+namespace simgrid::plugin::vm {
class DirtyPageTrackingExt {
bool dp_tracking_ = false;
std::map<kernel::activity::ExecImpl const*, double> dp_objs_;
void DirtyPageTrackingExt::start_tracking()
{
dp_tracking_ = true;
- for (auto const& elm : dp_objs_)
- dp_objs_[elm.first] = elm.first->get_remaining();
+ for (auto const& [exec, _] : dp_objs_)
+ dp_objs_[exec] = exec->get_remaining();
}
double DirtyPageTrackingExt::computed_flops_lookup()
{
double total = 0;
- for (auto const& elm : dp_objs_) {
- total += elm.second - elm.first->get_remaining();
- dp_objs_[elm.first] = elm.first->get_remaining();
+ for (auto const& [exec, flops] : dp_objs_) {
+ total += flops - exec->get_remaining();
+ dp_objs_[exec] = exec->get_remaining();
}
total += dp_updated_by_deleted_tasks_;
return total;
}
-} // namespace vm
-} // namespace plugin
-} // namespace simgrid
+} // namespace simgrid::plugin::vm
using simgrid::plugin::vm::DirtyPageTrackingExt;
if (not DirtyPageTrackingExt::EXTENSION_ID.valid()) {
DirtyPageTrackingExt::EXTENSION_ID =
simgrid::kernel::resource::VirtualMachineImpl::extension_create<DirtyPageTrackingExt>();
- simgrid::s4u::VirtualMachine::on_creation.connect(&on_virtual_machine_creation);
- simgrid::s4u::Exec::on_start.connect(&on_exec_creation);
- simgrid::s4u::Activity::on_completion.connect(&on_exec_completion);
+ simgrid::s4u::VirtualMachine::on_creation_cb(&on_virtual_machine_creation);
+ simgrid::s4u::Exec::on_start_cb(&on_exec_creation);
+ simgrid::s4u::Activity::on_completion_cb(&on_exec_completion);
}
}