/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include "simgrid/Exception.hpp"
-#include "simgrid/host.h"
-#include "simgrid/kernel/routing/NetPoint.hpp"
-#include "simgrid/s4u/Actor.hpp"
-#include "simgrid/s4u/Comm.hpp"
-#include "simgrid/s4u/Engine.hpp"
-#include "simgrid/s4u/Exec.hpp"
-#include "simgrid/s4u/VirtualMachine.hpp"
+#include <simgrid/Exception.hpp>
+#include <simgrid/host.h>
+#include <simgrid/kernel/routing/NetPoint.hpp>
+#include <simgrid/s4u/Comm.hpp>
+#include <simgrid/s4u/Engine.hpp>
+#include <simgrid/s4u/Exec.hpp>
+#include <simgrid/s4u/Host.hpp>
+#include <simgrid/s4u/VirtualMachine.hpp>
+#include <xbt/parse_units.hpp>
+
#include "src/plugins/vm/VirtualMachineImpl.hpp"
#include "src/surf/HostImpl.hpp"
-#include "xbt/parse_units.hpp"
-#include <algorithm>
#include <string>
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_host, s4u, "Logging specific to the S4U hosts");
return this->pimpl_cpu_->is_on();
}
-int Host::get_pstate_count() const
+unsigned long Host::get_pstate_count() const
{
return this->pimpl_cpu_->get_pstate_count();
}
* @param links [OUT] where to store the list of links (must exist, cannot be nullptr).
* @param latency [OUT] where to store the latency experienced on the path (or nullptr if not interested)
* It is the caller responsibility to initialize latency to 0 (we add to provided route)
- * @pre links!=nullptr
*
* walk through the routing components tree and find a route between hosts
* by calling each "get_route" function in each routing component.
}
/** @brief Get the peak processor speed (in flops/s), at the specified pstate */
-double Host::get_pstate_speed(int pstate_index) const
+double Host::get_pstate_speed(unsigned long pstate_index) const
{
return this->pimpl_cpu_->get_pstate_peak_speed(pstate_index);
}
return this->pimpl_cpu_->get_speed_ratio();
}
+Host* Host::set_sharing_policy(SharingPolicy policy, const s4u::NonLinearResourceCb& cb)
+{
+ kernel::actor::simcall([this, policy, &cb] { pimpl_cpu_->set_sharing_policy(policy, cb); });
+ return this;
+}
+
+Host::SharingPolicy Host::get_sharing_policy() const
+{
+ return this->pimpl_cpu_->get_sharing_policy();
+}
+
int Host::get_core_count() const
{
return this->pimpl_cpu_->get_core_count();
}
/** @brief Set the pstate at which the host should run */
-Host* Host::set_pstate(int pstate_index)
+Host* Host::set_pstate(unsigned long pstate_index)
{
kernel::actor::simcall([this, pstate_index] { this->pimpl_cpu_->set_pstate(pstate_index); });
return this;
}
/** @brief Retrieve the pstate at which the host is currently running */
-int Host::get_pstate() const
+unsigned long Host::get_pstate() const
{
return this->pimpl_cpu_->get_pstate();
}
+Host* Host::set_factor_cb(const std::function<CpuFactorCb>& cb)
+{
+ kernel::actor::simcall([this, &cb] { pimpl_cpu_->set_factor_cb(cb); });
+ return this;
+}
+
Host* Host::set_coordinates(const std::string& coords)
{
if (not coords.empty())
* @param pstate_index pstate to test
* @return Returns the processor speed associated with pstate_index
*/
-double sg_host_get_pstate_speed(const_sg_host_t host, int pstate_index)
+double sg_host_get_pstate_speed(const_sg_host_t host, unsigned long pstate_index)
{
return host->get_pstate_speed(pstate_index);
}
*
* See also @ref plugin_host_energy.
*/
-int sg_host_get_nb_pstates(const_sg_host_t host)
+unsigned long sg_host_get_nb_pstates(const_sg_host_t host)
{
return host->get_pstate_count();
}
*
* See also @ref plugin_host_energy.
*/
-int sg_host_get_pstate(const_sg_host_t host)
+unsigned long sg_host_get_pstate(const_sg_host_t host)
{
return host->get_pstate();
}
*
* See also @ref plugin_host_energy.
*/
-void sg_host_set_pstate(sg_host_t host, int pstate)
+void sg_host_set_pstate(sg_host_t host, unsigned long pstate)
{
host->set_pstate(pstate);
}