Disk* set_write_bandwidth(double write_bw);
double get_write_bandwidth() const;
+ /**
+ * @brief Set limit for read/write operations.
+ *
+ * This determines the limit for read and write operation in the same disk.
+ * Usually, it's configured to max(read_bw, write_bw).
+ * You can change this behavior using this method
+ *
+ * @param bw New bandwidth for the disk
+ */
+ Disk* set_readwrite_bandwidth(double bw);
+
const std::unordered_map<std::string, std::string>* get_properties() const;
const char* get_property(const std::string& key) const;
Disk* set_property(const std::string&, const std::string& value);
xbt_assert(this->get_model(), "Cannot seal Disk (%s) without setting the model first", get_cname());
lmm::System* maxmin_system = get_model()->get_maxmin_system();
+ /* set readwrite constraint if not configured by user */
+ if (readwrite_bw_ == -1) {
+ readwrite_bw_ = std::max(read_bw_.peak, write_bw_.peak);
+ }
this->set_read_constraint(maxmin_system->constraint_new(this, read_bw_.peak * read_bw_.scale))
->set_write_constraint(maxmin_system->constraint_new(this, write_bw_.peak * write_bw_.scale))
- ->set_constraint(maxmin_system->constraint_new(this, std::max(read_bw_.peak, write_bw_.peak)));
+ ->set_constraint(maxmin_system->constraint_new(this, readwrite_bw_));
apply_sharing_policy_cfg();
XBT_DEBUG("Create resource with read_bw '%f' write_bw '%f'", read_bw_.peak, write_bw_.peak);
Resource::seal();
public:
Metric read_bw_ = {0.0, 0, nullptr};
Metric write_bw_ = {0.0, 0, nullptr};
+ double readwrite_bw_ = -1; /* readwrite constraint bound, usually max(read, write) */
explicit DiskImpl(const std::string& name, double read_bandwidth, double write_bandwidth);
DiskImpl(const DiskImpl&) = delete;
virtual void set_write_bandwidth(double write_bw) = 0;
double get_write_bandwidth() const { return write_bw_.peak * write_bw_.scale; }
+ virtual void set_readwrite_bandwidth(double bw) = 0;
+
DiskImpl* set_read_constraint(lmm::Constraint* constraint_read);
lmm::Constraint* get_read_constraint() const { return constraint_read_; }
return pimpl_->get_read_bandwidth();
}
+Disk* Disk::set_readwrite_bandwidth(double bw)
+{
+ kernel::actor::simcall([this, bw] { pimpl_->set_readwrite_bandwidth(bw); });
+ return this;
+}
+
double Disk::get_write_bandwidth() const
{
return pimpl_->get_write_bandwidth();
update_penalties(delta);
}
+void DiskS19::set_readwrite_bandwidth(double value)
+{
+ readwrite_bw_ = value;
+ if (get_constraint())
+ get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(), readwrite_bw_);
+}
+
void DiskS19::apply_event(kernel::profile::Event* triggered, double value)
{
/* Find out which of my iterators was triggered, and react accordingly */
using DiskImpl::DiskImpl;
void set_read_bandwidth(double value) override;
void set_write_bandwidth(double value) override;
+ void set_readwrite_bandwidth(double value) override;
void apply_event(kernel::profile::Event* triggered, double value) override;
};