Logo AND Algorithmique Numérique Distribuée

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