X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/02a0b077329593921105001a7f27463ba2d82ced..0711d069cdfa51d648da943d017ea36850aadfe0:/src/s4u/s4u_Host.cpp diff --git a/src/s4u/s4u_Host.cpp b/src/s4u/s4u_Host.cpp index bfd02d9343..91da3536e1 100644 --- a/src/s4u/s4u_Host.cpp +++ b/src/s4u/s4u_Host.cpp @@ -14,9 +14,9 @@ #include #include "simgrid/simix.hpp" +#include "src/kernel/resource/HostImpl.hpp" #include "src/kernel/resource/StandardLinkImpl.hpp" #include "src/kernel/resource/VirtualMachineImpl.hpp" -#include "src/surf/HostImpl.hpp" #include @@ -32,8 +32,9 @@ namespace s4u { #ifndef DOXYGEN xbt::signal Host::on_creation; xbt::signal Host::on_destruction; -xbt::signal Host::on_state_change; +xbt::signal Host::on_onoff; xbt::signal Host::on_speed_change; +xbt::signal Host::on_exec_state_change; #endif Host* Host::set_cpu(kernel::resource::CpuImpl* cpu) @@ -101,7 +102,8 @@ void Host::turn_on() kernel::actor::simcall_answered([this] { this->pimpl_cpu_->turn_on(); this->pimpl_->turn_on(); - on_state_change(*this); + on_onoff(*this); + on_this_onoff(*this); }); } } @@ -115,7 +117,8 @@ void Host::turn_off() this->pimpl_cpu_->turn_off(); this->pimpl_->turn_off(self); - on_state_change(*this); + on_onoff(*this); + on_this_onoff(*this); }); } } @@ -164,6 +167,16 @@ void Host::route_to(const Host* dest, std::vector& links, double* latency for (auto* l : linkImpls) links.push_back(l->get_iface()); } +std::pair, double> Host::route_to(const Host* dest) const +{ + std::vector linkImpls; + std::vector links; + double latency = 0; + this->route_to(dest, linkImpls, &latency); + for (auto* l : linkImpls) + links.push_back(l->get_iface()); + return std::make_pair(links, latency); +} /** @brief Just like Host::routeTo, but filling an array of link implementations */ void Host::route_to(const Host* dest, std::vector& links, double* latency) const @@ -207,6 +220,17 @@ Host* Host::set_properties(const std::unordered_map& p return this; } +int Host::get_concurrency_limit() const +{ + return pimpl_cpu_->get_concurrency_limit(); +} + +Host* Host::set_concurrency_limit(int limit) +{ + kernel::actor::simcall_object_access(pimpl_cpu_, [this, limit] { pimpl_cpu_->set_concurrency_limit(limit); }); + return this; +} + /** Specify a profile turning the host on and off according to an exhaustive list or a stochastic law. * The profile must contain boolean values. */ Host* Host::set_state_profile(kernel::profile::Profile* p)