From: Martin Quinson Date: Sat, 7 Apr 2018 20:54:44 +0000 (+0200) Subject: snake_case s4u::Activity X-Git-Tag: v3.20~501 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/24de4abff1dbfc7c779f6768186be603342df002?ds=sidebyside snake_case s4u::Activity --- diff --git a/examples/s4u/cloud-capping/s4u-cloud-capping.cpp b/examples/s4u/cloud-capping/s4u-cloud-capping.cpp index 3c98edf7aa..93fbad8d45 100644 --- a/examples/s4u/cloud-capping/s4u-cloud-capping.cpp +++ b/examples/s4u/cloud-capping/s4u-cloud-capping.cpp @@ -44,7 +44,7 @@ static void worker_busy_loop(const char* name, double speed) static_cast(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; diff --git a/examples/s4u/exec-monitor/s4u-exec-monitor.cpp b/examples/s4u/exec-monitor/s4u-exec-monitor.cpp index 535f2fb23b..17428abf1b 100644 --- a/examples/s4u/exec-monitor/s4u-exec-monitor.cpp +++ b/examples/s4u/exec-monitor/s4u-exec-monitor.cpp @@ -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."); diff --git a/include/simgrid/s4u/Activity.hpp b/include/simgrid/s4u/Activity.hpp index c68bcc9b27..38781d5b0f 100644 --- a/include/simgrid/s4u/Activity.hpp +++ b/include/simgrid/s4u/Activity.hpp @@ -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; diff --git a/include/simgrid/s4u/Exec.hpp b/include/simgrid/s4u/Exec.hpp index 43a0031d57..b62467b151 100644 --- a/include/simgrid/s4u/Exec.hpp +++ b/include/simgrid/s4u/Exec.hpp @@ -34,7 +34,7 @@ public: ExecPtr setHost(Host * host); Host* getHost() { return host_; } - double getRemains() override; + double get_remaining() override; double getRemainingRatio(); private: diff --git a/include/xbt/base.h b/include/xbt/base.h index ab3afcd290..e8537c0f33 100644 --- a/include/xbt/base.h +++ b/include/xbt/base.h @@ -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))) diff --git a/src/plugins/vm/VmLiveMigration.cpp b/src/plugins/vm/VmLiveMigration.cpp index ee63525df8..ba14579fbc 100644 --- a/src/plugins/vm/VmLiveMigration.cpp +++ b/src/plugins/vm/VmLiveMigration.cpp @@ -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(comm->getRemains()); + sg_size_t remaining = static_cast(comm->get_remaining()); XBT_VERB("timeout (%lf s) in sending_migration_data, remaining %llu bytes of %llu", timeout, remaining, size); sent -= remaining; } diff --git a/src/s4u/s4u_activity.cpp b/src/s4u/s4u_activity.cpp index daceb75ba1..91a94c4c9e 100644 --- a/src/s4u/s4u_activity.cpp +++ b/src/s4u/s4u_activity.cpp @@ -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; diff --git a/src/s4u/s4u_actor.cpp b/src/s4u/s4u_actor.cpp index 8803ed0dab..03cd93b128 100644 --- a/src/s4u/s4u_actor.cpp +++ b/src/s4u/s4u_actor.cpp @@ -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; } diff --git a/src/s4u/s4u_exec.cpp b/src/s4u/s4u_exec.cpp index 3b90193f74..2c7d2288c0 100644 --- a/src/s4u/s4u_exec.cpp +++ b/src/s4u/s4u_exec.cpp @@ -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(pimpl_)->remains(); }); diff --git a/src/s4u/s4u_mailbox.cpp b/src/s4u/s4u_mailbox.cpp index 92a03fcb65..1abdf16164 100644 --- a/src/s4u/s4u_mailbox.cpp +++ b/src/s4u/s4u_mailbox.cpp @@ -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);