Versatile Simulation of Distributed Systems
This section describes the functions allowing to build trace-driven simulations.
This is very handy when you want to test an algorithm or protocol that does nothing unless it receives some events from outside. For example, a P2P protocol reacts to requests from the user, but does nothing if there is no such event.
In such situations, SimGrid allows to write your protocol in your C file, and the events to react to in a separate text file. Declare a function handling each of the events that you want to accept in your trace files, register them using xbt_replay_action_register in your main, and then use MSG_action_trace_run to launch the simulation. You can either have one trace file containing all your events, or a file per simulated process.
Check the examples in examples/msg/actions/actions.c for details.
|msg_error_t||MSG_action_trace_run (char *path)|
|A trace loader. More...|
|msg_error_t MSG_action_trace_run||(||char *||path||)|
A trace loader.
If path!=nullptr, load a trace file containing actions, and execute them. Else, assume that each process gets the path in its deployment file