Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove commented code
[simgrid.git] / examples / cpp / dag-simple / s4u-dag-simple.cpp
index bbcfe64946cc819779b4e81fb6779bf01cbc12d4..5bad702acecf2c0b0f3272fdb33cbb9d2be6f0f4 100644 (file)
@@ -18,7 +18,7 @@ int main(int argc, char* argv[])
   auto fafard = e.host_by_name("Fafard");
 
   // Display the details on vetoed activities
-  simgrid::s4u::Activity::on_veto.connect([&e](simgrid::s4u::Activity& a) {
+  simgrid::s4u::Activity::on_veto.connect([](simgrid::s4u::Activity& a) {
     auto& exec = static_cast<simgrid::s4u::Exec&>(a); // all activities are execs in this example
 
     XBT_INFO("Activity '%s' vetoed. Dependencies: %s; Ressources: %s", exec.get_cname(),
@@ -26,6 +26,11 @@ int main(int argc, char* argv[])
              (exec.is_assigned() ? "assigned" : "NOT assigned"));
   });
 
+  simgrid::s4u::Exec::on_completion.connect([](simgrid::s4u::Exec const& exec) {
+    XBT_INFO("Activity '%s' is complete (start time: %f, finish time: %f)", exec.get_cname(), exec.get_start_time(),
+             exec.get_finish_time());
+  });
+
   // Define an amount of work that should take 1 second to execute.
   double computation_amount = fafard->get_speed();
 
@@ -36,13 +41,6 @@ int main(int argc, char* argv[])
   first_parent->add_successor(child);
   second_parent->add_successor(child);
 
-  /*
-    std::vector<simgrid::s4u::ExecPtr> pending_execs;
-    pending_execs.push_back(first_parent);
-    pending_execs.push_back(second_parent);
-    pending_execs.push_back(child);
-  */
-
   // Set the parameters (the name is for logging purposes only)
   // + First parent ends after 1 second and the Second parent after 2 seconds.
   first_parent->set_name("parent 1")->set_flops_amount(computation_amount);