Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Set sources files generated.
[simgrid.git] / README.tracing
1              =======
2 instrumented SimGrid
3              =======
4
5 In order to trace the simulators created with the SimGrid toolkit and based on
6 the MSG interface, you have to enable the instrumentation mechanisms with this
7 option to the configure command (in addition to other options you may be already
8 using):
9
10 $ ./configure --enable-tracing
11
12 By doing that, you will have access to a set of tracing functions that are
13 described below. You can keep the calls for these functions in your code even if
14 SimGrid was compiled without this configuration option.
15
16 Mandatory functions:
17 =========
18
19 int TRACE_start(const char *filename);
20
21         This is the first function to be called. It receives a single argument
22         as parameter that contains the name of the file that will hold the trace
23         in the end of the simulation. It returns 1 if everything was properly
24         initialized, 0 otherwise. All trace functions called before TRACE_start
25         do nothing. By default, the instrumentation will trace the platform
26         behavior (host and link utilization).
27
28 int TRACE_end (void);
29
30         This is the last function to be called. It closes the trace file and
31         disable the tracing of the simulation. All trace functions called after
32         TRACE_end do nothing.
33
34 void TRACE_category (const char *category);
35
36         This function should be used to define a user category. The category can
37         be used to differentiate the tasks that are created during the
38         simulation (for example, tasks from server1, server2, ...). All resource
39         utilization (host power and link bandwidth) will be classified according
40         to the task category. Tasks that do not belong to a category are not
41         traced.
42
43 void TRACE_msg_set_task_category (m_task_t task, const char *category);
44
45         This function should be called after the creation of a task, to define
46         the category of that task. Only tasks with a category are traced when
47         TRACE_TASK is used as mask.
48
49
50 Optional functions (that can be used if necessary):
51 ========
52
53 void TRACE_set_mask (int mask);
54
55         This function can be used to control what is traced during the
56         simulation. The user has four masks that can be used:
57                 - TRACE_PLATFORM - trace resource (host,link) utilization
58                 - TRACE_PROCESS - trace process behavior (suspend, execute)
59                 - TRACE_TASK - trace task behavior (created, execute, comm)
60                 - NO_TRACE - can be used to disable the traces for a moment
61         The platform mask must be present in order to trace processes or tasks.
62
63 void TRACE_start_with_mask (const char *filename, int mask);
64
65         This function can be used to start the tracing with a different mask
66         and replaces the use of TRACE_start. The initial mask defined with this
67         function cannot be "extended" later with the TRACE_set_mask function.
68         This means that if TRACE_start_with_mask is called with the mask 
69         (TRACE_PLATFORM|TRACE_TASK), the user cannot set the mask later to
70         (TRACE_PLATFORM|TRACE_PROCESS), for instance. The best combinations of
71         mask for tracing the current instrumentation are:
72                 - (TRACE_PLATFORM|TRACE_TASK) or
73                         Tasks are grouped by hosts.
74                 - (TRACE_PLATFORM|TRACE_PROCESS) or
75                         Processes are grouped by hosts.
76                 - (TRACE_PLATFORM|TRACE_PROCESS|TRACE_TASK)
77                         Processes are grouped by hosts, tasks by processes.
78         Only tasks and processes belonging to a category are traced.
79
80 void TRACE_host_variable_declare (const char *variable);
81
82         Declare a user variable that will be associated to the host. 
83
84 void TRACE_host_variable_set (const char *variable, double value);
85 void TRACE_host_variable_add (const char *variable, double value);
86 void TRACE_host_variable_sub (const char *variable, double value);
87
88         Set the value of a given user variable. It is important to remind that
89         the value of this variable is always associated to the host. The host
90         that will be used when these functions are called is the one returned by
91         the function MSG_host_self().
92
93 void TRACE_define_type (const char *type,
94                                 const char *parent_type,
95                                 int final);
96
97         This function allows the definition of a type hierarchy that can be used
98         to create different categories. This root of the type hierarchy is
99         defined as "0", so the first level of type must be child of the type
100         "0". The boolean parameter final (1 or 0) indicates if the categories
101         of a given type will be used to mark MSG tasks or not. This is used to
102         differentiate types that are defined only to group other types.
103
104 void TRACE_create_category (const char *category,
105                                         const char *type,
106                                         const char *parent_category);
107
108         This functions allows the creation of categories and a hierarchy of
109         categories. Each category created with this function (first parameter)
110         must belong to a given type previously defined with the
111         TRACE_define_type. It has to be also a child of a previously created
112         category, which is indicated by the parent_category. The user can
113         created categories that are child of "0" if the type of this newly
114         created category is also child of the type "0" (as defined by
115         TRACE_define_type).
116
117 void TRACE_msg_set_process_category (m_process_t process, const char *category);
118
119         This function can be used to define the category of a process. The same
120         categories declared for tasks can be used here. After setting the
121         category of a process and enabling the mask TRACE_PROCESS, the
122         instrumentation will trace the process behavior, such as the states for
123         execution, suspend, and so on. Only processes with categories are traced
124         when TRACE_PROCESS is enabled.