Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
efd66edac9258c66e8f187f944f6f32f743cb3d7
[simgrid.git] / docs / source / Plugins.rst
1 .. _plugins:
2
3 .. raw:: html
4
5    <object id="TOC" data="graphical-toc.svg" width="100%" type="image/svg+xml"></object>
6    <script>
7    window.onload=function() { // Wait for the SVG to be loaded before changing it
8      var elem=document.querySelector("#TOC").contentDocument.getElementById("PlatformBox")
9      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";
10    }
11    </script>
12    <br/>
13    <br/>
14
15 SimGrid Plugins
16 ###############
17
18 You can extend SimGrid without modifying it, thanks to our plugin
19 mechanism. This page describes how to write your own plugin, and gives
20 the documentation of the ones distributed with SimGrid.
21
22 - Host Energy: models the energy dissipation of the compute units.
23 - Link Energy: models the energy dissipation of the network.
24
25 Defining a Plugin
26 *****************
27
28 A plugin can get some additional code executed within the SimGrid
29 kernel, and attach the data needed by that code to the SimGrid
30 objects. 
31
32 The host load plugin in 
33 `src/plugins/host_load.cpp <https://framagit.org/simgrid/simgrid/tree/master/src/plugins/host_load.cpp>`_
34 constitutes a good introductory example. It defines a class
35 ```HostLoad``` that is meant to be attached to each host. This class
36 contains a ```EXTENSION_ID``` field that is mandatory to our extension
37 mechanism. Then, the function ```sg_host_load_plugin_init```
38 initializes the plugin. It first calls
39 :cpp:func:`simgrid::s4u::Host::extension_create()` to register its
40 extension to the ```s4u::Host``` objects, and then attaches some
41 callbacks to signals.
42
43 You can attach your own extension to most kinds of s4u object:
44 :cpp:class:`Actors <simgrid::s4u::Actor>`,
45 :cpp:class:`Disks <simgrid::s4u::Disk>`,
46 :cpp:class:`Hosts <simgrid::s4u::Host>` and
47 :cpp:class:`Links <simgrid::s4u::Link>`. If you need to extend another
48 kind of objects, please let us now.
49
50 Partial list of existing signals in s4u:
51
52 - :cpp:member:`Actor::on_creation <simgrid::s4u::Actor::on_creation>`
53   :cpp:member:`Actor::on_suspend <simgrid::s4u::Actor::on_suspend>`
54   :cpp:member:`Actor::on_resume <simgrid::s4u::Actor::on_resume>`
55   :cpp:member:`Actor::on_sleep <simgrid::s4u::Actor::on_sleep>`
56   :cpp:member:`Actor::on_wake_up <simgrid::s4u::Actor::on_wake_up>`
57   :cpp:member:`Actor::on_migration_start <simgrid::s4u::Actor::on_migration_start>`
58   :cpp:member:`Actor::on_migration_end <simgrid::s4u::Actor::on_migration_end>`
59   :cpp:member:`Actor::on_termination <simgrid::s4u::Actor::on_termination>`
60   :cpp:member:`Actor::on_destruction <simgrid::s4u::Actor::on_destruction>`
61 - :cpp:member:`Comm::on_sender_start <simgrid::s4u::Comm::on_sender_start>`
62   :cpp:member:`Comm::on_receiver_start <simgrid::s4u::Comm::on_receiver_start>`
63   :cpp:member:`Comm::on_completion <simgrid::s4u::Comm::on_completion>`
64 - :cpp:member:`Engine::on_platform_creation <simgrid::s4u::Engine::on_platform_creation>`
65   :cpp:member:`Engine::on_platform_created <simgrid::s4u::Engine::on_platform_created>`
66   :cpp:member:`Engine::on_time_advance <simgrid::s4u::Engine::on_time_advance>`
67   :cpp:member:`Engine::on_simulation_end <simgrid::s4u::Engine::on_simulation_end>`
68   :cpp:member:`Engine::on_deadlock <simgrid::s4u::Engine::on_deadlock>`
69 - :cpp:member:`Exec::on_start <simgrid::s4u::Exec::on_start>`
70   :cpp:member:`Exec::on_completion <simgrid::s4u::Exec::on_completion>`
71 - :cpp:member:`Host::on_creation <simgrid::s4u::Host::on_creation>`
72   :cpp:member:`Host::on_destruction <simgrid::s4u::Host::on_destruction>`
73   :cpp:member:`Host::on_state_change <simgrid::s4u::Host::on_state_change>`
74   :cpp:member:`Host::on_speed_change <simgrid::s4u::Host::on_speed_change>`
75 - :cpp:member:`Link::on_creation <simgrid::s4u::Link::on_creation>`
76   :cpp:member:`Link::on_destruction <simgrid::s4u::Link::on_destruction>`
77   :cpp:member:`Link::on_state_change <simgrid::s4u::Link::on_state_change>`
78   :cpp:member:`Link::on_speed_change <simgrid::s4u::Link::on_bandwidth_change>`
79   :cpp:member:`Link::on_communicate <simgrid::s4u::Link::on_communicate>`
80   :cpp:member:`Link::on_communication_state_change <simgrid::s4u::Link::on_communication_state_change>`
81 - :cpp:member:`Netzone::on_creation <simgrid::s4u::Netzone::on_creation>`
82   :cpp:member:`Netzone::on_seal <simgrid::s4u::Netzone::on_seal>`
83   :cpp:member:`Netzone::on_route_creation <simgrid::s4u::Netzone::on_route_creation>`
84 - :cpp:member:`VirtualMachine::on_start <simgrid::s4u::VirtualMachine::on_start>`
85   :cpp:member:`VirtualMachine::on_started <simgrid::s4u::VirtualMachine::on_started>`
86   :cpp:member:`VirtualMachine::on_suspend <simgrid::s4u::VirtualMachine::on_suspend>`
87   :cpp:member:`VirtualMachine::on_resume <simgrid::s4u::VirtualMachine::on_resume>`
88   :cpp:member:`VirtualMachine::on_migration_start <simgrid::s4u::VirtualMachine::on_migration_start>`
89   :cpp:member:`VirtualMachine::on_migration_end <simgrid::s4u::VirtualMachine::on_migration_end>`
90
91 Existing Plugins
92 ****************
93
94 Only the major plugins are described here. Please check in src/plugins
95 to explore the other ones.
96
97 .. _plugin_host_energy:
98
99 Host Energy Plugin
100 ==================
101
102 .. doxygengroup:: Plugin_host_energy
103
104 .. _plugin_link_energy:
105
106 Link Energy Plugin
107 ==================
108
109 .. doxygengroup:: Plugin_link_energy
110
111 ..  LocalWords:  SimGrid