XBT_LOG_NEW_DEFAULT_SUBCATEGORY(res_disk, ker_resource, "Disk resources, fuelling I/O activities");
-simgrid::kernel::resource::DiskModel* surf_disk_model = nullptr;
-
namespace simgrid {
namespace kernel {
namespace resource {
* Model *
*********/
-DiskModel::DiskModel() : Model(Model::UpdateAlgo::FULL)
-{
- set_maxmin_system(new simgrid::kernel::lmm::System(true /* selective update */));
-}
-
-DiskModel::~DiskModel()
+DiskModel::DiskModel(const std::string& name) : Model(name)
{
- surf_disk_model = nullptr;
+ set_maxmin_system(new lmm::System(true /* selective update */));
}
/************
DiskImpl* DiskImpl::set_read_constraint(lmm::Constraint* constraint_read)
{
- constraint_read_ = constraint_read;
+ constraint_read_ = constraint_read;
return this;
}
DiskImpl* DiskImpl::set_write_constraint(lmm::Constraint* constraint_write)
{
- constraint_write_ = constraint_write;
+ constraint_write_ = constraint_write;
return this;
}
void DiskImpl::seal()
{
- lmm::System* maxmin_system = surf_disk_model->get_maxmin_system();
+ xbt_assert(this->get_model(), "Cannot seal Disk (%s) without setting the model first", this->get_cname());
+ lmm::System* maxmin_system = get_model()->get_maxmin_system();
this->set_read_constraint(maxmin_system->constraint_new(this, read_bw_))
- ->set_write_constraint(maxmin_system->constraint_new(this, write_bw_))
- ->set_model(surf_disk_model)
- ->set_constraint(maxmin_system->constraint_new(this, std::max(read_bw_, write_bw_)));
+ ->set_write_constraint(maxmin_system->constraint_new(this, write_bw_))
+ ->set_constraint(maxmin_system->constraint_new(this, std::max(read_bw_, write_bw_)));
XBT_DEBUG("Create resource with read_bw '%f' write_bw '%f'", read_bw_, write_bw_);
+ Resource::seal();
turn_on();
}
xbt::signal<void(DiskAction const&, Action::State, Action::State)> DiskAction::on_state_change;