.. _plugins: .. raw:: html

SimGrid Plugins ############### You can extend SimGrid without modifying it, thanks to our plugin mechanism. This page describes how to write your own plugin, and documents some of the plugins distributed with SimGrid. - :ref:`Host Energy `: models the energy dissipation of the compute units. - :ref:`Link Energy `: models the energy dissipation of the network. - :ref:`Host Load `: monitors the load of the compute units. Defining a Plugin ***************** A plugin can get some additional code executed within the SimGrid kernel, and attach the data needed by that code to the SimGrid objects. The host load plugin in `src/plugins/host_load.cpp `_ constitutes a good introductory example. It defines a class ```HostLoad``` that is meant to be attached to each host. This class contains a ```EXTENSION_ID``` field that is mandatory to our extension mechanism. Then, the function ```sg_host_load_plugin_init``` initializes the plugin. It first calls :cpp:func:`simgrid::s4u::Host::extension_create()` to register its extension to the ```s4u::Host``` objects, and then attaches some callbacks to signals. You can attach your own extension to most kinds of s4u object: :cpp:class:`Actors `, :cpp:class:`Disks `, :cpp:class:`Hosts ` and :cpp:class:`Links `. If you need to extend another kind of objects, please let us now. Partial list of existing signals in s4u: - :cpp:member:`Actor::on_creation ` :cpp:member:`Actor::on_suspend ` :cpp:member:`Actor::on_resume ` :cpp:member:`Actor::on_sleep ` :cpp:member:`Actor::on_wake_up ` :cpp:member:`Actor::on_migration_start ` :cpp:member:`Actor::on_migration_end ` :cpp:member:`Actor::on_termination ` :cpp:member:`Actor::on_destruction ` - :cpp:member:`Comm::on_sender_start ` :cpp:member:`Comm::on_receiver_start ` :cpp:member:`Comm::on_completion ` - :cpp:member:`Engine::on_platform_creation ` :cpp:member:`Engine::on_platform_created ` :cpp:member:`Engine::on_time_advance ` :cpp:member:`Engine::on_simulation_end ` :cpp:member:`Engine::on_deadlock ` - :cpp:member:`Exec::on_start ` :cpp:member:`Exec::on_completion ` - :cpp:member:`Host::on_creation ` :cpp:member:`Host::on_destruction ` :cpp:member:`Host::on_state_change ` :cpp:member:`Host::on_speed_change ` - :cpp:member:`Link::on_creation ` :cpp:member:`Link::on_destruction ` :cpp:member:`Link::on_state_change ` :cpp:member:`Link::on_speed_change ` :cpp:member:`Link::on_communicate ` :cpp:member:`Link::on_communication_state_change ` - :cpp:member:`Netzone::on_creation ` :cpp:member:`Netzone::on_seal ` :cpp:member:`Netzone::on_route_creation ` - :cpp:member:`VirtualMachine::on_start ` :cpp:member:`VirtualMachine::on_started ` :cpp:member:`VirtualMachine::on_suspend ` :cpp:member:`VirtualMachine::on_resume ` :cpp:member:`VirtualMachine::on_migration_start ` :cpp:member:`VirtualMachine::on_migration_end ` Existing Plugins **************** Only the major plugins are described here. Please check in src/plugins to explore the other ones. .. _plugin_host_energy: Host Energy Plugin ================== .. doxygengroup:: Plugin_host_energy .. _plugin_link_energy: Link Energy Plugin ================== .. doxygengroup:: Plugin_link_energy .. _plugin_host_load: Host Load Plugin ================ .. doxygengroup:: Plugin_host_load .. LocalWords: SimGrid