2 \page inside_extending Extending SimGrid
4 We start to put TAGS in simgrid source code for having tutorials to see where is the important parts ans steps to create:
5 \li \ref simgrid_dev_guide_api
6 \li \ref simgrid_dev_guide_model
7 \li \ref simgrid_dev_guide_tag
9 \section simgrid_dev_guide_api How to add a new MSG function?
10 Search for expression \"TUTORIAL: New API\".
12 user@caraja:~/workspace/simgrid/src$ cg "TUTORIAL: New API"
13 0 msg/msg_new_api.c 15 /* TUTORIAL: New API*/
14 1 simix/smx_smurf.c 582 /* TUTORIAL: New API*/
15 2 simix/smx_smurf.c 616 /* TUTORIAL: New API*/
16 3 simix/smx_smurf_private.h 102 /* TUTORIAL: New API*/
17 4 simix/smx_smurf_private.h 629 /* TUTORIAL: New API*/
18 5 simix/smx_private.h 28 /* TUTORIAL: New API*/
19 6 simix/smx_private.h 101 /* TUTORIAL: New API*/
20 7 simix/smx_private.h 182 /* TUTORIAL: New API*/
21 8 simix/smx_global.c 454 /* TUTORIAL: New API*/
22 9 simix/smx_new_api.c 8 /* TUTORIAL: New API*/
23 10 simix/smx_user.c 1684 /* TUTORIAL: New API*/
24 11 simix/smx_new_api_private.h 8 /* TUTORIAL: New API*/
25 12 simix/smx_process.c 338 /* TUTORIAL: New API*/
28 \section simgrid_dev_guide_model How to add a new model in surf?
29 A model in simgrid is composed of three classes: Model, Resource and Action
32 Actually there are five kind of models: CpuModel, NetworkModel, WorkstationModel,
33 WorkstationVMModel and StorageModel. For each kind of model, there is an
34 interface (e.g.: cpu_interface.hpp) and some implementations (e.g.: cpu_cas01.hpp,
37 If you want to create a new implementation of a kind of model you must extend
38 the classes of the corresponding interface.
40 If you want to create a new kind of model, you must create a new interface
41 where you extend the classes Model, Resource and Action, and then create an
42 implementation of this interface.
44 \section simgrid_dev_guide_simcall How to add a new simcall?
45 A simcall is used to go from user mode to kernel mode. The workflow of
46 a simcall is the following:
48 - `<ret> simcall_<name>(<args>)`
49 - `simcall_BODY_<name>(<args>)`
51 - `SIMIX_process_yield` if not maestro
52 - ========== KERNEL MODE ==========
54 - `SIMIX_pre_<name>(simcall, <args>)`
55 - `SIMIX_simcall_answer(simcall)`
57 To simplify the simcall creation, we have made a python script that
58 generate most of the code and give helpers for the remaining stuff.
59 The script generating the simcalls (src/simix/simcalls.in) take in input
60 the src/simix/simcalls.in file where the simcalls are defined and generate
63 - simcall_generated_args_getter_setter.h:
64 functions to get and set simcall arguments
65 - simcall_generated_res_getter_setter.h:
66 functions to get and set simcall result
67 - simcall_generated_body.c:
68 the BODY function of the simcall
69 - simcall_generated_case.c:
70 the case of the SIMIX_simcall_pre function
71 - simcall_generated_enum.h:
73 - simcall_generated_string.c:
74 string corresponding to the enum to debug
76 Furthermode if the simcall_<name> or the SIMIX_pre_<name> function are missing,
77 a warning will show up with a prototype of the corresponding fonction to fill.
79 The simcall.in file list all the simcalls in sections. A line starting by "##"
80 define a new section which will be replace by a "ifdef" in the generated code.
81 There is a simcall by line which follow this format:
84 Simcall -> Name HasAnswer Res Args
86 Has_Answer -> "True" | "False"
87 Res -> "(" Type MaybeCast ")"
88 Args -> Args Arg | Arg
89 Arg -> "(" Name "," Type MaybeCast ")"
90 Type -> "char" | "const char*" | "int" | "long" | "unsigned char" | "unsigned short" | "unsigned int" | "unsigned long" | "float" | "double" | "void*" | "FPtr" | "const void*" | "size_t" | "sg_size_t" | "void" | "void*"
91 MaybeCast -> "," Cast | ""
95 \section simgrid_dev_guide_tag What is How to add a new tag for xml files?
96 Search for expression \"TUTORIAL: New TAG\".
98 user@caraja:~/workspace/simgrid/src$ cg "TUTORIAL: New TAG"
99 0 surf/sg_platf.c 43 /* TUTORIAL: New TAG*/
100 1 surf/sg_platf.c 89 /* TUTORIAL: New TAG*/
101 2 surf/sg_platf.c 124 /* TUTORIAL: New TAG*/
102 3 surf/sg_platf.c 337 /* TUTORIAL: New TAG*/
103 4 surf/surfxml_parse.c 769 /* TUTORIAL: New TAG*/
104 5 surf/surf_private.h 205 /* TUTORIAL: New TAG*/
105 6 surf/surfxml_parseplatf.c 64 /* TUTORIAL: New TAG*/
106 7 surf/surfxml_parseplatf.c 85 /* TUTORIAL: New TAG*/
107 8 include/simgrid/platf_interface.h 42 /* TUTORIAL: New TAG*/