8 <object id="TOC" data="graphical-toc.svg" type="image/svg+xml"></object>
10 window.onload=function() { // Wait for the SVG to be loaded before changing it
11 var elem=document.querySelector("#TOC").contentDocument.getElementById("PluginsBox")
12 elem.style="opacity:0.93999999;fill:#ff0000;fill-opacity:0.1;stroke:#000000;stroke-width:0.35277778;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1";
18 You can extend SimGrid without modifying it, thanks to our plugin
19 mechanism. This page describes how to write your own plugin, and
20 documents some of the plugins distributed with SimGrid:
22 - :ref:`Host Load <plugin_host_load>`: monitors the load of the compute units.
23 - :ref:`Host Energy <plugin_host_energy>`: models the energy dissipation of the compute units.
24 - :ref:`Link Energy <plugin_link_energy>`: models the energy dissipation of the network.
25 - :ref:`WiFi Energy <plugin_link_energy_wifi>`: models the energy dissipation of wifi links.
26 - :ref:`Battery <plugin_battery>`: models batteries that get discharged by the energy consumption of a given host.
27 - :ref:`Photovoltaic <plugin_photovoltaic>`: models photovoltaic panels which energy production depends on the solar irradiance.
29 You can activate these plugins with the :ref:`--cfg=plugin <cfg=plugin>` command
30 line option, for example with ``--cfg=plugin:host_energy``. You can get the full
31 list of existing plugins with ``--cfg=plugin:help``.
36 A plugin can get some additional code executed within the SimGrid
37 kernel, and attach the data needed by that code to the SimGrid
40 The host load plugin in
41 `src/plugins/host_load.cpp <https://framagit.org/simgrid/simgrid/tree/master/src/plugins/host_load.cpp>`_
42 constitutes a good introductory example. It defines a class
43 ``HostLoad`` that is meant to be attached to each host. This class
44 contains a ``EXTENSION_ID`` field that is mandatory to our extension
45 mechanism. Then, the function ``sg_host_load_plugin_init``
46 initializes the plugin. It first calls
47 :cpp:func:`simgrid::s4u::Host::extension_create()` to register its
48 extension to the ``s4u::Host`` objects, and then attaches some
51 You can attach your own extension to most kinds of s4u object:
52 :cpp:class:`Actors <simgrid::s4u::Actor>`,
53 :cpp:class:`Disks <simgrid::s4u::Disk>`,
54 :cpp:class:`Hosts <simgrid::s4u::Host>` and
55 :cpp:class:`Links <simgrid::s4u::Link>`. If you need to extend another
56 kind of objects, please let us now.
58 .. cpp:class:: template<class R, class... P> simgrid::xbt::signal<R(P...)>
60 A signal/slot mechanism, where you can attach callbacks to a given signal, and then fire the signal.
62 The template parameter is the function signature of the signal (the return value currently ignored).
64 .. cpp:function::: template<class R, class... P, class U> unsigned int simgrid::xbt::signal<R(P...)>::connect(U slot)
66 Add a new callback to this signal.
68 .. cpp:function:: template<class R, class... P> simgrid::xbt::signal<R(P...)>::operator()(P... args)
70 Fire that signal, invoking all callbacks.
78 :cpp:func:`Actor::on_creation <simgrid::s4u::Actor::on_creation_cb>`
79 :cpp:func:`Actor::on_suspend <simgrid::s4u::Actor::on_suspend_cb>`
80 :cpp:func:`Actor::on_this_suspend <simgrid::s4u::Actor::on_this_suspend_cb>`
81 :cpp:func:`Actor::on_resume <simgrid::s4u::Actor::on_resume_cb>`
82 :cpp:func:`Actor::on_this_resume <simgrid::s4u::Actor::on_this_resume_cb>`
83 :cpp:func:`Actor::on_sleep <simgrid::s4u::Actor::on_sleep_cb>`
84 :cpp:func:`Actor::on_this_sleep <simgrid::s4u::Actor::on_this_sleep_cb>`
85 :cpp:func:`Actor::on_wake_up <simgrid::s4u::Actor::on_wake_up_cb>`
86 :cpp:func:`Actor::on_this_wake_up <simgrid::s4u::Actor::on_this_wake_up_cb>`
87 :cpp:func:`Actor::on_host_change <simgrid::s4u::Actor::on_host_change_cb>`
88 :cpp:func:`Actor::on_this_host_change <simgrid::s4u::Actor::on_this_host_change_cb>`
89 :cpp:func:`Actor::on_termination <simgrid::s4u::Actor::on_termination_cb>`
90 :cpp:func:`Actor::on_this_termination <simgrid::s4u::Actor::on_this_termination_cb>`
91 :cpp:func:`Actor::on_destruction <simgrid::s4u::Actor::on_destruction_cb>`
93 :cpp:func:`Engine::on_platform_creation <simgrid::s4u::Engine::on_platform_creation_cb>`
94 :cpp:func:`Engine::on_platform_created <simgrid::s4u::Engine::on_platform_created_cb>`
95 :cpp:func:`Engine::on_time_advance <simgrid::s4u::Engine::on_time_advance_cb>`
96 :cpp:func:`Engine::on_simulation_end <simgrid::s4u::Engine::on_simulation_end_cb>`
97 :cpp:func:`Engine::on_deadlock <simgrid::s4u::Engine::on_deadlock_cb>`
101 - :cpp:func:`Disk::on_creation <simgrid::s4u::Disk::on_creation_cb>`
102 :cpp:func:`Disk::on_destruction <simgrid::s4u::Disk::on_destruction_cb>`
103 :cpp:func:`Disk::on_this_destruction <simgrid::s4u::Disk::on_this_destruction_cb>`
104 :cpp:func:`Disk::on_onoff <simgrid::s4u::Disk::on_onoff_cb>`
105 :cpp:func:`Disk::on_this_onoff <simgrid::s4u::Disk::on_this_onoff_cb>`
106 - :cpp:func:`Host::on_creation <simgrid::s4u::Host::on_creation_cb>`
107 :cpp:func:`Host::on_destruction <simgrid::s4u::Host::on_destruction_cb>`
108 :cpp:func:`Host::on_this_destruction <simgrid::s4u::Host::on_this_destruction_cb>`
109 :cpp:func:`Host::on_onoff <simgrid::s4u::Host::on_onoff_cb>`
110 :cpp:func:`Host::on_this_onoff <simgrid::s4u::Host::on_this_onoff_cb>`
111 :cpp:func:`Host::on_speed_change <simgrid::s4u::Host::on_speed_change_cb>`
112 :cpp:func:`Host::on_this_speed_change <simgrid::s4u::Host::on_this_speed_change_cb>`
113 :cpp:func:`Host::on_exec_state_change <simgrid::s4u::Host::on_exec_state_change_cb>`
114 - :cpp:func:`Link::on_creation <simgrid::s4u::Link::on_creation_cb>`
115 :cpp:func:`Link::on_destruction <simgrid::s4u::Link::on_destruction_cb>`
116 :cpp:func:`Link::on_this_destruction <simgrid::s4u::Link::on_this_destruction_cb>`
117 :cpp:func:`Link::on_onoff <simgrid::s4u::Link::on_onoff_cb>`
118 :cpp:func:`Link::on_this_onoff <simgrid::s4u::Link::on_this_onoff_cb>`
119 :cpp:func:`Link::on_bandwidth_change <simgrid::s4u::Link::on_bandwidth_change_cb>`
120 :cpp:func:`Link::on_this_bandwidth_change <simgrid::s4u::Link::on_this_bandwidth_change_cb>`
121 :cpp:func:`Link::on_communication_state_change <simgrid::s4u::Link::on_communication_state_change_cb>`
123 - :cpp:func:`NetZone::on_creation <simgrid::s4u::NetZone::on_creation_cb>`
124 :cpp:func:`NetZone::on_seal <simgrid::s4u::NetZone::on_seal_cb>`
125 - :cpp:func:`VirtualMachine::on_start <simgrid::s4u::VirtualMachine::on_start_cb>`
126 :cpp:func:`VirtualMachine::on_this_start <simgrid::s4u::VirtualMachine::on_this_start_cb>`
127 :cpp:func:`VirtualMachine::on_started <simgrid::s4u::VirtualMachine::on_started_cb>`
128 :cpp:func:`VirtualMachine::on_this_started <simgrid::s4u::VirtualMachine::on_this_started_cb>`
129 :cpp:func:`VirtualMachine::on_suspend <simgrid::s4u::VirtualMachine::on_suspend_cb>`
130 :cpp:func:`VirtualMachine::on_this_suspend <simgrid::s4u::VirtualMachine::on_this_suspend_cb>`
131 :cpp:func:`VirtualMachine::on_resume <simgrid::s4u::VirtualMachine::on_resume_cb>`
132 :cpp:func:`VirtualMachine::on_this_resume <simgrid::s4u::VirtualMachine::on_this_resume_cb>`
133 :cpp:func:`VirtualMachine::on_migration_start <simgrid::s4u::VirtualMachine::on_migration_start_cb>`
134 :cpp:func:`VirtualMachine::on_this_migration_start <simgrid::s4u::VirtualMachine::on_this_migration_start_cb>`
135 :cpp:func:`VirtualMachine::on_migration_end <simgrid::s4u::VirtualMachine::on_migration_end_cb>`
136 :cpp:func:`VirtualMachine::on_this_migration_end <simgrid::s4u::VirtualMachine::on_this_migration_end_cb>`
140 - :cpp:func:`Comm::on_send <simgrid::s4u::Comm::on_send_cb>`
141 :cpp:func:`Comm::on_recv <simgrid::s4u::Comm::on_recv_cb>`
142 - :cpp:func:`Comm::on_start <simgrid::s4u::Comm::on_start_cb>`
143 :cpp:func:`Comm::on_this_start <simgrid::s4u::Comm::on_this_start_cb>`
144 :cpp:func:`Comm::on_completion <simgrid::s4u::Comm::on_completion_cb>`
145 :cpp:func:`Comm::on_this_completion <simgrid::s4u::Comm::on_this_completion_cb>`
146 :cpp:func:`Comm::on_suspend <simgrid::s4u::Comm::on_suspend_cb>`
147 :cpp:func:`Comm::on_this_suspend <simgrid::s4u::Comm::on_this_suspend_cb>`
148 :cpp:func:`Comm::on_resume <simgrid::s4u::Comm::on_resume_cb>`
149 :cpp:func:`Comm::on_this_resume <simgrid::s4u::Comm::on_this_resume_cb>`
150 :cpp:func:`Comm::on_veto <simgrid::s4u::Comm::on_veto_cb>`
151 :cpp:func:`Comm::on_this_veto <simgrid::s4u::Comm::on_this_veto_cb>`
152 - :cpp:func:`Exec::on_start <simgrid::s4u::Exec::on_start_cb>`
153 :cpp:func:`Exec::on_this_start <simgrid::s4u::Exec::on_this_start_cb>`
154 :cpp:func:`Exec::on_completion <simgrid::s4u::Exec::on_completion_cb>`
155 :cpp:func:`Exec::on_this_completion <simgrid::s4u::Exec::on_this_completion_cb>`
156 :cpp:func:`Exec::on_suspend <simgrid::s4u::Exec::on_suspend_cb>`
157 :cpp:func:`Exec::on_this_suspend <simgrid::s4u::Exec::on_this_suspend_cb>`
158 :cpp:func:`Exec::on_resume <simgrid::s4u::Exec::on_resume_cb>`
159 :cpp:func:`Exec::on_this_resume <simgrid::s4u::Exec::on_this_resume_cb>`
160 :cpp:func:`Exec::on_veto <simgrid::s4u::Exec::on_veto_cb>`
161 :cpp:func:`Exec::on_this_veto <simgrid::s4u::Exec::on_this_veto_cb>`
162 - :cpp:func:`Io::on_start <simgrid::s4u::Io::on_start_cb>`
163 :cpp:func:`Io::on_this_start <simgrid::s4u::Io::on_this_start_cb>`
164 :cpp:func:`Io::on_completion <simgrid::s4u::Io::on_completion_cb>`
165 :cpp:func:`Io::on_this_completion <simgrid::s4u::Io::on_this_completion_cb>`
166 :cpp:func:`Io::on_suspend <simgrid::s4u::Io::on_suspend_cb>`
167 :cpp:func:`Io::on_this_suspend <simgrid::s4u::Io::on_this_suspend_cb>`
168 :cpp:func:`Io::on_resume <simgrid::s4u::Io::on_resume_cb>`
169 :cpp:func:`Io::on_this_resume <simgrid::s4u::Io::on_this_resume_cb>`
170 :cpp:func:`Io::on_veto <simgrid::s4u::Io::on_veto_cb>`
171 :cpp:func:`Io::on_this_veto <simgrid::s4u::Io::on_this_veto_cb>`
176 Only the major plugins are described here. Please check in src/plugins
177 to explore the other ones.
179 .. _plugin_host_energy:
184 .. doxygengroup:: plugin_host_energy
188 .. _plugin_link_energy:
193 .. doxygengroup:: plugin_link_energy
195 .. _plugin_link_energy_wifi:
200 .. doxygengroup:: plugin_link_energy_wifi
204 .. _plugin_host_load:
209 .. doxygengroup:: plugin_host_load
213 .. _plugin_filesystem:
218 .. doxygengroup:: plugin_filesystem
225 .. doxygengroup:: plugin_battery
227 .. _plugin_photovoltaic:
232 .. doxygengroup:: plugin_photovoltaic
237 .. doxygengroup:: plugin_chiller
239 .. doxygentypedef:: ChillerPtr
241 .. LocalWords: SimGrid