.. _howto_churn:
-Modeling Churn in P2P
-*********************
+Modeling Churn (e.g. in P2P)
+****************************
One of the biggest challenges in P2P settings is to cope with the
churn, meaning that resources keep appearing and disappearing. In
the churn is high, you can also attach a **state profile** to the host
directly.
-This is not possible from S4U yet (TODO), and you should use the
-``state_file`` attribute of :ref:`pf_tag_host`, :ref:`pf_tag_cluster`
-or :ref:`pf_tag_link`.
-
-Every lines (but the last) of such files describe timed events with
-the form "date value". Example:
+This can be done through the XML file, using the ``state_file``
+attribute of :ref:`pf_tag_host`, :ref:`pf_tag_cluster` or
+:ref:`pf_tag_link`. Every lines (but the last) of such files describe
+timed events with the form "date value". Example:
.. code-block:: python
If your trace does not contain a LOOPAFTER line, then your profile is
only executed once and not repetitively.
+Another possibility is to use the
+:cpp:func:`simgrid::s4u::Host::set_state_profile()` or
+:cpp:func:`simgrid::s4u::Link::set_state_profile()` functions. These
+functions take a profile, that can be an fixed profile exhaustively
+listing the events, or something else if you wish.
+
.. _howto_multicore:
Modeling Multicore Machines
void set_property(std::string key, std::string value);
std::unordered_map<std::string, std::string>* get_properties();
+ void set_state_profile(kernel::profile::Profile* p);
+ void set_speed_profile(kernel::profile::Profile* p);
+
#ifndef DOXYGEN
/** @deprecated See Host::get_properties() */
XBT_ATTRIB_DEPRECATED_v323("Please use Host::get_properties()") std::map<std::string, std::string>* getProperties()
}
#endif
- /** Setup the profile file with states events (ON or OFF). The profile must contain boolean values. */
+ /** Setup the profile with states events (ON or OFF). The profile must contain boolean values. */
void set_state_profile(kernel::profile::Profile* profile);
- /** Setup the profile file with bandwidth events (peak speed changes due to external load).
+ /** Setup the profile with bandwidth events (peak speed changes due to external load).
* The profile must contain percentages (value between 0 and 1). */
void set_bandwidth_profile(kernel::profile::Profile* profile);
/** Setup the profile file with latency events (peak latency changes due to external load).
{
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