Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
stringify, snake_case and cleanups in k::ExecImpl
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 13 Jul 2018 21:02:21 +0000 (23:02 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 13 Jul 2018 21:06:51 +0000 (23:06 +0200)
src/kernel/activity/ActivityImpl.hpp
src/kernel/activity/ExecImpl.cpp
src/kernel/activity/ExecImpl.hpp
src/plugins/dirty_page_tracking.cpp
src/simix/smx_host.cpp

index d145e8f..31b4b4b 100644 (file)
@@ -22,6 +22,7 @@ namespace activity {
 class XBT_PUBLIC ActivityImpl {
 public:
   ActivityImpl();
+  explicit ActivityImpl(std::string name) : name_(name) {}
   virtual ~ActivityImpl();
   e_smx_state_t state_ = SIMIX_WAITING; /* State of the activity */
   std::string name_;                    /* Activity name if any */
index ebfa43b..17fdf8d 100644 (file)
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_process);
 
-simgrid::kernel::activity::ExecImpl::ExecImpl(const char* name, resource::Action* surf_action,
+simgrid::kernel::activity::ExecImpl::ExecImpl(std::string name, resource::Action* surf_action,
                                               resource::Action* timeout_detector, s4u::Host* host)
-    : host_(host)
+    : ActivityImpl(name), host_(host), surf_action_(surf_action), timeout_detector_(timeout_detector)
 {
-  if (name)
-    this->name_ = name;
   this->state_ = SIMIX_RUNNING;
 
-  surf_action_ = surf_action;
   surf_action_->set_data(this);
-  if (timeout_detector != nullptr) {
+  if (timeout_detector != nullptr)
     timeout_detector->set_data(this);
-    timeout_detector_ = timeout_detector;
-  }
 
   XBT_DEBUG("Create exec %p", this);
 }
@@ -116,7 +111,7 @@ void simgrid::kernel::activity::ExecImpl::post()
     timeout_detector_ = nullptr;
   }
 
-  onCompletion(this);
+  on_completion(this);
   /* If there are simcalls associated with the synchro, then answer them */
   if (not simcalls_.empty())
     SIMIX_execution_finish(this);
@@ -142,13 +137,14 @@ simgrid::kernel::activity::ExecImpl::migrate(simgrid::s4u::Host* to)
     this->surf_action_ = new_action;
   }
 
-  onMigration(this, to);
+  on_migration(this, to);
   return this;
 }
 
 /*************
  * Callbacks *
  *************/
-simgrid::xbt::signal<void(simgrid::kernel::activity::ExecImplPtr)> simgrid::kernel::activity::ExecImpl::onCreation;
-simgrid::xbt::signal<void(simgrid::kernel::activity::ExecImplPtr)> simgrid::kernel::activity::ExecImpl::onCompletion;
-simgrid::xbt::signal<void(simgrid::kernel::activity::ExecImplPtr, simgrid::s4u::Host*)> simgrid::kernel::activity::ExecImpl::onMigration;
+simgrid::xbt::signal<void(simgrid::kernel::activity::ExecImplPtr)> simgrid::kernel::activity::ExecImpl::on_creation;
+simgrid::xbt::signal<void(simgrid::kernel::activity::ExecImplPtr)> simgrid::kernel::activity::ExecImpl::on_completion;
+simgrid::xbt::signal<void(simgrid::kernel::activity::ExecImplPtr, simgrid::s4u::Host*)>
+    simgrid::kernel::activity::ExecImpl::on_migration;
index d37b987..453d4f1 100644 (file)
@@ -17,7 +17,7 @@ class XBT_PUBLIC ExecImpl : public ActivityImpl {
   ~ExecImpl() override;
 
 public:
-  explicit ExecImpl(const char* name, resource::Action* surf_action, resource::Action* timeout_detector,
+  explicit ExecImpl(std::string name, resource::Action* surf_action, resource::Action* timeout_detector,
                     s4u::Host* host);
   void suspend() override;
   void resume() override;
@@ -36,10 +36,9 @@ private:
   resource::Action* timeout_detector_ = nullptr;
 
 public:
-  static simgrid::xbt::signal<void(kernel::activity::ExecImplPtr)> onCreation;
-  static simgrid::xbt::signal<void(kernel::activity::ExecImplPtr)> onCompletion;
-  static simgrid::xbt::signal<void(simgrid::kernel::activity::ExecImplPtr, simgrid::s4u::Host*)> onMigration;
-
+  static simgrid::xbt::signal<void(kernel::activity::ExecImplPtr)> on_creation;
+  static simgrid::xbt::signal<void(kernel::activity::ExecImplPtr)> on_completion;
+  static simgrid::xbt::signal<void(simgrid::kernel::activity::ExecImplPtr, simgrid::s4u::Host*)> on_migration;
 };
 }
 }
index 4097976..df2cc07 100644 (file)
@@ -107,8 +107,8 @@ void sg_vm_dirty_page_tracking_init()
     simgrid::vm::DirtyPageTrackingExt::EXTENSION_ID =
         simgrid::vm::VirtualMachineImpl::extension_create<simgrid::vm::DirtyPageTrackingExt>();
     simgrid::vm::VirtualMachineImpl::on_creation.connect(&on_virtual_machine_creation);
-    simgrid::kernel::activity::ExecImpl::onCreation.connect(&on_exec_creation);
-    simgrid::kernel::activity::ExecImpl::onCompletion.connect(&on_exec_completion);
+    simgrid::kernel::activity::ExecImpl::on_creation.connect(&on_exec_creation);
+    simgrid::kernel::activity::ExecImpl::on_completion.connect(&on_exec_completion);
   }
 }
 
index 3b1cde9..022a54f 100644 (file)
@@ -76,7 +76,7 @@ SIMIX_execution_start(const char* name, double flops_amount, double priority, do
       new simgrid::kernel::activity::ExecImpl(name, surf_action, /*timeout_detector*/ nullptr, host));
 
   XBT_DEBUG("Create execute synchro %p: %s", exec.get(), exec->name_.c_str());
-  simgrid::kernel::activity::ExecImpl::onCreation(exec);
+  simgrid::kernel::activity::ExecImpl::on_creation(exec);
 
   return exec;
 }