Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of https://github.com/mpoquet/simgrid
[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 HAVE_SMPI
168   if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
169     /**
170      * paje currently (May 2016) uses "Filename" and "Linenumber" as
171      * reserved words. We cannot use them...
172      */
173     fprintf(tracing_file, "%%       Fname string\n");
174     fprintf(tracing_file, "%%       Lnumber int\n");
175   }
176 #endif
177   fprintf(tracing_file, "%%EndEventDef\n");
178 }
179
180 static void TRACE_header_PajePopState (int basic, int size)
181 {
182   fprintf(tracing_file, "%%EventDef PajePopState %d\n", PAJE_PopState);
183   fprintf(tracing_file, "%%       Time date\n");
184   fprintf(tracing_file, "%%       Type string\n");
185   fprintf(tracing_file, "%%       Container string\n");
186   fprintf(tracing_file, "%%EndEventDef\n");
187 }
188
189 static void TRACE_header_PajeResetState (int basic, int size)
190 {
191   if (basic) return;
192
193   fprintf(tracing_file, "%%EventDef PajeResetState %d\n", PAJE_ResetState);
194   fprintf(tracing_file, "%%       Time date\n");
195   fprintf(tracing_file, "%%       Type string\n");
196   fprintf(tracing_file, "%%       Container string\n");
197   fprintf(tracing_file, "%%EndEventDef\n");
198 }
199
200 static void TRACE_header_PajeStartLink (int basic, int size)
201 {
202   fprintf(tracing_file, "%%EventDef PajeStartLink %d\n", PAJE_StartLink);
203   fprintf(tracing_file, "%%       Time date\n");
204   fprintf(tracing_file, "%%       Type string\n");
205   fprintf(tracing_file, "%%       Container string\n");
206   fprintf(tracing_file, "%%       Value string\n");
207   if (basic){
208     fprintf(tracing_file, "%%       SourceContainer string\n");
209   }else{
210     fprintf(tracing_file, "%%       StartContainer string\n");
211   }
212   fprintf(tracing_file, "%%       Key string\n");
213   if (size) fprintf(tracing_file, "%%       Size int\n");
214   fprintf(tracing_file, "%%EndEventDef\n");
215 }
216
217 static void TRACE_header_PajeEndLink (int basic, int size)
218 {
219   fprintf(tracing_file, "%%EventDef PajeEndLink %d\n", PAJE_EndLink);
220   fprintf(tracing_file, "%%       Time date\n");
221   fprintf(tracing_file, "%%       Type string\n");
222   fprintf(tracing_file, "%%       Container string\n");
223   fprintf(tracing_file, "%%       Value string\n");
224   if (basic){
225     fprintf(tracing_file, "%%       DestContainer string\n");
226   }else{
227     fprintf(tracing_file, "%%       EndContainer string\n");
228   }
229   fprintf(tracing_file, "%%       Key string\n");
230   fprintf(tracing_file, "%%EndEventDef\n");
231 }
232
233 static void TRACE_header_PajeNewEvent (int basic, int size)
234 {
235   fprintf(tracing_file, "%%EventDef PajeNewEvent %d\n", PAJE_NewEvent);
236   fprintf(tracing_file, "%%       Time date\n");
237   fprintf(tracing_file, "%%       Type string\n");
238   fprintf(tracing_file, "%%       Container string\n");
239   fprintf(tracing_file, "%%       Value string\n");
240   fprintf(tracing_file, "%%EndEventDef\n");
241 }
242
243 void TRACE_header(int basic, int size)
244 {
245   XBT_DEBUG ("Define paje header");
246   TRACE_header_PajeDefineContainerType (basic, size);
247   TRACE_header_PajeDefineVariableType (basic, size);
248   TRACE_header_PajeDefineStateType (basic, size);
249   TRACE_header_PajeDefineEventType (basic, size);
250   TRACE_header_PajeDefineLinkType (basic, size);
251   TRACE_header_PajeDefineEntityValue (basic, size);
252   TRACE_header_PajeCreateContainer (basic, size);
253   TRACE_header_PajeDestroyContainer (basic, size);
254   TRACE_header_PajeSetVariable (basic, size);
255   TRACE_header_PajeAddVariable (basic, size);
256   TRACE_header_PajeSubVariable (basic, size);
257   TRACE_header_PajeSetState (basic, size);
258   TRACE_header_PajePushState (basic, size);
259   TRACE_header_PajePopState (basic, size);
260   TRACE_header_PajeResetState (basic, size);
261   TRACE_header_PajeStartLink (basic, size);
262   TRACE_header_PajeEndLink (basic, size);
263   TRACE_header_PajeNewEvent (basic, size);
264 }