Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
snake_case s4u::Activity
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 7 Apr 2018 20:54:44 +0000 (22:54 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 7 Apr 2018 20:54:44 +0000 (22:54 +0200)
examples/s4u/cloud-capping/s4u-cloud-capping.cpp
examples/s4u/exec-monitor/s4u-exec-monitor.cpp
include/simgrid/s4u/Activity.hpp
include/simgrid/s4u/Exec.hpp
include/xbt/base.h
src/plugins/vm/VmLiveMigration.cpp
src/s4u/s4u_activity.cpp
src/s4u/s4u_actor.cpp
src/s4u/s4u_exec.cpp
src/s4u/s4u_mailbox.cpp

index 3c98edf..93fbad8 100644 (file)
@@ -44,7 +44,7 @@ static void worker_busy_loop(const char* name, double speed)
       static_cast<simgrid::s4u::VirtualMachine*>(simgrid::s4u::this_actor::getHost())->setBound(new_bound);
     }
     simgrid::s4u::this_actor::sleep_for(100);
-    double exec_remain_now = exec->getRemains();
+    double exec_remain_now = exec->get_remaining();
     double flops_per_sec   = exec_remain_prev - exec_remain_now;
     XBT_INFO("%s@%s: %.0f flops/s", name, simgrid::s4u::this_actor::getHost()->get_cname(), flops_per_sec / 100);
     exec_remain_prev = exec_remain_now;
