X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/85451b36b5396a292c4dcaab3dcca48dc8e20302..796c472929f78dd5131c885d544579d4a6bdc425:/src/kernel/resource/DiskImpl.cpp diff --git a/src/kernel/resource/DiskImpl.cpp b/src/kernel/resource/DiskImpl.cpp index 07709ce1e4..8e20838e16 100644 --- a/src/kernel/resource/DiskImpl.cpp +++ b/src/kernel/resource/DiskImpl.cpp @@ -6,32 +6,15 @@ #include "DiskImpl.hpp" #include "simgrid/s4u/Engine.hpp" -#include "simgrid/sg_config.hpp" #include "src/kernel/EngineImpl.hpp" #include "src/kernel/lmm/maxmin.hpp" #include "src/kernel/resource/profile/Profile.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(res_disk, ker_resource, "Disk resources, that fuel I/O activities"); -/*********** - * Options * - ***********/ -static simgrid::config::Flag cfg_disk_solver("disk/solver", - "Set linear equations solver used by disk model", "maxmin", - &simgrid::kernel::lmm::System::validate_solver); - namespace simgrid::kernel::resource { xbt::signal DiskAction::on_state_change; -/********* - * Model * - *********/ - -DiskModel::DiskModel(const std::string& name) : Model(name) -{ - set_maxmin_system(lmm::System::build(cfg_disk_solver.get(), true /* selective update */)); -} - /************ * Resource * ************/ @@ -134,6 +117,29 @@ constexpr kernel::lmm::Constraint::SharingPolicy to_maxmin_policy(s4u::Disk::Sha return lmm_policy; } +void DiskImpl::set_read_bandwidth(double value) +{ + read_bw_.peak = value; + if (constraint_read_) + get_model()->get_maxmin_system()->update_constraint_bound(constraint_read_, read_bw_.peak * read_bw_.scale); +} + +void DiskImpl::set_write_bandwidth(double value) +{ + write_bw_.peak = value; + if (constraint_write_) { + get_model()->get_maxmin_system()->update_constraint_bound(constraint_write_, write_bw_.peak* write_bw_.scale); + } +} + +void DiskImpl::set_readwrite_bandwidth(double value) +{ + readwrite_bw_ = value; + if (get_constraint()) { + get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(), readwrite_bw_); + } +} + void DiskImpl::set_sharing_policy(s4u::Disk::Operation op, s4u::Disk::SharingPolicy policy, const s4u::NonLinearResourceCb& cb) { @@ -177,4 +183,9 @@ void DiskAction::set_state(Action::State new_state) on_state_change(*this, previous_state, new_state); } } + +void DiskAction::update_remains_lazy(double /*now*/) +{ + THROW_IMPOSSIBLE; +} } // namespace simgrid::kernel::resource