Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
allow to set a profile to links and hosts from S4U
[simgrid.git] / src / s4u / s4u_Host.cpp
index 6c27ca3..a308673 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2018. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2019. The SimGrid Team. All rights reserved.          */
 
 /* 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. */
@@ -196,6 +196,22 @@ void Host::set_property(std::string key, std::string value)
 {
   simgrid::simix::simcall([this, key, value] { this->pimpl_->set_property(key, value); });
 }
+/** Specify a profile turning the host on and off according to a exhaustive list or a stochastic law.
+ * The profile must contain boolean values. */
+void Host::set_state_profile(kernel::profile::Profile* p)
+{
+  return simgrid::simix::simcall([this, p] { pimpl_cpu->set_state_profile(p); });
+}
+/** Specify a profile modeling the external load according to a exhaustive list or a stochastic law.
+ *
+ * Each event of the profile represent a peak speed change that is due to external load. The values are given as a rate
+ * of the initial value. This means that the actual value is obtained by multiplying the initial value (the peek speed
+ * at this pstate level) by the rate coming from the profile.
+ */
+void Host::set_speed_profile(kernel::profile::Profile* p)
+{
+  return simgrid::simix::simcall([this, p] { pimpl_cpu->set_speed_profile(p); });
+}
 
 /** @brief Get the peak processor speed (in flops/s), at the specified pstate  */
 double Host::get_pstate_speed(int pstate_index) const
@@ -295,6 +311,7 @@ void Host::execute(double flops)
 {
   execute(flops, 1.0 /* priority */);
 }
+
 void Host::execute(double flops, double priority)
 {
   this_actor::exec_init(flops)->set_host(this)->set_priority(1 / priority)->start()->wait();