X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/08e7455d67920bbd7a87f440d00f2c1e071314a0..10f12acec06b772d960500524bbbaf2d5d48c08b:/src/surf/disk_s19.cpp diff --git a/src/surf/disk_s19.cpp b/src/surf/disk_s19.cpp index 3436df2904..8e910fffd9 100644 --- a/src/surf/disk_s19.cpp +++ b/src/surf/disk_s19.cpp @@ -5,13 +5,15 @@ #include "disk_s19.hpp" #include "simgrid/kernel/routing/NetPoint.hpp" +#include "simgrid/kernel/routing/NetZoneImpl.hpp" #include "simgrid/s4u/Engine.hpp" #include "simgrid/s4u/Host.hpp" +#include "src/kernel/EngineImpl.hpp" #include "src/kernel/lmm/maxmin.hpp" #include "src/surf/xml/platf.hpp" #include "surf/surf.hpp" -XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(disk_kernel); +XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(res_disk); /********* * Model * @@ -19,23 +21,19 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(disk_kernel); void surf_disk_model_init_default() { - surf_disk_model = new simgrid::kernel::resource::DiskS19Model(); + auto disk_model = std::make_shared(); + simgrid::kernel::EngineImpl::get_instance()->add_model(simgrid::kernel::resource::Model::Type::DISK, disk_model, + true); + simgrid::s4u::Engine::get_instance()->get_netzone_root()->get_impl()->set_disk_model(disk_model); } namespace simgrid { namespace kernel { namespace resource { -DiskS19Model::DiskS19Model() +DiskImpl* DiskS19Model::create_disk(const std::string& name, double read_bandwidth, double write_bandwidth) { - all_existing_models.push_back(this); -} - -DiskImpl* DiskS19Model::createDisk(const std::string& id, double read_bw, double write_bw) -{ - 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, get_maxmin_system(), read_bw, write_bw); + return (new DiskS19(name, read_bandwidth, write_bandwidth))->set_model(this); } double DiskS19Model::next_occurring_event(double now) @@ -61,13 +59,6 @@ void DiskS19Model::update_actions_state(double /*now*/, double delta) /************ * Resource * ************/ - -DiskS19::DiskS19(DiskModel* model, const std::string& name, lmm::System* maxminSystem, double read_bw, double write_bw) - : DiskImpl(model, name, maxminSystem, read_bw, write_bw) -{ - XBT_DEBUG("Create resource with read_bw '%f' write_bw '%f'", read_bw, write_bw); -} - DiskAction* DiskS19::io_start(sg_size_t size, s4u::Io::OpType type) { return new DiskS19Action(get_model(), static_cast(size), not is_on(), this, type);