Logo AND Algorithmique Numérique Distribuée

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