all_existing_models.push_back(this);
}
-DiskImpl* DiskS19Model::createDisk(const std::string& id, double read_bw, double write_bw)
+DiskImpl* DiskS19Model::create_disk(const std::string& name, double read_bandwidth, double write_bandwidth)
{
- XBT_DEBUG("SURF disk create resource\n\t\tid '%s'\n\t\tread_bw '%f'\n", id.c_str(), read_bw);
-
- return new DiskS19(this, id, read_bw, write_bw);
+ return (new DiskS19(name, read_bandwidth, write_bandwidth))->set_model(this);
}
double DiskS19Model::next_occurring_event(double now)
/************
* Resource *
************/
-
-DiskS19::DiskS19(DiskModel* model, const std::string& name, double read_bw, double write_bw)
- : DiskImpl(name)
-{
- lmm::System* maxmin_system = model->get_maxmin_system();
- this->set_read_bandwidth(read_bw)
- ->set_write_bandwidth(write_bw)
- ->set_read_constraint(maxmin_system->constraint_new(this, read_bw))
- ->set_write_constraint(maxmin_system->constraint_new(this, write_bw))
- ->set_name(name)
- ->set_model(model)
- ->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);
- DiskImpl::turn_on();
-}
-
DiskAction* DiskS19::io_start(sg_size_t size, s4u::Io::OpType type)
{
return new DiskS19Action(get_model(), static_cast<double>(size), not is_on(), this, type);