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;
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.");
/** @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;
/** 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;
ExecPtr setHost(Host * host);
Host* getHost() { return host_; }
- double getRemains() override;
+ double get_remaining() override;
double getRemainingRatio();
private:
#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)))
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;
}
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;
ExecPtr res = ExecPtr(new Exec());
res->host_ = getHost();
res->flops_amount_ = flops_amount;
- res->setRemains(flops_amount);
+ res->set_remaining(flops_amount);
return res;
}
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(); });
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;
xbt_assert(payload != nullptr, "You cannot send nullptr");
CommPtr c = put_init();
- c->setRemains(simulatedSize);
+ c->set_remaining(simulatedSize);
c->setSrcData(payload);
c->wait();
}
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);