SimGrid
3.7
Scalable simulation of distributed systems
|
This section describes the functions allowing to build trace-driven simulations. More...
Functions | |
void | MSG_action_register (const char *action_name, msg_action_fun function) |
Registers a function to handle a kind of action. | |
void | MSG_action_unregister (const char *action_name) |
Unregisters a function, which handled a kind of action. | |
MSG_error_t | MSG_action_trace_run (char *path) |
A trace loader. |
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 MSG_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.
void MSG_action_register | ( | const char * | action_name, |
msg_action_fun | function | ||
) |
Registers a function to handle a kind of action.
Registers a function to handle a kind of action This table is then used by MSG_action_trace_run
The argument of the function is the line describing the action, splitted on spaces with xbt_str_split_quoted()
action_name | the reference name of the action. |
function | prototype given by the type: void...(xbt_dynar_t action) |
void MSG_action_unregister | ( | const char * | action_name | ) |
Unregisters a function, which handled a kind of action.
action_name | the reference name of the action. |
MSG_error_t MSG_action_trace_run | ( | char * | path | ) |
A trace loader.
If path!=NULL, load a trace file containing actions, and execute them. Else, assume that each process gets the path in its deployment file
Back to the main Simgrid Documentation page |
The version of SimGrid documented here is v3.7. Documentation of other versions can be found in their respective archive files (directory doc/html). |
Generated by ![]() |