mechanism. This page describes how to write your own plugin, and
documents some of the plugins distributed with SimGrid:
+ - :ref:`Host Load <plugin_host_load>`: monitors the load of the compute units.
- :ref:`Host Energy <plugin_host_energy>`: models the energy dissipation of the compute units.
- :ref:`Link Energy <plugin_link_energy>`: models the energy dissipation of the network.
- - :ref:`Host Load <plugin_host_load>`: monitors the load of the compute units.
+ - :ref:`WiFi Energy <plugin_link_energy_wifi>`: models the energy dissipation of wifi links.
You can activate these plugins with the :ref:`--cfg=plugin <cfg=plugin>` command
line option, for example with ``--cfg=plugin:host_energy``. You can get the full
.. doxygengroup:: plugin_link_energy
+.. _plugin_link_energy_wifi:
+
+WiFi Energy
+===========
+
+.. doxygengroup:: plugin_link_energy_wifi
+
.. _plugin_host_load:
.. doxygengroup:: plugin_filesystem
+.. doxygentypedef:: sg_file_t
+.. doxygentypedef:: const_sg_file_t
.. LocalWords: SimGrid
Task structure of MSG :cpp:type:`msg_task_t` and associated functions.
.. doxygentypedef:: msg_task_t
+.. doxygentypedef:: const_msg_task_t
.. doxygendefine:: MSG_TASK_UNINITIALIZED
.. doxygenfunction:: MSG_parallel_task_create
from simgrid import Actor
+ .. autoclass:: simgrid.Actor
+
.. group-tab:: C
.. code:: C
.. group-tab:: C
+ .. doxygenfunction:: sg_actor_on_exit
.. doxygenfunction:: sg_actor_join(const_sg_actor_t actor, double timeout)
.. doxygenfunction:: sg_actor_set_auto_restart(sg_actor_t actor, int auto_restart)
.. autofunction:: simgrid.this_actor.exit
.. autofunction:: simgrid.this_actor.on_exit
+ .. group-tab:: c
+
+ See also :cpp:func:`sg_actor_on_exit`.
+
+ .. doxygenfunction:: sg_actor_exit
+
.. _API_s4u_Engine:
====================
.. group-tab:: Python
+ .. code-block:: C++
+
+ #include <simgrid/mailbox.h>
+
+ .. autoclass:: simgrid.Mailbox
+
.. automethod:: simgrid.Mailbox.by_name
+ .. group-tab:: C
+
.. code-block:: C
#include <simgrid/s4u/mailbox.h>
- .. doxygenfunction:: sg_mailbox_by_name(const char *alias)
+ .. doxygentypedef:: sg_mailbox_t
+ .. doxygentypedef:: const_sg_mailbox_t
- .. group-tab:: C
+ .. doxygenfunction:: sg_mailbox_by_name(const char *alias)
Querying info
-------------
from simgrid import Comm
+ .. autoclass:: simgrid.Comm
+
+ .. group-tab:: c
+
+ .. code:: c
+
+ #include <simgrid/comm.h>
+
+ .. doxygentypedef:: sg_comm_t
+ .. doxygentypedef:: const_sg_comm_t
+
Querying info
-------------
.. doxygenfunction:: simgrid::s4u::Comm::set_dst_data(void **buff, size_t size)
.. doxygenfunction:: simgrid::s4u::Comm::detach()
.. doxygenfunction:: simgrid::s4u::Comm::detach(void(*clean_function)(void *))
+ .. doxygenfunction:: simgrid::s4u::Comm::set_payload_size(double bytes)
.. doxygenfunction:: simgrid::s4u::Comm::set_rate(double rate)
.. doxygenfunction:: simgrid::s4u::Comm::set_src_data(void *buff)
.. doxygenfunction:: simgrid::s4u::Comm::set_src_data(void *buff, size_t size)
.. code:: Python
from simgrid import Exec
-
+
+ .. autoclass:: simgrid.Exec
+
.. group-tab:: C
.. code-block:: C
#include <simgrid/exec.h>
+ .. doxygentypedef:: sg_exec_t
+ .. doxygentypedef:: const_sg_exec_t
+
Querying info
-------------
#include <simgrid/cond.h>
.. doxygentypedef:: sg_cond_t
+ .. doxygentypedef:: const_sg_cond_t
.. doxygenfunction:: sg_cond_init
.. doxygenfunction:: sg_cond_destroy
('cpp:identifier', 'kernel::profile'),
('cpp:identifier', 'kernel::resource'),
('cpp:identifier', 'kernel::routing'),
+ ('cpp:identifier', 'sg_msg_Comm'),
+ ('cpp:identifier', 'sg_msg_Task'),
('cpp:identifier', 'simgrid'),
('cpp:identifier', 'simgrid::s4u'),
+ ('cpp:identifier', 'simgrid::s4u::this_actor'),
+ ('cpp:identifier', 'simgrid::s4u::Activity_T<Comm>'),
+ ('cpp:identifier', 'simgrid::s4u::Activity_T<Io>'),
('cpp:identifier', 'simgrid::xbt'),
('cpp:identifier', 'this_actor'),
('cpp:identifier', 's4u'),
('cpp:identifier', 's4u_Actor'),
('cpp:identifier', 's4u_Barrier'),
+ ('cpp:identifier', 's4u_Comm'),
('cpp:identifier', 's4u_ConditionVariable'),
+ ('cpp:identifier', 's4u_Exec'),
('cpp:identifier', 's4u_Host'),
('cpp:identifier', 's4u_NetZone'),
+ ('cpp:identifier', 's4u_Mailbox'),
('cpp:identifier', 's4u_Mutex'),
('cpp:identifier', 's4u_Link'),
('cpp:identifier', 's4u_Semaphore'),
You create actors either:
- - Directly with :cpp:func:`sg_actor_create()` followed by :cpp:func:`sg_actor_start`.
+ - Directly with :cpp:func:`sg_actor_create` followed by :cpp:func:`sg_actor_start`.
- From XML with :cpp:func:`simgrid_register_function` and then :cpp:func:`simgrid_load_deployment`.
.. example-tab:: examples/python/actor-create/actor-create_d.xml
typedef const s4u_Link* const_sg_link_t;
typedef s4u_Disk* sg_disk_t;
typedef const s4u_Disk* const_sg_disk_t;
+/** Pointer to a SimGrid file object */
typedef s4u_File* sg_file_t;
+/** Constant pointer to a SimGrid file object */
typedef const s4u_File* const_sg_file_t;
typedef s4u_VM* sg_vm_t;
typedef const s4u_VM* const_sg_vm_t;
XBT_PUBLIC int sg_link_energy_is_inited();
+/** @ingroup plugin_link_energy_wifi
+ * @brief Initialize the wifi energy plugin */
XBT_PUBLIC void sg_wifi_energy_plugin_init();
#if SIMGRID_HAVE_MSG
/** Specify the data to send.
*
+ * @beginrst
* This is way will get actually copied over to the receiver.
- * That's completely unrelated from the simulated size (given with @ref Comm::set_payload_size()):
+ * That's completely unrelated from the simulated size (given by :cpp:func:`simgrid::s4u::Comm::set_payload_size`):
* you can send a short buffer in your simulator, that represents a very large message
* in the simulated world, or the opposite.
+ * @endrst
*/
CommPtr set_src_data(void* buff);
- /** Specify the size of the data to send. Not to be mixed with @ref Comm::set_payload_size()
+ /** Specify the size of the data to send (not to be mixed with set_payload_size())
*
- * That's the size of the data to actually copy in the simulator (ie, the data passed with Activity::set_src_data()).
- * That's completely unrelated from the simulated size (given with @ref Comm::set_payload_size()):
- * you can send a short buffer in your simulator, that represents a very large message
- * in the simulated world, or the opposite.
+ * @beginrst
+ * That's the size of the data to actually copy in the simulator (ie, the data passed with
+ * :cpp:func:`simgrid::s4u::Comm::set_src_data`). That's completely unrelated from the simulated size (given by
+ * :cpp:func:`simgrid::s4u::Comm::set_payload_size`)): you can send a short buffer in your simulator, that represents
+ * a very large message in the simulated world, or the opposite.
+ * @endrst
*/
CommPtr set_src_data_size(size_t size);
- /* Specify the amount of bytes which exchange should be simulated. Not to be mixed with @ref Comm::set_src_data_size()
+ /** Specify the amount of bytes which exchange should be simulated (not to be mixed with set_src_data_size())
*
- * That's the size of the simulated data, that's completely related from the actual data size (given with @ref
- * Comm::set_src_data_size()).
+ * @beginrst
+ * That's the size of the simulated data, that's completely related from the actual data size (given by
+ * :cpp:func:`simgrid::s4u::Comm::set_src_data_size`).
+ * @endrst
*/
CommPtr set_payload_size(double bytes);
- /** Specify the data to send and its size. Don't mix the size with @ref Comm::set_payload_size()
+ /** Specify the data to send and its size (not to be mixed with set_payload_size())
*
+ * @beginrst
* This is way will get actually copied over to the receiver.
- * That's completely unrelated from the simulated size (given with @ref Comm::set_payload_size()):
+ * That's completely unrelated from the simulated size (given by :cpp:func:`simgrid::s4u::Comm::set_payload_size`):
* you can send a short buffer in your simulator, that represents a very large message
* in the simulated world, or the opposite.
+ * @endrst
*/
CommPtr set_src_data(void* buff, size_t size);
namespace simgrid {
namespace xbt {
- template<class S> class signal;
-
- /** A signal/slot mechanism
- *
- * The template parameter is the function signature of the signal.
- * The return value currently ignored.
- */
- template<class R, class... P>
- class signal<R(P...)> {
- using callback_type = std::function<R(P...)>;
- std::map<unsigned int, callback_type> handlers_;
- unsigned int callback_sequence_id = 0;
-
- public:
- /** Add a new callback to this signal */
- template <class U> unsigned int connect(U slot)
- {
- handlers_.insert({callback_sequence_id, std::move(slot)});
- return callback_sequence_id++;
- }
- /** Fire that signal, invoking all callbacks */
- R operator()(P... args) const
- {
- for (auto const& handler : handlers_)
- handler.second(args...);
- }
- /** Remove a callback */
- void disconnect(unsigned int id) { handlers_.erase(id); }
- /** Remove all callbacks */
- void disconnect_slots() { handlers_.clear(); }
- /** Get the amount of callbacks */
- int get_slot_count() { return handlers_.size(); }
- };
-
+template <class S> class signal;
+
+/** @brief
+ * A signal/slot mechanism, where you can attach callbacks to a given signal, and then fire the signal.
+ *
+ * The template parameter is the function signature of the signal (the return value currently ignored).
+ */
+template <class R, class... P> class signal<R(P...)> {
+ using callback_type = std::function<R(P...)>;
+ std::map<unsigned int, callback_type> handlers_;
+ unsigned int callback_sequence_id = 0;
+
+public:
+ /** Add a new callback to this signal */
+ template <class U> unsigned int connect(U slot)
+ {
+ handlers_.insert({callback_sequence_id, std::move(slot)});
+ return callback_sequence_id++;
+ }
+ /** Fire that signal, invoking all callbacks */
+ R operator()(P... args) const
+ {
+ for (auto const& handler : handlers_)
+ handler.second(args...);
+ }
+ /** Remove a callback */
+ void disconnect(unsigned int id) { handlers_.erase(id); }
+ /** Remove all callbacks */
+ void disconnect_slots() { handlers_.clear(); }
+ /** Get the amount of callbacks */
+ int get_slot_count() { return handlers_.size(); }
+};
}
}
#include <map>
SIMGRID_REGISTER_PLUGIN(link_energy_wifi, "Energy wifi test", &sg_wifi_energy_plugin_init);
-/** @degroup plugin_link_energy_wifi Plugin WiFi energy
+/** @defgroup plugin_link_energy_wifi Plugin WiFi energy
*
* This is the WiFi energy plugin, accounting for the dissipated energy of WiFi links.
*/