/** @brief Apply an event of external load event to that resource */
virtual void apply_event(profile::Event* event, double value) = 0;
- /** @brief Check if the current Resource is used (if it currently serves an action) */
- virtual bool is_used() const = 0;
-
/** @brief Check if the current Resource is active */
virtual bool is_on() const { return is_on_; }
virtual bool is_sealed() const { return sealed_; }
+ /** @brief Check if the current Resource is used (if it currently serves an action) */
+ virtual bool is_used() const = 0;
/** @brief Turn on the current Resource */
virtual void turn_on() { is_on_ = true; }
/** @brief Turn off the current Resource */
*
* The load due to external usages modeled by profile files is ignored.*/
virtual double get_load() const { return constraint_->get_usage(); }
+
+ bool is_used() const override { return model_->get_maxmin_system()->constraint_used(constraint_); }
};
} // namespace resource
delete this;
}
-bool DiskImpl::is_used() const
-{
- return get_model()->get_maxmin_system()->constraint_used(get_constraint());
-}
-
void DiskImpl::turn_on()
{
if (not is_on()) {
void set_factor_cb(const std::function<s4u::Disk::IoFactorCb>& cb);
const std::function<s4u::Disk::IoFactorCb>& get_factor_cb() const { return factor_cb_; }
- /** @brief Check if the Disk is used (if an action currently uses its resources) */
- bool is_used() const override;
void turn_on() override;
void turn_off() override;
delete this;
}
-bool LinkImpl::is_used() const
-{
- return get_model()->get_maxmin_system()->constraint_used(get_constraint());
-}
-
constexpr kernel::lmm::Constraint::SharingPolicy to_maxmin_policy(s4u::Link::SharingPolicy policy)
{
switch (policy) {
void set_sharing_policy(s4u::Link::SharingPolicy policy, const s4u::NonLinearResourceCb& cb) override;
s4u::Link::SharingPolicy get_sharing_policy() const override;
- /** @brief Check if the Link is used */
- bool is_used() const override;
-
void turn_on() override;
void turn_off() override;
/************
* Resource *
************/
-bool CpuCas01::is_used() const
-{
- return get_model()->get_maxmin_system()->constraint_used(get_constraint());
-}
-
/** @brief take into account changes of speed (either load or max) */
void CpuCas01::on_speed_change()
{
CpuAction* sleep(double duration) override;
void set_factor_cb(const std::function<s4u::Host::CpuFactorCb>& cb) override;
- bool is_used() const override;
-
protected:
void on_speed_change() override;
};
return action;
}
-bool CpuL07::is_used() const
-{
- return get_model()->get_maxmin_system()->constraint_used(get_constraint());
-}
-
/** @brief take into account changes of speed (either load or max) */
void CpuL07::on_speed_change()
{
bandwidth_.peak = bandwidth;
}
-bool LinkL07::is_used() const
-{
- return get_model()->get_maxmin_system()->constraint_used(get_constraint());
-}
-
void CpuL07::apply_event(kernel::profile::Event* triggered, double value)
{
XBT_DEBUG("Updating cpu %s (%p) with value %g", get_cname(), this, value);
CpuL07(const CpuL07&) = delete;
CpuL07& operator=(const CpuL07&) = delete;
- bool is_used() const override;
void apply_event(kernel::profile::Event* event, double value) override;
kernel::resource::CpuAction* execution_start(double size, double user_bound) override;
kernel::resource::CpuAction* execution_start(double, int, double) override
LinkL07(const LinkL07&) = delete;
LinkL07& operator=(const LinkL07&) = delete;
~LinkL07() override;
- bool is_used() const override;
void apply_event(kernel::profile::Event* event, double value) override;
void set_bandwidth(double value) override;
void set_latency(double value) override;