index 535f2fb..17428ab 100644 (file)
@@ -13,7 +13,8 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example")
 static void monitor(simgrid::s4u::ExecPtr activity)
 {
   while (not activity->test()) {
-    XBT_INFO("activity remaining duration: %g (%.0f%%)", activity->getRemains(), 100 * activity->getRemainingRatio());
+    XBT_INFO("activity remaining duration: %g (%.0f%%)", activity->get_remaining(),
+             100 * activity->getRemainingRatio());
     simgrid::s4u::this_actor::sleep_for(5);
   }
   XBT_INFO("My task is over.");
index c68bcc9..38781d5 100644 (file)
@@ -14,7 +14,8 @@ namespace s4u {
 
 /** @brief Activities
  *
- * This class is the ancestor of every activities that an actor can undertake, that is, of the actions that do take time in the simulated world.
+ * This class is the ancestor of every activities that an actor can undertake.
+ * That is, of the actions that do take time in the simulated world.
  */
 class XBT_PUBLIC Activity {
   friend Comm;
@@ -49,23 +50,36 @@ public:
   /** Cancel that activity */
   //virtual void cancel();
   /** Retrieve the current state of the activity */
-  Activity::State getState() { return state_; }
+  Activity::State get_state() { return state_; }
 
   /** Get the remaining amount of work that this Activity entails. When it's 0, it's done. */
-  virtual double getRemains();
+  virtual double get_remaining();
+
   /** Set the [remaining] amount of work that this Activity will entail
    *
    * It is forbidden to change the amount of work once the Activity is started */
-  Activity* setRemains(double remains);
+  Activity* set_remaining(double remains);
 
   /** Put some user data onto the Activity */
-  Activity* setUserData(void* data)
+  Activity* set_user_data(void* data)
   {
     user_data_ = data;
     return this;
   }
   /** Retrieve the user data of the Activity */
-  void* getUserData() { return user_data_; }
+  void* get_user_data() { return user_data_; }
+
+  XBT_ATTRIB_DEPRECATED_v323("Please use Activity::get_state()") Activity::State getState() { return state_; }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Activity::get_remaining()") double getRemains() { return get_remaining(); }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Activity::set_remaining()") Activity* setRemains(double remains)
+  {
+    return set_remaining(remains);
+  }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Activity::set_user_data()") Activity* setUserData(void* data)
+  {
+    return set_user_data(data);
+  }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Activity::get_user_data()") void* getUserData() { return user_data_; }
 
 private:
   simgrid::kernel::activity::ActivityImplPtr pimpl_ = nullptr;
index 43a0031..b62467b 100644 (file)
@@ -34,7 +34,7 @@ public:
   ExecPtr setHost(Host * host);
   Host* getHost() { return host_; }
 
-  double getRemains() override;
+  double get_remaining() override;
   double getRemainingRatio();
 
 private:
index ab3afcd..e8537c0 100644 (file)
@@ -73,7 +73,8 @@
 
 #define XBT_ATTRIB_DEPRECATED_v321(mesg) XBT_ATTRIB_DEPRECATED(mesg) /* Will be dropped in v3.21 */
 #define XBT_ATTRIB_DEPRECATED_v322(mesg) XBT_ATTRIB_DEPRECATED(mesg) /* Will be dropped in v3.22 */
-#define XBT_ATTRIB_DEPRECATED_v323(mesg) XBT_ATTRIB_DEPRECATED(mesg) /* Will be dropped in v3.23 */
+#define XBT_ATTRIB_DEPRECATED_v323(mesg)                                                                               \
+  XBT_ATTRIB_DEPRECATED(mesg " (this compatibility wrapper will be dropped in v3.23)") /* Will be dropped in v3.23 */
 
 #define XBT_ATTRIB_CONSTRUCTOR(prio) __attribute__((__constructor__(prio)))
 #define XBT_ATTRIB_DESTRUCTOR(prio) __attribute__((__destructor__(prio)))
index ee63525..ba14579 100644 (file)
@@ -109,7 +109,7 @@ sg_size_t MigrationTx::sendMigrationData(sg_size_t size, int stage, int stage2_r
       comm = mbox->put_async(msg, size)->wait();
   } catch (xbt_ex& e) {
     if (comm) {
-      sg_size_t remaining = static_cast<sg_size_t>(comm->getRemains());
+      sg_size_t remaining = static_cast<sg_size_t>(comm->get_remaining());
       XBT_VERB("timeout (%lf s) in sending_migration_data, remaining %llu bytes of %llu", timeout, remaining, size);
       sent -= remaining;
     }
index daceb75..91a94c4 100644 (file)
@@ -15,12 +15,12 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_activity,s4u,"S4U activities");
 namespace simgrid {
 namespace s4u {
 
-double Activity::getRemains()
+double Activity::get_remaining()
 {
   return remains_;
 }
 
-Activity* Activity::setRemains(double remains)
+Activity* Activity::set_remaining(double remains)
 {
   xbt_assert(state_ == State::inited, "Cannot change the remaining amount of work once the Activity is started");
   remains_ = remains;
index 8803ed0..03cd93b 100644 (file)
@@ -311,7 +311,7 @@ ExecPtr exec_init(double flops_amount)
   ExecPtr res        = ExecPtr(new Exec());
   res->host_         = getHost();
   res->flops_amount_ = flops_amount;
-  res->setRemains(flops_amount);
+  res->set_remaining(flops_amount);
   return res;
 }
 
index 3b90193..2c7d228 100644 (file)
@@ -76,7 +76,7 @@ ExecPtr Exec::setHost(Host* host)
   return this;
 }
 
-double Exec::getRemains()
+double Exec::get_remaining()
 {
   return simgrid::simix::kernelImmediate(
       [this]() { return boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(pimpl_)->remains(); });
index 92a03fc..1abdf16 100644 (file)
@@ -79,7 +79,7 @@ CommPtr Mailbox::put_init()
 s4u::CommPtr Mailbox::put_init(void* data, uint64_t simulatedSize)
 {
   s4u::CommPtr res = put_init();
-  res->setRemains(simulatedSize);
+  res->set_remaining(simulatedSize);
   res->srcBuff_     = data;
   res->srcBuffSize_ = sizeof(void*);
   return res;
@@ -97,7 +97,7 @@ void Mailbox::put(void* payload, uint64_t simulatedSize)
   xbt_assert(payload != nullptr, "You cannot send nullptr");
 
   CommPtr c = put_init();
-  c->setRemains(simulatedSize);
+  c->set_remaining(simulatedSize);
   c->setSrcData(payload);
   c->wait();
 }
@@ -107,7 +107,7 @@ void Mailbox::put(void* payload, uint64_t simulatedSize, double timeout)
   xbt_assert(payload != nullptr, "You cannot send nullptr");
 
   CommPtr c = put_init();
-  c->setRemains(simulatedSize);
+  c->set_remaining(simulatedSize);
   c->setSrcData(payload);
   // c->start() is optional.
   c->wait(timeout);