Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[SMPI] Introduce smpi/trace-call-location cfg-switch
[simgrid.git] / src / instr / instr_paje_header.cpp
1 /* Copyright (c) 2010, 2012-2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include "src/instr/instr_private.h"
8 #include "simgrid/sg_config.h"
9
10 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_paje_header, instr, "Paje tracing event system (header)");
11
12 extern FILE *tracing_file;
13
14 static void TRACE_header_PajeDefineContainerType (int basic, int size)
15 {
16   fprintf(tracing_file, "%%EventDef PajeDefineContainerType %d\n", PAJE_DefineContainerType);
17   fprintf(tracing_file, "%%       Alias string\n");
18   if (basic){
19     fprintf(tracing_file, "%%       ContainerType string\n");
20   }else{
21     fprintf(tracing_file, "%%       Type string\n");
22   }
23   fprintf(tracing_file, "%%       Name string\n");
24   fprintf(tracing_file, "%%EndEventDef\n");
25 }
26
27 static void TRACE_header_PajeDefineVariableType (int basic, int size)
28 {
29   fprintf(tracing_file, "%%EventDef PajeDefineVariableType %d\n", PAJE_DefineVariableType);
30   fprintf(tracing_file, "%%       Alias string\n");
31   if (basic){
32     fprintf(tracing_file, "%%       ContainerType string\n");
33   }else{
34     fprintf(tracing_file, "%%       Type string\n");
35   }
36   fprintf(tracing_file, "%%       Name string\n");
37   fprintf(tracing_file, "%%       Color color\n");
38   fprintf(tracing_file, "%%EndEventDef\n");
39 }
40
41 static void TRACE_header_PajeDefineStateType (int basic, int size)
42 {
43   fprintf(tracing_file, "%%EventDef PajeDefineStateType %d\n", PAJE_DefineStateType);
44   fprintf(tracing_file, "%%       Alias string\n");
45   if (basic){
46     fprintf(tracing_file, "%%       ContainerType string\n");
47   }else{
48     fprintf(tracing_file, "%%       Type string\n");
49   }
50   fprintf(tracing_file, "%%       Name string\n");
51   fprintf(tracing_file, "%%EndEventDef\n");
52 }
53
54 static void TRACE_header_PajeDefineEventType (int basic, int size)
55 {
56   fprintf(tracing_file, "%%EventDef PajeDefineEventType %d\n", PAJE_DefineEventType);
57   fprintf(tracing_file, "%%       Alias string\n");
58   if (basic){
59     fprintf(tracing_file, "%%       ContainerType string\n");
60   }else{
61     fprintf(tracing_file, "%%       Type string\n");
62   }
63   fprintf(tracing_file, "%%       Name string\n");
64   fprintf(tracing_file, "%%EndEventDef\n");
65 }
66
67 static void TRACE_header_PajeDefineLinkType (int basic, int size)
68 {
69   fprintf(tracing_file, "%%EventDef PajeDefineLinkType %d\n", PAJE_DefineLinkType);
70   fprintf(tracing_file, "%%       Alias string\n");
71   if (basic){
72     fprintf(tracing_file, "%%       ContainerType string\n");
73     fprintf(tracing_file, "%%       SourceContainerType string\n");
74     fprintf(tracing_file, "%%       DestContainerType string\n");
75   }else{
76     fprintf(tracing_file, "%%       Type string\n");
77     fprintf(tracing_file, "%%       StartContainerType string\n");
78     fprintf(tracing_file, "%%       EndContainerType string\n");
79   }
80   fprintf(tracing_file, "%%       Name string\n");
81   fprintf(tracing_file, "%%EndEventDef\n");
82 }
83
84 static void TRACE_header_PajeDefineEntityValue (int basic, int size)
85 {
86   fprintf(tracing_file, "%%EventDef PajeDefineEntityValue %d\n", PAJE_DefineEntityValue);
87   fprintf(tracing_file, "%%       Alias string\n");
88   if (basic){
89     fprintf(tracing_file, "%%       EntityType string\n");
90   }else{
91     fprintf(tracing_file, "%%       Type string\n");
92   }
93   fprintf(tracing_file, "%%       Name string\n");
94   fprintf(tracing_file, "%%       Color color\n");
95   fprintf(tracing_file, "%%EndEventDef\n");
96 }
97
98 static void TRACE_header_PajeCreateContainer (int basic, int size)
99 {
100   fprintf(tracing_file, "%%EventDef PajeCreateContainer %d\n", PAJE_CreateContainer);
101   fprintf(tracing_file, "%%       Time date\n");
102   fprintf(tracing_file, "%%       Alias string\n");
103   fprintf(tracing_file, "%%       Type string\n");
104   fprintf(tracing_file, "%%       Container string\n");
105   fprintf(tracing_file, "%%       Name string\n");
106   fprintf(tracing_file, "%%EndEventDef\n");
107 }
108
109 static void TRACE_header_PajeDestroyContainer (int basic, int size)
110 {
111   fprintf(tracing_file, "%%EventDef PajeDestroyContainer %d\n", PAJE_DestroyContainer);
112   fprintf(tracing_file, "%%       Time date\n");
113   fprintf(tracing_file, "%%       Type string\n");
114   fprintf(tracing_file, "%%       Name string\n");
115   fprintf(tracing_file, "%%EndEventDef\n");
116 }
117
118 static void TRACE_header_PajeSetVariable (int basic, int size)
119 {
120   fprintf(tracing_file, "%%EventDef PajeSetVariable %d\n", PAJE_SetVariable);
121   fprintf(tracing_file, "%%       Time date\n");
122   fprintf(tracing_file, "%%       Type string\n");
123   fprintf(tracing_file, "%%       Container string\n");
124   fprintf(tracing_file, "%%       Value double\n");
125   fprintf(tracing_file, "%%EndEventDef\n");
126 }
127
128 static void TRACE_header_PajeAddVariable (int basic, int size)
129 {
130   fprintf(tracing_file, "%%EventDef PajeAddVariable %d\n", PAJE_AddVariable);
131   fprintf(tracing_file, "%%       Time date\n");
132   fprintf(tracing_file, "%%       Type string\n");
133   fprintf(tracing_file, "%%       Container string\n");
134   fprintf(tracing_file, "%%       Value double\n");
135   fprintf(tracing_file, "%%EndEventDef\n");
136 }
137
138 static void TRACE_header_PajeSubVariable (int basic, int size)
139 {
140   fprintf(tracing_file, "%%EventDef PajeSubVariable %d\n", PAJE_SubVariable);
141   fprintf(tracing_file, "%%       Time date\n");
142   fprintf(tracing_file, "%%       Type string\n");
143   fprintf(tracing_file, "%%       Container string\n");
144   fprintf(tracing_file, "%%       Value double\n");
145   fprintf(tracing_file, "%%EndEventDef\n");
146 }
147
148
149 static void TRACE_header_PajeSetState (int basic, int size)
150 {
151   fprintf(tracing_file, "%%EventDef PajeSetState %d\n", PAJE_SetState);
152   fprintf(tracing_file, "%%       Time date\n");
153   fprintf(tracing_file, "%%       Type string\n");
154   fprintf(tracing_file, "%%       Container string\n");
155   fprintf(tracing_file, "%%       Value string\n");
156   fprintf(tracing_file, "%%EndEventDef\n");
157 }
158
159 static void TRACE_header_PajePushState (int basic, int size)
160 {
161   fprintf(tracing_file, "%%EventDef PajePushState %d\n", PAJE_PushState);
162   fprintf(tracing_file, "%%       Time date\n");
163   fprintf(tracing_file, "%%       Type string\n");
164   fprintf(tracing_file, "%%       Container string\n");
165   fprintf(tracing_file, "%%       Value string\n");
166   if (size) fprintf(tracing_file, "%%       Size int\n");
167   if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
168     fprintf(tracing_file, "%%       Filename string\n");
169     fprintf(tracing_file, "%%       Linenumber int\n");
170   }
171   fprintf(tracing_file, "%%EndEventDef\n");
172 }
173
174 static void TRACE_header_PajePopState (int basic, int size)
175 {
176   fprintf(tracing_file, "%%EventDef PajePopState %d\n", PAJE_PopState);
177   fprintf(tracing_file, "%%       Time date\n");
178   fprintf(tracing_file, "%%       Type string\n");
179   fprintf(tracing_file, "%%       Container string\n");
180   fprintf(tracing_file, "%%EndEventDef\n");
181 }
182
183 static void TRACE_header_PajeResetState (int basic, int size)
184 {
185   if (basic) return;
186
187   fprintf(tracing_file, "%%EventDef PajeResetState %d\n", PAJE_ResetState);
188   fprintf(tracing_file, "%%       Time date\n");
189   fprintf(tracing_file, "%%       Type string\n");
190   fprintf(tracing_file, "%%       Container string\n");
191   fprintf(tracing_file, "%%EndEventDef\n");
192 }
193
194 static void TRACE_header_PajeStartLink (int basic, int size)
195 {
196   fprintf(tracing_file, "%%EventDef PajeStartLink %d\n", PAJE_StartLink);
197   fprintf(tracing_file, "%%       Time date\n");
198   fprintf(tracing_file, "%%       Type string\n");
199   fprintf(tracing_file, "%%       Container string\n");
200   fprintf(tracing_file, "%%       Value string\n");
201   if (basic){
202     fprintf(tracing_file, "%%       SourceContainer string\n");
203   }else{
204     fprintf(tracing_file, "%%       StartContainer string\n");
205   }
206   fprintf(tracing_file, "%%       Key string\n");
207   if (size) fprintf(tracing_file, "%%       Size int\n");
208   fprintf(tracing_file, "%%EndEventDef\n");
209 }
210
211 static void TRACE_header_PajeEndLink (int basic, int size)
212 {
213   fprintf(tracing_file, "%%EventDef PajeEndLink %d\n", PAJE_EndLink);
214   fprintf(tracing_file, "%%       Time date\n");
215   fprintf(tracing_file, "%%       Type string\n");
216   fprintf(tracing_file, "%%       Container string\n");
217   fprintf(tracing_file, "%%       Value string\n");
218   if (basic){
219     fprintf(tracing_file, "%%       DestContainer string\n");
220   }else{
221     fprintf(tracing_file, "%%       EndContainer string\n");
222   }
223   fprintf(tracing_file, "%%       Key string\n");
224   fprintf(tracing_file, "%%EndEventDef\n");
225 }
226
227 static void TRACE_header_PajeNewEvent (int basic, int size)
228 {
229   fprintf(tracing_file, "%%EventDef PajeNewEvent %d\n", PAJE_NewEvent);
230   fprintf(tracing_file, "%%       Time date\n");
231   fprintf(tracing_file, "%%       Type string\n");
232   fprintf(tracing_file, "%%       Container string\n");
233   fprintf(tracing_file, "%%       Value string\n");
234   fprintf(tracing_file, "%%EndEventDef\n");
235 }
236
237 void TRACE_header(int basic, int size)
238 {
239   XBT_DEBUG ("Define paje header");
240   TRACE_header_PajeDefineContainerType (basic, size);
241   TRACE_header_PajeDefineVariableType (basic, size);
242   TRACE_header_PajeDefineStateType (basic, size);
243   TRACE_header_PajeDefineEventType (basic, size);
244   TRACE_header_PajeDefineLinkType (basic, size);
245   TRACE_header_PajeDefineEntityValue (basic, size);
246   TRACE_header_PajeCreateContainer (basic, size);
247   TRACE_header_PajeDestroyContainer (basic, size);
248   TRACE_header_PajeSetVariable (basic, size);
249   TRACE_header_PajeAddVariable (basic, size);
250   TRACE_header_PajeSubVariable (basic, size);
251   TRACE_header_PajeSetState (basic, size);
252   TRACE_header_PajePushState (basic, size);
253   TRACE_header_PajePopState (basic, size);
254   TRACE_header_PajeResetState (basic, size);
255   TRACE_header_PajeStartLink (basic, size);
256   TRACE_header_PajeEndLink (basic, size);
257   TRACE_header_PajeNewEvent (basic, size);
258 }