1 /*! \page tracing Tracing Simulations for Visualization
3 \htmlinclude .tracing.doc.toc
5 \section tracing_tracing Tracing Simulations for Visualization
7 The trace visualization is widely used to observe and understand the behavior
8 of parallel applications and distributed algorithms. Usually, this is done in a
9 two-step fashion: the user instruments the application and the traces are
10 analyzed after the end of the execution. The visualization itself can highlights
11 unexpected behaviors, bottlenecks and sometimes can be used to correct
12 distributed algorithms. The SimGrid team has instrumented the library
13 in order to let users trace their simulations and analyze them. This part of the
14 user manual explains how the tracing-related features can be enabled and used
15 during the development of simulators using the SimGrid library.
17 \subsection tracing_tracing_howitworks How it works
19 For now, the SimGrid library is instrumented so users can trace the <b>platform
20 utilization</b> using the MSG, SimDAG and SMPI interface. This means that the tracing will
21 register how much power is used for each host and how much bandwidth is used for
22 each link of the platform. The idea with this type of tracing is to observe the
23 overall view of resources utilization in the first place, especially the
24 identification of bottlenecks, load-balancing among hosts, and so on.
26 The idea of the tracing facilities is to give SimGrid users to possibility to
27 classify MSG and SimDAG tasks by category, tracing the platform utilization
28 (hosts and links) for each of the categories. For that,
29 the tracing interface enables the declaration of categories and a function to
30 mark a task with a previously declared category. <em>The tasks that are not
31 classified according to a category are not traced</em>. Even if the user
32 does not specify any category, the simulations can still be traced in terms
33 of resource utilization by using a special parameter that is detailed below.
35 \subsection tracing_tracing_enabling Enabling using CMake
37 With the sources of SimGrid, it is possible to enable the tracing
38 using the parameter <b>-Denable_tracing=ON</b> when the cmake is executed.
39 The section \ref tracing_tracing_functions describes all the functions available
40 when this Cmake options is activated. These functions will have no effect
41 if SimGrid is configured without this option (they are wiped-out by the
45 $ cmake -Denable_tracing=ON .
49 \subsection tracing_tracing_functions Tracing Functions
51 \li <b>\c TRACE_category (const char *category)</b>: This function should be used
52 to define a user category. The category can be used to differentiate the tasks
53 that are created during the simulation (for example, tasks from server1,
54 server2, or request tasks, computation tasks, communication tasks).
55 All resource utilization (host power and link bandwidth) will be
56 classified according to the task category. Tasks that do not belong to a
57 category are not traced. The color for the category that is being declared
58 is random (use next function to specify a color).
60 \li <b>\c TRACE_category_with_color (const char *category, const char *color)</b>: Same
61 as TRACE_category, but let user specify a color encoded as a RGB-like string with
62 three floats from 0 to 1. So, to specify a red color, the user can pass "1 0 0" as
63 color parameter. A light-gray color can be specified using "0.7 0.7 0.7" as color.
65 \li <b>\c TRACE_msg_set_task_category (m_task_t task, const char *category)</b>:
66 This function should be called after the creation of a MSG task, to define the
67 category of that task. The first parameter \c task must contain a task that was
68 created with the function \c MSG_task_create. The second parameter
69 \c category must contain a category that was previously defined by the function
72 \li <b>\c TRACE_sd_set_task_category (SD_task_t task, const char *category)</b>:
73 This function should be called after the creation of a SimDAG task, to define the
74 category of that task. The first parameter \c task must contain a task that was
75 created with the function \c MSG_task_create. The second parameter
76 \c category must contain a category that was previously defined by the function
79 \li <b>\c TRACE_declare_mark(const char *mark_type)</b>: This function
80 declares a new Paje event type in the trace file that can be used by
81 simulators to declare application-level marks. This function is
82 independent of which API is used in SimGrid.
84 \li <b>\c TRACE_mark(const char *mark_type, const char *mark_value)</b>:
85 This function creates a mark in the trace file. The first parameter
86 had to be previously declared using \c TRACE_declare_mark, the second
87 is the identifier for this mark instance. We recommend that the \c
88 mark_value (the second parameter) is a unique value for the whole
89 trace file (the whole simulation). Nevertheless, this is not a strong
90 requirement: the trace will be valid if there are multiple mark
91 identifiers for the same trace.
93 \li <b>\c TRACE_[host|link]_variable_declare (const char *variable)</b>:
94 Declare a user variable that will be associated to host/link. A variable can
95 be used to trace user variables such as the number of tasks in a server,
96 the number of clients in an application (for hosts), and so on.
98 \li <b>\c TRACE_[host|link]_variable_[set|add|sub] (const char *[host|link], const char *variable, double value)</b>:
99 Set the value of a given user variable for a given host/link. The value
100 of this variable is always associated to the host/link. The host/link
101 parameters should be its name as the one listed in the platform file.
103 \li <b>\c TRACE_[host|link]_variable_[set|add|sub]_with_time (double time, const char *[host|link], const char *variable, double value)</b>:
104 Same as TRACE_[host|link]_variable_[set|add|sub], but let user specify
105 the time used to trace it. Users can specify a time that is not the
106 simulated clock time as defined by the core simulator. This allows
107 a fine-grain control of time definition, but should be used with
108 caution since the trace can be inconsistent if resource utilization
109 traces are also traced.
111 \li <b>\c TRACE_link_srcdst_variable_[set|add|sub] (const char *src, const char *dst, const char *variable, double value)</b>:
112 Same as TRACE_link_variable_[set|add|sub], but now users specify a source and
113 destination hosts (as the names from the platform file). The tracing library
114 will get the corresponding route that connects those two hosts (src and dst) and
115 [set|add|sub] the value's variable for all the links of the route.
117 \li <b>\c TRACE_link_srcdst_variable_[set|add|sub]_with_time (double time, const char *src, const char *dst, const char *variable, double value)</b>:
118 Same as TRACE_link_srcdst_variable_[set|add|sub], but user specify a time different from the simulated time.
120 \subsection tracing_tracing_options Tracing configuration Options
122 To check which tracing options are available for your simulator, you
123 can just run it with the option <b>--help-tracing</b>. These are the
124 options accepted by the tracing system of SimGrid as of today, you
125 can use them by running your simulator with the <b>--cfg=</b> switch:
130 Safe switch. It activates (or deactivates) the tracing system.
131 No other tracing options take effect if this one is not activated.
139 It activates the categorized resource utilization tracing. It should
140 be enabled if tracing categories are used by this simulator.
142 --cfg=tracing/categorized:1
146 tracing/uncategorized
148 It activates the uncategorized resource utilization tracing. Use it if
149 this simulator do not use tracing categories and resource use have to be
152 --cfg=tracing/uncategorized:1
158 A file with this name will be created to register the simulation. The file
159 is in the Paje format and can be analyzed using Triva or Paje visualization
160 tools. More information can be found in these webpages:
161 <a href="http://triva.gforge.inria.fr/">http://triva.gforge.inria.fr/</a>
162 <a href="http://paje.sourceforge.net/">http://paje.sourceforge.net/</a>
164 --cfg=tracing/filename:mytracefile.trace
166 If you do not provide this parameter, the trace file will be named simgrid.trace.
171 By default, the tracing system uses all routes in the platform file
172 to re-create a "graph" of the platform and register it in the trace file.
173 This option let the user tell the tracing system to use only the routes
174 that are composed with just one link.
176 --cfg=tracing/onelink_only:1
182 This option only has effect if this simulator is SMPI-based. Traces the MPI
183 interface and generates a trace that can be analyzed using Gantt-like
184 visualizations. Every MPI function (implemented by SMPI) is transformed in a
185 state, and point-to-point communications can be analyzed with arrows.
193 This option only has effect if this simulator is SMPI-based. The processes
194 are grouped by the hosts where they were executed.
196 --cfg=tracing/smpi/group:1
202 This option only has effect if this simulator is MSG-based. It traces the
203 behavior of all categorized MSG tasks, grouping them by hosts.
205 --cfg=tracing/msg/task:1
211 This option only has effect if this simulator is MSG-based. It traces the
212 behavior of all categorized MSG processes, grouping them by hosts. This option
213 can be used to track process location if this simulator has process migration.
215 --cfg=tracing/msg/process:1
221 This option generates a graph configuration file for Triva considering
222 categorized resource utilization.
224 --cfg=triva/categorized:graph_categorized.plist
230 This option generates a graph configuration file for Triva considering
231 uncategorized resource utilization.
233 --cfg=triva/categorized:graph_uncategorized.plist
236 \subsection tracing_tracing_example_parameters Case studies
238 Some scenarios that might help you decide which tracing options
239 you should use to analyze your simulator.
241 \li I want to trace the resource utilization of all hosts
242 and links of the platform, and my simulator <b>does not</b> use
243 the tracing API. For that, you can run a uncategorized trace
244 with the following parameters (it will work with <b>any</b> Simgrid
249 --cfg=tracing/uncategorized:1 \
250 --cfg=tracing/filename:mytracefile.trace \
251 --cfg=triva/uncategorized:uncat.plist
254 \li I want to trace only a subset of my MSG (or SimDAG) tasks.
255 For that, you will need to create tracing categories using the
256 <b>TRACE_category (...)</b> function (as explained above),
257 and then classify your tasks to a previously declared category
258 using the <b>TRACE_msg_set_task_category (...)</b>
259 (or <b>TRACE_sd_set_task_category (...)</b> for SimDAG tasks). After
260 recompiling, run your simulator with the following parameters:
264 --cfg=tracing/categorized:1 \
265 --cfg=tracing/filename:mytracefile.trace \
266 --cfg=triva/categorized:cat.plist
270 \subsection tracing_tracing_example Example of Instrumentation
272 A simplified example using the tracing mandatory functions.
275 int main (int argc, char **argv)
277 MSG_global_init (&argc, &argv);
279 //(... after deployment ...)
281 //note that category declaration must be called after MSG_create_environment
282 TRACE_category_with_color ("request", "1 0 0");
283 TRACE_category_with_color ("computation", "0.3 1 0.4");
284 TRACE_category ("finalize");
286 m_task_t req1 = MSG_task_create("1st_request_task", 10, 10, NULL);
287 m_task_t req2 = MSG_task_create("2nd_request_task", 10, 10, NULL);
288 m_task_t req3 = MSG_task_create("3rd_request_task", 10, 10, NULL);
289 m_task_t req4 = MSG_task_create("4th_request_task", 10, 10, NULL);
290 TRACE_msg_set_task_category (req1, "request");
291 TRACE_msg_set_task_category (req2, "request");
292 TRACE_msg_set_task_category (req3, "request");
293 TRACE_msg_set_task_category (req4, "request");
295 m_task_t comp = MSG_task_create ("comp_task", 100, 100, NULL);
296 TRACE_msg_set_task_category (comp, "computation");
298 m_task_t finalize = MSG_task_create ("finalize", 0, 0, NULL);
299 TRACE_msg_set_task_category (finalize, "finalize");
308 \subsection tracing_tracing_analyzing Analyzing the SimGrid Traces
310 The SimGrid library, during an instrumented simulation, creates a trace file in
311 the Paje file format that contains the platform utilization for the simulation
312 that was executed. The visualization analysis of this file is performed with the
313 visualization tool <a href="http://triva.gforge.inria.fr">Triva</a>, with
314 special configurations tunned to SimGrid needs. This part of the documentation
315 explains how to configure and use Triva to analyse a SimGrid trace file.
317 - <b>Installing Triva</b>: the tool is available in the INRIAGforge,
318 at <a href="http://triva.gforge.inria.fr">http://triva.gforge.inria.fr</a>.
319 Use the following command to get the sources, and then check the file
320 <i>INSTALL</i>. This file contains instructions to install
321 the tool's dependencies in a Ubuntu/Debian Linux. The tool can also
322 be compiled in MacOSes natively, check <i>INSTALL.mac</i> file.
324 $ svn checkout svn://scm.gforge.inria.fr/svn/triva
329 - <b>Executing Triva</b>: a binary called <i>Triva</i> is available after the
330 installation (you can execute it passing <em>--help</em> to check its
331 options). If the triva binary is not available after following the
332 installation instructions, you may want to execute the following command to
333 initialize the GNUstep environment variables. We strongly recommend that you
334 use the latest GNUstep packages, and not the packages available through apt-get
335 in Ubuntu/Debian packaging systems. If you install GNUstep using the latest
336 available packages, you can execute this command:
338 $ source /usr/GNUstep/System/Library/Makefiles/GNUstep.sh
340 You should be able to see this output after the installation of triva:
342 $ ./Triva.app/Triva --help
343 Usage: Triva [OPTIONS...] TRACE0 [TRACE1]
344 Trace Analysis through Visualization
347 --ti_frequency {double} Animation: frequency of updates
348 --ti_hide Hide the TimeInterval window
349 --ti_forward {double} Animation: value to move time-slice
350 --ti_apply Apply the configuration
351 --ti_update Update on slider change
352 --ti_animate Start animation
353 --ti_start {double} Start of time slice
354 --ti_size {double} Size of time slice
356 --comparison Compare Trace Files (Experimental)
357 --graph Configurable Graph
358 --list Print Trace Type Hierarchy
359 --hierarchy Export Trace Type Hierarchy (dot)
360 --stat Trace Statistics and Memory Utilization
361 --instances List All Trace Entities
362 --linkview Link View (Experimental)
363 --treemap Squarified Treemap
364 --merge Merge Trace Files (Experimental)
365 --check Check Trace File Integrity
367 --gc_conf {file} Graph Configuration in Property List Format
368 --gc_apply Apply the configuration
369 --gc_hide Hide the GraphConfiguration window
371 Triva expects that the user choose one of the available options
372 (currently <em>--graph</em> or <em>--treemap</em> for a visualization analysis)
373 and the trace file from the simulation.
375 - <b>Understanding Triva - time-slice</b>: the analysis of a trace file using
376 the tool always takes into account the concept of the <em>time-slice</em>.
377 This concept means that what is being visualized in the screen is always
378 calculated considering a specific time frame, with its beggining and end
379 timestamp. The time-slice is configured by the user and can be changed
380 dynamically through the window called <em>Time Interval</em> that is opened
381 whenever a trace file is being analyzed. The next figure depicts the time-slice
382 configuration window.
383 In the top of the window, in the space named <i>Trace Time</i>,
384 the two fields show the beggining of the trace (which usually starts in 0) and
385 the end (that depends on the time simulated by SimGrid). The middle of the
386 window, in the square named <i>Time Slice Configuration</i>, contains the
387 aspects related to the time-slice, including its <i>start</i> and its
388 <i>size</i>. The gray rectangle in the bottom of this part indicates the
389 <i>current time-slice</i> that is considered for the drawings. If the checkbox
390 <i>Update Drawings on Sliders Change</i> is not selected, the button
391 <i>Apply</i> must be clicked in order to inform triva that the
392 new time-slice must be considered. The bottom part of the window, in the space
393 indicated by the square <i>Time Slice Animation</i> can be used to advance
394 the time-frame automatically. The user configures the amount of time that the
395 time-frame will forward and how frequent this update will happen. Once this is
396 configured, the user clicks the <i>Play</i> button in order to see the dynamic
397 changes on the drawings.
400 <a href="triva-time_interval.png" border=0><img src="triva-time_interval.png" width="50%" border=0></a>
403 <b>Remarks:</b> when the trace has too many hosts or links, the computation to
404 take into account a new time-slice can be expensive. When this happens, the
405 <i>Frequency</i> parameter, but also updates caused by change on configurations
406 when the checkbox <i>Update Drawings on Sliders
407 Change</i> is selected will not be followed.
409 - <b>Understanding Triva - graph</b>: this part of the documention explains how
410 to analyze the traces using the graph view of Triva, when the user executes
411 the tool passing <em>--graph</em> as parameter. Triva opens three windows when
412 this parameter is used: the <i>Time Interval</i> window (previously described),
413 the <i>Graph Representation</i> window, and the <em>Graph Configuration</em>
414 window. The Graph Representation is the window where drawings take place.
415 Initially, it is completely white waiting for a proper graph configuration input
416 by the user. We start the description of this type of analysis by describing the
417 <i>Graph Configuration</i> window (depicted below). By using a particular
419 can be used to customize the graph drawing according to
420 the SimGrid trace that was created with user-specific categories. Before delving
421 into the details of this customization, let us first explain the major parts of
422 the graph configuration window. The buttons located in the top-right corner can
423 be used to delete, copy and create a new configuration. The checkbox in the
424 top-middle part of the window indicates if the configuration typed in the
425 textfield is syntactically correct (we are using the non-XML
426 <a href="http://en.wikipedia.org/wiki/Property_list">Property List Format</a> to
427 describe the configuration). The pop-up button located on the top-left corner
428 indicates the selected configuration (the user can have multiple graph
429 configurations). The bottom-left text field contains the name of the current
430 configuration (updates on this field must be followed by typing enter on the
431 keyboard to take into account the name change). The bottom-right <em>Apply</em>
432 button activates the current configuration, resulting on an update on the graph
436 <a href="triva-graph_configuration.png" border=0><img src="triva-graph_configuration.png" width="50%" border=0></a>
439 <b>Basic SimGrid Configuration</b>: The figure shows in the big textfield the
440 basic configuration that should be used during the analysis of a SimGrid trace
441 file. The basic logic of the configuration is as follows:
447 The nodes of the graph will be created based on the <i>node</i> parameter, which
448 in this case is the different <em>"HOST"</em>s of the platform
449 used to simulate. The <i>edge</i> parameter indicates that the edges of the
450 graph will be created based on the <em>"LINK"</em>s of the platform. After the
451 definition of these two parameters, the configuration must detail how
452 <em>HOST</em>s and <em>LINK</em>s should be drawn. For that, the configuration
453 must have an entry for each of the types used. For <em>HOST</em>, as basic
454 configuration, we have:
461 The parameter <em>size</em> indicates which variable from the trace file will be
462 used to define the size of the node HOST in the visualization. If the simulation
463 was executed with availability traces, the size of the nodes will be changed
464 according to these traces. The parameter <em>scale</em> indicates if the value
465 of the variable is <em>global</em> or <em>local</em>. If it is global, the value
466 will be relative to the power of all other hosts, if it is local, the value will
468 For <em>LINK</em> we have:
478 For the types specified in the <em>edge</em> parameter (such as <em>LINK</em>),
479 the configuration must contain two additional parameters: <em>src</em> and
480 <em>dst</em> that are used to properly identify which nodes this edge is
481 connecting. The values <em>source</em> and <em>destination</em> are always present
482 in the SimGrid trace file and should not be changed in the configuration. The
483 parameter <em>size</em> for the LINK, in this case, is configured as the
484 variable <em>bandwidth</em>, with a <em>global</em> scale. The scale meaning
485 here is exactly the same used for nodes. The last parameter is the GraphViz
486 algorithm used to calculate the position of the nodes in the graph
489 graphviz-algorithm = neato;
492 <b>Customizing the Graph Representation</b>: triva is capable to handle
493 a customized graph representation based on the variables present in the trace
494 file. In the case of SimGrid, every time a category is created for tasks, two
495 variables in the trace file are defined: one to indicate node utilization (how
496 much power was used by that task category), and another to indicate link
497 utilization (how much bandwidth was used by that category). For instance, if the
498 user declares a category named <i>request</i>, there will be variables named
499 <b>p</b><i>request</i> and a <b>b</b><i>request</i> (<b>p</b> for power and
500 <b>b</b> for bandwidth). It is important to notice that the variable
501 <i>prequest</i> in this case is only available for HOST, and
502 <i>brequest</i> is only available for LINK. <b>Example</b>: suppose there are
503 two categories for tasks: request and compute. To create a customized graph
504 representation with a proportional separation of host and link utilization, use
505 as configuration for HOST and LINK this:
514 values = (prequest, pcomputation);
527 values = (brequest, bcomputation);
531 Where <i>sep_host</i> contains a composition of type <i>separation</i> where
532 its max size is the <i>power</i> of the host and the variables <i>prequest</i>
533 and <i>pcomputation</i> are drawn proportionally to the size of the HOST. And
534 <i>sep_link</i> is also a separation where max is defined as the
535 <i>bandwidth</i> of the link, and the variables <i>brequest</i> and
536 <i>bcomputation</i> are drawn proportionally within a LINK.
537 <i>This configuration enables the analysis of resource utilization by MSG tasks,
538 and the identification of load-balancing issues, network bottlenecks, for
540 <b>Other compositions</b>: besides <i>separation</i>, it is possible to use
541 other types of compositions, such as gradients, and colors, like this:
546 values = (numberOfTasks);
550 values = (is_server);
553 Where <i>gra_host</i> creates a gradient within a node of the graph, using a
554 global scale and using as value a variable called <i>numberOfTasks</i>, that
555 could be declared by the user using the optional tracing functions of SimGrid.
556 If scale is global, the max and min value for the gradient will be equal to the
557 max and min numberOfTasks among all hosts, and if scale is local, the max and
558 min value based on the value of numberOfTasks locally in each host.
559 And <i>color_host</i> composition draws a square based on a positive value of
560 the variable <i>is_server</i>, that could also be defined by the user using the
561 SimGrid tracing functions. \n
562 <b>The Graph Visualization</b>: The next figure shows a graph visualization of a
563 given time-slice of the masterslave_forwarder example (present in the SimGrid
564 sources). The red color indicates tasks from the <i>compute</i> category. This
565 visualization was generated with the following configuration:
578 values = (pcompute, pfinalize);
584 size = bandwidth;\section tracing_tracing Tracing Simulations for Visualization
586 The trace visualization is widely used to observe and understand the behavior
587 of parallel applications and distributed algorithms. Usually, this is done in a
588 two-step fashion: the user instruments the application and the traces are
589 analyzed after the end of the execution. The visualization itself can highlights
590 unexpected behaviors, bottlenecks and sometimes can be used to correct
591 distributed algorithms. The SimGrid team has instrumented the library
592 in order to let users trace their simulations and analyze them. This part of the
593 user manual explains how the tracing-related features can be enabled and used
594 during the development of simulators using the SimGrid library.
596 \subsection tracing_tracing_howitworks How it works
598 For now, the SimGrid library is instrumented so users can trace the <b>platform
599 utilization</b> using the MSG, SimDAG and SMPI interface. This means that the tracing will
600 register how much power is used for each host and how much bandwidth is used for
601 each link of the platform. The idea with this type of tracing is to observe the
602 overall view of resources utilization in the first place, especially the
603 identification of bottlenecks, load-balancing among hosts, and so on.
605 The idea of the tracing facilities is to give SimGrid users to possibility to
606 classify MSG and SimDAG tasks by category, tracing the platform utilization
607 (hosts and links) for each of the categories. For that,
608 the tracing interface enables the declaration of categories and a function to
609 mark a task with a previously declared category. <em>The tasks that are not
610 classified according to a category are not traced</em>. Even if the user
611 does not specify any category, the simulations can still be traced in terms
612 of resource utilization by using a special parameter that is detailed below.
614 \subsection tracing_tracing_enabling Enabling using CMake
616 With the sources of SimGrid, it is possible to enable the tracing
617 using the parameter <b>-Denable_tracing=ON</b> when the cmake is executed.
618 The section \ref tracing_tracing_functions describes all the functions available
619 when this Cmake options is activated. These functions will have no effect
620 if SimGrid is configured without this option (they are wiped-out by the
624 $ cmake -Denable_tracing=ON .
628 \subsection tracing_tracing_functions Tracing Functions
630 \li <b>\c TRACE_category (const char *category)</b>: This function should be used
631 to define a user category. The category can be used to differentiate the tasks
632 that are created during the simulation (for example, tasks from server1,
633 server2, or request tasks, computation tasks, communication tasks).
634 All resource utilization (host power and link bandwidth) will be
635 classified according to the task category. Tasks that do not belong to a
636 category are not traced. The color for the category that is being declared
637 is random (use next function to specify a color).
639 \li <b>\c TRACE_category_with_color (const char *category, const char *color)</b>: Same
640 as TRACE_category, but let user specify a color encoded as a RGB-like string with
641 three floats from 0 to 1. So, to specify a red color, the user can pass "1 0 0" as
642 color parameter. A light-gray color can be specified using "0.7 0.7 0.7" as color.
644 \li <b>\c TRACE_msg_set_task_category (m_task_t task, const char *category)</b>:
645 This function should be called after the creation of a MSG task, to define the
646 category of that task. The first parameter \c task must contain a task that was
647 created with the function \c MSG_task_create. The second parameter
648 \c category must contain a category that was previously defined by the function
651 \li <b>\c TRACE_sd_set_task_category (SD_task_t task, const char *category)</b>:
652 This function should be called after the creation of a SimDAG task, to define the
653 category of that task. The first parameter \c task must contain a task that was
654 created with the function \c MSG_task_create. The second parameter
655 \c category must contain a category that was previously defined by the function
658 \li <b>\c TRACE_[host|link]_variable_declare (const char *variable)</b>:
659 Declare a user variable that will be associated to host/link. A variable can
660 be used to trace user variables such as the number of tasks in a server,
661 the number of clients in an application (for hosts), and so on.
663 \li <b>\c TRACE_[host|link]_variable_[set|add|sub] (const char *[host|link], const char *variable, double value)</b>:
664 Set the value of a given user variable for a given host/link. The value
665 of this variable is always associated to the host/link. The host/link
666 parameters should be its name as the one listed in the platform file.
668 \li <b>\c TRACE_[host|link]_variable_[set|add|sub]_with_time (double time, const char *[host|link], const char *variable, double value)</b>:
669 Same as TRACE_[host|link]_variable_[set|add|sub], but let user specify
670 the time used to trace it. Users can specify a time that is not the
671 simulated clock time as defined by the core simulator. This allows
672 a fine-grain control of time definition, but should be used with
673 caution since the trace can be inconsistent if resource utilization
674 traces are also traced.
676 \li <b>\c TRACE_link_srcdst_variable_[set|add|sub] (const char *src, const char *dst, const char *variable, double value)</b>:
677 Same as TRACE_link_variable_[set|add|sub], but now users specify a source and
678 destination hosts (as the names from the platform file). The tracing library
679 will get the corresponding route that connects those two hosts (src and dst) and
680 [set|add|sub] the value's variable for all the links of the route.
682 \li <b>\c TRACE_link_srcdst_variable_[set|add|sub]_with_time (double time, const char *src, const char *dst, const char *variable, double value)</b>:
683 Same as TRACE_link_srcdst_variable_[set|add|sub], but user specify a time different from the simulated time.
685 \subsection tracing_tracing_options Tracing configuration Options
687 These are the options accepted by the tracing system of SimGrid:
692 Safe switch. It activates (or deactivates) the tracing system.
693 No other tracing options take effect if this one is not activated.
698 Register the simulation platform in the trace file.
703 By default, the tracing system uses all routes in the platform file
704 to re-create a "graph" of the platform and register it in the trace file.
705 This option let the user tell the tracing system to use only the routes
706 that are composed with just one link.
711 It activates the categorized resource utilization tracing. It should
712 be enabled if tracing categories are used by this simulator.
715 tracing/uncategorized
717 It activates the uncategorized resource utilization tracing. Use it if
718 this simulator do not use tracing categories and resource use have to be
724 A file with this name will be created to register the simulation. The file
725 is in the Paje format and can be analyzed using Triva or Paje visualization
726 tools. More information can be found in these webpages:
727 <a href="http://triva.gforge.inria.fr/">http://triva.gforge.inria.fr/</a>
728 <a href="http://paje.sourceforge.net/">http://paje.sourceforge.net/</a>
733 This option only has effect if this simulator is SMPI-based. Traces the MPI
734 interface and generates a trace that can be analyzed using Gantt-like
735 visualizations. Every MPI function (implemented by SMPI) is transformed in a
736 state, and point-to-point communications can be analyzed with arrows.
741 This option only has effect if this simulator is SMPI-based. The processes
742 are grouped by the hosts where they were executed.
747 This option only has effect if this simulator is MSG-based. It traces the
748 behavior of all categorized MSG tasks, grouping them by hosts.
753 This option only has effect if this simulator is MSG-based. It traces the
754 behavior of all categorized MSG processes, grouping them by hosts. This option
755 can be used to track process location if this simulator has process migration.
759 triva/categorized:graph_categorized.plist
761 This option generates a graph configuration file for Triva considering
762 categorized resource utilization.
765 triva/uncategorized:graph_uncategorized.plist
767 This option generates a graph configuration file for Triva considering
768 uncategorized resource utilization.
770 \subsection tracing_tracing_example Example of Instrumentation
772 A simplified example using the tracing mandatory functions.
775 int main (int argc, char **argv)
777 MSG_global_init (&argc, &argv);
779 //(... after deployment ...)
781 //note that category declaration must be called after MSG_create_environment
782 TRACE_category_with_color ("request", "1 0 0");
783 TRACE_category_with_color ("computation", "0.3 1 0.4");
784 TRACE_category ("finalize");
786 m_task_t req1 = MSG_task_create("1st_request_task", 10, 10, NULL);
787 m_task_t req2 = MSG_task_create("2nd_request_task", 10, 10, NULL);
788 m_task_t req3 = MSG_task_create("3rd_request_task", 10, 10, NULL);
789 m_task_t req4 = MSG_task_create("4th_request_task", 10, 10, NULL);
790 TRACE_msg_set_task_category (req1, "request");
791 TRACE_msg_set_task_category (req2, "request");
792 TRACE_msg_set_task_category (req3, "request");
793 TRACE_msg_set_task_category (req4, "request");
795 m_task_t comp = MSG_task_create ("comp_task", 100, 100, NULL);
796 TRACE_msg_set_task_category (comp, "computation");
798 m_task_t finalize = MSG_task_create ("finalize", 0, 0, NULL);
799 TRACE_msg_set_task_category (finalize, "finalize");
808 \subsection tracing_tracing_analyzing Analyzing the SimGrid Traces
810 The SimGrid library, during an instrumented simulation, creates a trace file in
811 the Paje file format that contains the platform utilization for the simulation
812 that was executed. The visualization analysis of this file is performed with the
813 visualization tool <a href="http://triva.gforge.inria.fr">Triva</a>, with
814 special configurations tunned to SimGrid needs. This part of the documentation
815 explains how to configure and use Triva to analyse a SimGrid trace file.
817 - <b>Installing Triva</b>: the tool is available in the INRIAGforge,
818 at <a href="http://triva.gforge.inria.fr">http://triva.gforge.inria.fr</a>.
819 Use the following command to get the sources, and then check the file
820 <i>INSTALL</i>. This file contains instructions to install
821 the tool's dependencies in a Ubuntu/Debian Linux. The tool can also
822 be compiled in MacOSes natively, check <i>INSTALL.mac</i> file.
824 $ svn checkout svn://scm.gforge.inria.fr/svn/triva
829 - <b>Executing Triva</b>: a binary called <i>Triva</i> is available after the
830 installation (you can execute it passing <em>--help</em> to check its
831 options). If the triva binary is not available after following the
832 installation instructions, you may want to execute the following command to
833 initialize the GNUstep environment variables. We strongly recommend that you
834 use the latest GNUstep packages, and not the packages available through apt-get
835 in Ubuntu/Debian packaging systems. If you install GNUstep using the latest
836 available packages, you can execute this command:
838 $ source /usr/GNUstep/System/Library/Makefiles/GNUstep.sh
840 You should be able to see this output after the installation of triva:
842 $ ./Triva.app/Triva --help
843 Usage: Triva [OPTIONS...] TRACE0 [TRACE1]
844 Trace Analysis through Visualization
847 --ti_frequency {double} Animation: frequency of updates
848 --ti_hide Hide the TimeInterval window
849 --ti_forward {double} Animation: value to move time-slice
850 --ti_apply Apply the configuration
851 --ti_update Update on slider change
852 --ti_animate Start animation
853 --ti_start {double} Start of time slice
854 --ti_size {double} Size of time slice
856 --comparison Compare Trace Files (Experimental)
857 --graph Configurable Graph
858 --list Print Trace Type Hierarchy
859 --hierarchy Export Trace Type Hierarchy (dot)
860 --stat Trace Statistics and Memory Utilization
861 --instances List All Trace Entities
862 --linkview Link View (Experimental)
863 --treemap Squarified Treemap
864 --merge Merge Trace Files (Experimental)
865 --check Check Trace File Integrity
867 --gc_conf {file} Graph Configuration in Property List Format
868 --gc_apply Apply the configuration
869 --gc_hide Hide the GraphConfiguration window
871 Triva expects that the user choose one of the available options
872 (currently <em>--graph</em> or <em>--treemap</em> for a visualization analysis)
873 and the trace file from the simulation.
875 - <b>Understanding Triva - time-slice</b>: the analysis of a trace file using
876 the tool always takes into account the concept of the <em>time-slice</em>.
877 This concept means that what is being visualized in the screen is always
878 calculated considering a specific time frame, with its beggining and end
879 timestamp. The time-slice is configured by the user and can be changed
880 dynamically through the window called <em>Time Interval</em> that is opened
881 whenever a trace file is being analyzed. The next figure depicts the time-slice
882 configuration window.
883 In the top of the window, in the space named <i>Trace Time</i>,
884 the two fields show the beggining of the trace (which usually starts in 0) and
885 the end (that depends on the time simulated by SimGrid). The middle of the
886 window, in the square named <i>Time Slice Configuration</i>, contains the
887 aspects related to the time-slice, including its <i>start</i> and its
888 <i>size</i>. The gray rectangle in the bottom of this part indicates the
889 <i>current time-slice</i> that is considered for the drawings. If the checkbox
890 <i>Update Drawings on Sliders Change</i> is not selected, the button
891 <i>Apply</i> must be clicked in order to inform triva that the
892 new time-slice must be considered. The bottom part of the window, in the space
893 indicated by the square <i>Time Slice Animation</i> can be used to advance
894 the time-frame automatically. The user configures the amount of time that the
895 time-frame will forward and how frequent this update will happen. Once this is
896 configured, the user clicks the <i>Play</i> button in order to see the dynamic
897 changes on the drawings.
900 <a href="triva-time_interval.png" border=0><img src="triva-time_interval.png" width="50%" border=0></a>
903 <b>Remarks:</b> when the trace has too many hosts or links, the computation to
904 take into account a new time-slice can be expensive. When this happens, the
905 <i>Frequency</i> parameter, but also updates caused by change on configurations
906 when the checkbox <i>Update Drawings on Sliders
907 Change</i> is selected will not be followed.
909 - <b>Understanding Triva - graph</b>: this part of the documention explains how
910 to analyze the traces using the graph view of Triva, when the user executes
911 the tool passing <em>--graph</em> as parameter. Triva opens three windows when
912 this parameter is used: the <i>Time Interval</i> window (previously described),
913 the <i>Graph Representation</i> window, and the <em>Graph Configuration</em>
914 window. The Graph Representation is the window where drawings take place.
915 Initially, it is completely white waiting for a proper graph configuration input
916 by the user. We start the description of this type of analysis by describing the
917 <i>Graph Configuration</i> window (depicted below). By using a particular
919 can be used to customize the graph drawing according to
920 the SimGrid trace that was created with user-specific categories. Before delving
921 into the details of this customization, let us first explain the major parts of
922 the graph configuration window. The buttons located in the top-right corner can
923 be used to delete, copy and create a new configuration. The checkbox in the
924 top-middle part of the window indicates if the configuration typed in the
925 textfield is syntactically correct (we are using the non-XML
926 <a href="http://en.wikipedia.org/wiki/Property_list">Property List Format</a> to
927 describe the configuration). The pop-up button located on the top-left corner
928 indicates the selected configuration (the user can have multiple graph
929 configurations). The bottom-left text field contains the name of the current
930 configuration (updates on this field must be followed by typing enter on the
931 keyboard to take into account the name change). The bottom-right <em>Apply</em>
932 button activates the current configuration, resulting on an update on the graph
936 <a href="triva-graph_configuration.png" border=0><img src="triva-graph_configuration.png" width="50%" border=0></a>
939 <b>Basic SimGrid Configuration</b>: The figure shows in the big textfield the
940 basic configuration that should be used during the analysis of a SimGrid trace
941 file. The basic logic of the configuration is as follows:
947 The nodes of the graph will be created based on the <i>node</i> parameter, which
948 in this case is the different <em>"HOST"</em>s of the platform
949 used to simulate. The <i>edge</i> parameter indicates that the edges of the
950 graph will be created based on the <em>"LINK"</em>s of the platform. After the
951 definition of these two parameters, the configuration must detail how
952 <em>HOST</em>s and <em>LINK</em>s should be drawn. For that, the configuration
953 must have an entry for each of the types used. For <em>HOST</em>, as basic
954 configuration, we have:
961 The parameter <em>size</em> indicates which variable from the trace file will be
962 used to define the size of the node HOST in the visualization. If the simulation
963 was executed with availability traces, the size of the nodes will be changed
964 according to these traces. The parameter <em>scale</em> indicates if the value
965 of the variable is <em>global</em> or <em>local</em>. If it is global, the value
966 will be relative to the power of all other hosts, if it is local, the value will
968 For <em>LINK</em> we have:
978 For the types specified in the <em>edge</em> parameter (such as <em>LINK</em>),
979 the configuration must contain two additional parameters: <em>src</em> and
980 <em>dst</em> that are used to properly identify which nodes this edge is
981 connecting. The values <em>source</em> and <em>destination</em> are always present
982 in the SimGrid trace file and should not be changed in the configuration. The
983 parameter <em>size</em> for the LINK, in this case, is configured as the
984 variable <em>bandwidth</em>, with a <em>global</em> scale. The scale meaning
985 here is exactly the same used for nodes. The last parameter is the GraphViz
986 algorithm used to calculate the position of the nodes in the graph
989 graphviz-algorithm = neato;
992 <b>Customizing the Graph Representation</b>: triva is capable to handle
993 a customized graph representation based on the variables present in the trace
994 file. In the case of SimGrid, every time a category is created for tasks, two
995 variables in the trace file are defined: one to indicate node utilization (how
996 much power was used by that task category), and another to indicate link
997 utilization (how much bandwidth was used by that category). For instance, if the
998 user declares a category named <i>request</i>, there will be variables named
999 <b>p</b><i>request</i> and a <b>b</b><i>request</i> (<b>p</b> for power and
1000 <b>b</b> for bandwidth). It is important to notice that the variable
1001 <i>prequest</i> in this case is only available for HOST, and
1002 <i>brequest</i> is only available for LINK. <b>Example</b>: suppose there are
1003 two categories for tasks: request and compute. To create a customized graph
1004 representation with a proportional separation of host and link utilization, use
1005 as configuration for HOST and LINK this:
1014 values = (prequest, pcomputation);
1027 values = (brequest, bcomputation);
1031 Where <i>sep_host</i> contains a composition of type <i>separation</i> where
1032 its max size is the <i>power</i> of the host and the variables <i>prequest</i>
1033 and <i>pcomputation</i> are drawn proportionally to the size of the HOST. And
1034 <i>sep_link</i> is also a separation where max is defined as the
1035 <i>bandwidth</i> of the link, and the variables <i>brequest</i> and
1036 <i>bcomputation</i> are drawn proportionally within a LINK.
1037 <i>This configuration enables the analysis of resource utilization by MSG tasks,
1038 and the identification of load-balancing issues, network bottlenecks, for
1040 <b>Other compositions</b>: besides <i>separation</i>, it is possible to use
1041 other types of compositions, such as gradients, and colors, like this:
1046 values = (numberOfTasks);
1050 values = (is_server);
1053 Where <i>gra_host</i> creates a gradient within a node of the graph, using a
1054 global scale and using as value a variable called <i>numberOfTasks</i>, that
1055 could be declared by the user using the optional tracing functions of SimGrid.
1056 If scale is global, the max and min value for the gradient will be equal to the
1057 max and min numberOfTasks among all hosts, and if scale is local, the max and
1058 min value based on the value of numberOfTasks locally in each host.
1059 And <i>color_host</i> composition draws a square based on a positive value of
1060 the variable <i>is_server</i>, that could also be defined by the user using the
1061 SimGrid tracing functions. \n
1062 <b>The Graph Visualization</b>: The next figure shows a graph visualization of a
1063 given time-slice of the masterslave_forwarder example (present in the SimGrid
1064 sources). The red color indicates tasks from the <i>compute</i> category. This
1065 visualization was generated with the following configuration:
1078 values = (pcompute, pfinalize);
1090 values = (bcompute, bfinalize);
1093 graphviz-algorithm = neato;
1098 <a href="triva-graph_visualization.png" border=0><img src="triva-graph_visualization.png" width="50%" border=0></a>
1102 - <b>Understading Triva - colors</b>: An important issue when using Triva is how
1103 to define colors. To do that, we have to know which variables are defined in
1104 the trace file generated by the SimGrid library. The parameter <em>--list</em>
1105 lists the variables for a given trace file:
1107 $ Triva -l masterslave_forwarder.trace
1125 We can see that HOST has seven variables (from power to pfinalize) and LINK has
1126 four (from bandwidth to bfinalize). To define a red color for the
1127 <i>pcompute</i> and <i>bcompute</i> (which are defined based on user category
1128 <i>compute</i>), execute:
1130 $ defaults write Triva 'pcompute Color' '1 0 0'
1131 $ defaults write Triva 'bcompute Color' '1 0 0'
1133 Where the three numbers in each line are the RGB color with values from 0 to 1.
1140 values = (bcompute, bfinalize);
1143 graphviz-algorithm = neato;
1148 <a href="triva-graph_visualization.png" border=0><img src="triva-graph_visualization.png" width="50%" border=0></a>
1152 - <b>Understading Triva - colors</b>: An important issue when using Triva is how
1153 to define colors. To do that, we have to know which variables are defined in
1154 the trace file generated by the SimGrid library. The parameter <em>--list</em>
1155 lists the variables for a given trace file:
1157 $ Triva -l masterslave_forwarder.trace
1175 We can see that HOST has seven variables (from power to pfinalize) and LINK has
1176 four (from bandwidth to bfinalize). To define a red color for the
1177 <i>pcompute</i> and <i>bcompute</i> (which are defined based on user category
1178 <i>compute</i>), execute:
1180 $ defaults write Triva 'pcompute Color' '1 0 0'
1181 $ defaults write Triva 'bcompute Color' '1 0 0'
1183 Where the three numbers in each line are the RGB color with values from 0 to 1.