Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines for 2023.
[simgrid.git] / src / plugins / vm / dirty_page_tracking.cpp
index f4ba064..d5a7443 100644 (file)
@@ -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. */
@@ -10,9 +10,7 @@
 #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_;
@@ -49,17 +47,17 @@ simgrid::xbt::Extension<kernel::resource::VirtualMachineImpl, DirtyPageTrackingE
 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_;
 
@@ -67,9 +65,7 @@ double DirtyPageTrackingExt::computed_flops_lookup()
 
   return total;
 }
-} // namespace vm
-} // namespace plugin
-} // namespace simgrid
+} // namespace simgrid::plugin::vm
 
 using simgrid::plugin::vm::DirtyPageTrackingExt;