1 This file follows the Doxygen syntax to be included in the
2 documentation, but it should remain readable directly.
5 @defgroup msg_examples MSG examples
7 @brief Find the MSG example fitting your needs from the extensive set provided in the archive.
12 - @ref msg_ex_tracing_user_variables
19 @section msg_ex_basics Basic examples and features
21 - <b>Ping Pong</b>: @ref examples/msg/app-pingpong/app-pingpong.c\n
22 It's hard to think of a simpler example: it is just sending one
23 message back and forth.
24 The tesh file laying in the directory show how to start the
25 simulator binary, highlighting how to pass options to the simulators
26 (as detailed in Section \ref options).
29 @ref examples/msg/app-token-ring/app-token-ring.c\n
30 Classical communication pattern, where a token is exchanged
31 along a ring to reach every participant.
32 The tesh file laying in the directory shows how to run the same
33 example on different virtual platforms.
35 - <b>Master Workers</b>.
36 @ref examples/msg/app-masterworker/app-masterworker.c\n
37 Another good old example, where one Master process has a bunch of
38 task to dispatch to a set of several Worker processes. It is fully
39 commented in @ref msg_ex_master_worker.
41 @section msg_ex_process Acting on Processes
43 - <b>Creating processes</b>.
44 @ref examples/msg/process-create/process-create.c \n
45 Most processes are started from the deployment XML file, but they
46 can also be used with the @ref MSG_process_create() function.
48 @section msg_ex_tracing Tracing and visualization features
50 Tracing can be activated by various configuration options which
51 are illustrated in these example. See also the
52 @ref tracing_tracing_options "full list of options related to tracing".
54 It is interesting to run the process-create example with the following
55 options to see the task executions:
57 - <b>Platform tracing</b>.
58 @ref examples/msg/trace-platform/trace-platform.c \n
59 This program is a toy example just loading the platform, so that
60 you can play with the platform visualization. Recommanded options:
61 @verbatim --cfg=tracing:yes --cfg=tracing/categorized:yes
64 - <b>Setting Categories</b>.
65 @ref examples/msg/trace-categories/trace-categories.c \n
66 This example declares several tracing categories
67 to that are used to classify its tasks. When the program is executed,
68 the tracing mechanism registers the resource utilization of hosts
69 and links according to these categories. Recommanded options:
70 @verbatim --cfg=tracing:yes --cfg=tracing/categorized:yes --cfg=tracing/uncategorized:yes
73 - <b>Master Workers tracing</b>.
74 @ref examples/msg/trace-masterworker/trace-masterworker.c \n
75 This is an augmented version of our basic master/worker example
76 using several tracing features. It traces resource usage, sorted
77 out in several categories; Trace marks and user variables are also
78 used. Recommanded options:
79 @verbatim --cfg=tracing/categorized:yes --cfg=tracing/uncategorized:yes
82 - <b>Process migration tracing</b>.
83 @ref examples/msg/trace-process-migration/trace-process-migration.c \n
84 This version is enhanced so that the process migrations can be
85 displayed as arrows in a Gantt-chart visualization. Recommanded
86 options to that extend:
87 @verbatim -cfg=tracing:yes --cfg=tracing/msg/process:yes
90 TODO: These tracing examples should be integrated in the examples to
91 not duplicate the C files. A full command line to see the result in
92 the right tool (vite/FrameSoc) should be given along with some
95 @subsection msg_ex_tracing_user_variables Tracing user variables
97 You can also attach your own variables to a any resource described in
98 the platform file. The following examples illustrate this feature.
99 They have to be run with the following options:
100 @verbatim --cfg=tracing:yes --cfg=tracing/platform:yes
103 - <b>Attaching variables to Hosts</b>.
104 @ref examples/msg/trace-host-user-variables/trace-host-user-variables.c
106 - <b>Attaching variables to Links</b>.
107 @ref examples/msg/trace-link-user-variables/trace-link-user-variables.c \n
108 The tricky part is that you have to know the name of the link you
109 want to enhance with a variable.
111 - <b>Attaching variables to network Routes</b>
112 @ref examples/msg/trace-route-user-variables/trace-route-user-variables.c \n
113 It is often easier to update a given variable for all links of a
114 given network path (identified by its source and destination
115 hosts) instead of knowing the name of each specific link.
117 @section msg_ex_models Models-related examples
119 @subsection msg_ex_ns3 NS3 as a SimGrid Network Model
121 This example demonstrates how to use the bindings to the Network
122 Simulator, as explained in @ref pls_ns3. The most
123 interesting is probably not the C files since they are unchanged from
124 the other simulations, but the associated files, such as the platform
125 file to see how to declare a platform to be used with the ns-3 bindings
126 of SimGrid and the tesh file to see how to actually start a simulation
129 - @ref examples/msg/network-ns3/network-ns3.c. Simple ping-pong using
130 ns-3 instead of the SimGrid network models.
132 TODO: merge the C files
134 TODO: show the XML files instead if it's what is interesting. On a "XML example files" page that does not exist yet.
136 @subsection msg_ex_io Simulating disks and files
138 The examples of this section demonstrate how to interact with the
141 - <b>File Management</b>. @ref examples/msg/io-file/io-file.c \n
142 This example illustrates the use of operations on file
143 (@ref MSG_file_open, @ref MSG_file_read, @ref MSG_file_write,
144 or @ref MSG_file_close).
146 @section msg_ex_misc Miscellaneous
148 - <b>Task priorities</b>.
149 @ref examples/msg/task-priority/task-priority.c \n
150 Demonstrates the use of @ref MSG_task_set_priority to change the
151 computation priority of a given task.
153 TODO: Document the many other examples that we have
156 As a human, you can stop reading at this point. The rest is garbage:
158 Every example must be listed in the following, but it's not possible
159 to move this content upper as each @example directive seems to eat
160 everything until the next */ marker (and the content is placed at the
161 top of the example file).
165 @example examples/msg/app-pingpong/app-pingpong.c
166 @example examples/msg/app-token-ring/app-token-ring.c
167 @example examples/msg/app-masterworker/app-masterworker.c
169 @example examples/msg/process-create/process-create.c
171 @example examples/msg/trace-platform/trace-platform.c
172 @example examples/msg/trace-categories/trace-categories.c
173 @example examples/msg/trace-masterworker/trace-masterworker.c
174 @example examples/msg/trace-process-migration/trace-process-migration.c
175 @example examples/msg/trace-host-user-variables/trace-host-user-variables.c
176 @example examples/msg/trace-link-user-variables/trace-link-user-variables.c
177 @example examples/msg/trace-route-user-variables/trace-route-user-variables.c
179 @example examples/msg/network-ns3/network-ns3.c
181 @example examples/msg/io-file/io-file.c
183 @example examples/msg/task-priority/task-priority.c