Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] bunch of const
[simgrid.git] / src / plugins / host_dvfs.cpp
index c6cbe4d..ef6f7d4 100644 (file)
@@ -7,10 +7,12 @@
 #include <simgrid/plugins/load.h>
 #include <simgrid/s4u/Actor.hpp>
 #include <simgrid/s4u/Host.hpp>
+#include <simgrid/s4u/VirtualMachine.hpp>
 #include <xbt/asserts.h>
 #include <xbt/config.hpp>
 
 #include "src/internal_config.h" // HAVE_SMPI
+#include "src/kernel/activity/CommImpl.hpp"
 #include "src/surf/network_interface.hpp"
 #if HAVE_SMPI
 #include "src/smpi/include/smpi_request.hpp"
@@ -297,17 +299,21 @@ public:
       if (activity.get_host() == get_host())
         pre_task();
     });
-    simgrid::s4u::Exec::on_completion.connect([this](simgrid::s4u::Exec const& activity) {
+    simgrid::s4u::Activity::on_completion.connect([this](simgrid::s4u::Activity& activity) {
+      const auto* exec = dynamic_cast<simgrid::s4u::Exec*>(&activity);
+      if (exec == nullptr) // Only Execs are concerned here
+        return;
       // For more than one host (not yet supported), we can access the host via
       // simcalls_.front()->issuer->get_iface()->get_host()
-      if (activity.get_host() == get_host() && iteration_running) {
-        comp_timer += activity.get_finish_time() - activity.get_start_time();
+      if (exec->get_host() == get_host() && iteration_running) {
+        comp_timer += exec->get_finish_time() - exec->get_start_time();
       }
     });
     // FIXME I think that this fires at the same time for all hosts, so when the src sends something,
     // the dst will be notified even though it didn't even arrive at the recv yet
-    simgrid::s4u::Link::on_communicate.connect([this](const kernel::resource::NetworkAction& act) {
-      if ((get_host() == &act.get_src() || get_host() == &act.get_dst()) && iteration_running) {
+    kernel::activity::CommImpl::on_start.connect([this](const kernel::activity::CommImpl& comm) {
+      const auto* act = static_cast<kernel::resource::NetworkAction*>(comm.surf_action_);
+      if ((get_host() == &act->get_src() || get_host() == &act->get_dst()) && iteration_running) {
         post_task();
       }
     });