Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
3e92c07ee46e8343282cb0eaf26d668098016cc4
[simgrid.git] / src / instr / instr_paje_trace.cpp
1 /* Copyright (c) 2010-2016. 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 "src/instr/instr_smpi.h"
9 #include "src/smpi/private.hpp"
10 #include "typeinfo"
11 #include "xbt/virtu.h" /* sg_cmdline */
12 #include <sstream>
13 #include <vector>
14 #include <iomanip> /** std::setprecision **/
15 #include "simgrid/sg_config.h"
16
17 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_paje_trace, instr, "tracing event system");
18
19 extern FILE * tracing_file;
20 extern s_instr_trace_writer_t active_writer;
21
22 static std::stringstream stream;
23 FILE *tracing_file = nullptr;
24
25 void print_NULL(PajeEvent* event){}
26
27 /* The active set of functions for the selected trace format
28  * By default, they all do nothing, hence the print_NULL to avoid segfaults */
29
30 s_instr_trace_writer_t active_writer = {&print_NULL, &print_NULL, &print_NULL, &print_NULL, &print_NULL, &print_NULL,
31                                         &print_NULL, &print_NULL, &print_NULL, &print_NULL, &print_NULL, &print_NULL,
32                                         &print_NULL, &print_NULL, &print_NULL, &print_NULL, &print_NULL, &print_NULL};
33
34 std::vector<PajeEvent*> buffer;
35 void buffer_debug(std::vector<PajeEvent*> *buf);
36
37 void dump_comment (const char *comment)
38 {
39   if (!strlen(comment)) return;
40   fprintf (tracing_file, "# %s\n", comment);
41 }
42
43 void dump_comment_file (const char *filename)
44 {
45   if (!strlen(filename)) return;
46   FILE *file = fopen (filename, "r");
47   if (!file){
48     THROWF (system_error, 1, "Comment file %s could not be opened for reading.", filename);
49   }
50   while (!feof(file)){
51     char c;
52     c = fgetc(file);
53     if (feof(file)) break;
54     fprintf (tracing_file, "# ");
55     while (c != '\n'){
56       fprintf (tracing_file, "%c", c);
57       c = fgetc(file);
58       if (feof(file)) break;
59     }
60     fprintf (tracing_file, "\n");
61   }
62   fclose(file);
63 }
64
65 double TRACE_last_timestamp_to_dump = 0;
66 //dumps the trace file until the timestamp TRACE_last_timestamp_to_dump
67 void TRACE_paje_dump_buffer (int force)
68 {
69   if (!TRACE_is_enabled()) return;
70   XBT_DEBUG("%s: dump until %f. starts", __FUNCTION__, TRACE_last_timestamp_to_dump);
71   if (force){
72     for (auto event : buffer){
73       event->print();
74       delete event;
75     }
76     buffer.clear();
77   }else{
78     std::vector<PajeEvent*>::iterator i = buffer.begin();
79     for (auto event :buffer){
80       double head_timestamp = event->timestamp;
81       if (head_timestamp > TRACE_last_timestamp_to_dump)
82         break;
83       event->print();
84       delete event;
85       ++i;
86     }
87     buffer.erase(buffer.begin(), i);
88   }
89   XBT_DEBUG("%s: ends", __FUNCTION__);
90 }
91
92 void buffer_debug(std::vector<PajeEvent*> *buf);
93 void buffer_debug(std::vector<PajeEvent*> *buf) {
94   return;
95   XBT_DEBUG(">>>>>> Dump the state of the buffer. %zu events", buf->size());
96   for (auto event :*buf){
97     event->print();
98     XBT_DEBUG("%p %s", event, stream.str().c_str());
99     stream.str("");
100     stream.clear();
101   }
102   XBT_DEBUG("<<<<<<");
103 }
104
105 static void print_row() {
106   stream << std::endl;
107   fprintf(tracing_file, "%s", stream.str().c_str());
108   XBT_DEBUG("Dump %s", stream.str().c_str());
109   stream.str("");
110   stream.clear();
111 }
112
113 static void print_timestamp(PajeEvent* event) {
114   stream << " ";
115   /* prevent 0.0000 in the trace - this was the behavior before the transition to c++ */
116   if (event->timestamp < 1e-12)
117     stream << 0;
118   else 
119     stream << event->timestamp;
120 }  
121
122 /* internal do the instrumentation module */
123 static void insert_into_buffer (PajeEvent* tbi)
124 {
125   if (TRACE_buffer() == 0){
126     tbi->print ();
127     delete tbi;
128     return;
129   }
130   buffer_debug(&buffer);
131
132   XBT_DEBUG("%s: insert event_type=%d, timestamp=%f, buffersize=%zu)",
133       __FUNCTION__, (int)tbi->event_type, tbi->timestamp, buffer.size());
134   std::vector<PajeEvent*>::reverse_iterator i;
135   for (i = buffer.rbegin(); i != buffer.rend(); ++i) {
136     PajeEvent* e1 = *i;
137     XBT_DEBUG("compare to %p is of type %d; timestamp:%f", e1,
138         (int)e1->event_type, e1->timestamp);
139     if (e1->timestamp <= tbi->timestamp)
140       break;
141   }
142   buffer.insert(i.base(), tbi);
143   if (i == buffer.rend())
144     XBT_DEBUG("%s: inserted at beginning", __FUNCTION__);
145   else if (i == buffer.rbegin())
146     XBT_DEBUG("%s: inserted at end", __FUNCTION__);
147   else
148     XBT_DEBUG("%s: inserted at pos= %zd from its end", __FUNCTION__,
149         std::distance(buffer.rbegin(),i));
150
151   buffer_debug(&buffer);
152 }
153
154 PajeEvent:: ~PajeEvent()
155 {
156   XBT_DEBUG("%s not implemented for %p: event_type=%d, timestamp=%f", __FUNCTION__,
157       this, (int)event_type, timestamp);
158 //  xbt_backtrace_display_current();
159
160  /* switch (event->event_type){
161   case PAJE_StartLink:
162     xbt_free (((startLink_t)(event->data))->value);
163     xbt_free (((startLink_t)(event->data))->key);
164     break;
165   case PAJE_EndLink:
166     xbt_free (((endLink_t)(event->data))->value);
167     xbt_free (((endLink_t)(event->data))->key);
168     break;
169   default:
170     break;
171   }*/
172 }
173
174 void TRACE_paje_start() {
175   char *filename = TRACE_get_filename();
176   tracing_file = fopen(filename, "w");
177   if (tracing_file == nullptr){
178     THROWF (system_error, 1, "Tracefile %s could not be opened for writing.", filename);
179   }
180
181   XBT_DEBUG("Filename %s is open for writing", filename);
182
183   /* output generator version */
184   fprintf (tracing_file, "#This file was generated using SimGrid-%d.%d.%d\n",
185            SIMGRID_VERSION_MAJOR, SIMGRID_VERSION_MINOR, SIMGRID_VERSION_PATCH);
186   fprintf (tracing_file, "#[");
187   unsigned int cpt;
188   char *str;
189   xbt_dynar_foreach (xbt_cmdline, cpt, str){
190     fprintf(tracing_file, "%s ",str);
191   }
192   fprintf (tracing_file, "]\n");
193
194   /* output one line comment */
195   dump_comment (TRACE_get_comment());
196
197   /* output comment file */
198   dump_comment_file (TRACE_get_comment_file());
199
200   /* output header */
201   TRACE_header(TRACE_basic(),TRACE_display_sizes());
202 }
203
204 void TRACE_paje_end() {
205   fclose(tracing_file);
206   char *filename = TRACE_get_filename();
207   XBT_DEBUG("Filename %s is closed", filename);
208 }
209
210 DefineContainerEvent::DefineContainerEvent(type_t type)
211 {
212
213   event_type                            = PAJE_DefineContainerType;
214   timestamp                             = 0;
215   this->type = type;
216   XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
217   //print it
218   print ();
219 }
220
221 void DefineContainerEvent::print() {
222   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
223   stream << std::fixed << std::setprecision(TRACE_precision());
224   stream << (int)this->event_type;
225   stream << " " << type->id
226          << " " << type->father->id
227          << " " << type->name;
228   print_row();
229 }
230
231
232
233 DefineVariableTypeEvent::DefineVariableTypeEvent(type_t type)
234 {
235   this->event_type                           = PAJE_DefineVariableType;
236   this->timestamp                            = 0;
237   this->type = type;
238
239   XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
240
241   //print it
242   print ();
243 }
244
245 void DefineVariableTypeEvent::print() {
246   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
247   stream << std::fixed << std::setprecision(TRACE_precision());
248   stream << (int)this->event_type;
249   stream << " " << type->id
250          << " " << type->father->id
251          << " " << type->name;
252   if (type->color)
253     stream << " \"" << type->color << "\"";
254   print_row();
255 }
256
257 DefineStateTypeEvent::DefineStateTypeEvent(type_t type)
258 {
259   this->event_type                        = PAJE_DefineStateType;
260   this->timestamp                         = 0;
261   this->type = type;
262
263   XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
264
265   //print it
266   print();
267 }
268
269
270 DefineEventTypeEvent::DefineEventTypeEvent(type_t type)
271 {
272   this->event_type                        = PAJE_DefineEventType;
273   this->timestamp                         = 0;
274   this->type = type;
275
276   XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
277
278   //print it
279   print();
280 }
281
282
283 void DefineStateTypeEvent::print() {
284   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
285   stream << std::fixed << std::setprecision(TRACE_precision());
286   stream << (int)this->event_type;
287   stream << " " << type->id
288          << " " << type->father->id
289          << " " << type->name;
290   print_row();
291 }
292
293 void DefineEventTypeEvent::print() {
294   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
295   stream << std::fixed << std::setprecision(TRACE_precision());
296   stream << (int)this->event_type;
297   stream << " " << type->id
298          << " " << type->father->id
299          << " " << type->name;
300   print_row();
301 }
302
303 DefineLinkTypeEvent::DefineLinkTypeEvent(type_t type, type_t source, type_t dest)
304 {
305   this->event_type                         = PAJE_DefineLinkType;
306   this->timestamp                          = 0;
307   this->type   = type;
308   this->source = source;
309   this->dest   = dest;
310
311   XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
312
313   //print it
314   print();
315 }
316
317 void DefineLinkTypeEvent::print() {
318   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
319   stream << std::fixed << std::setprecision(TRACE_precision());
320   stream << (int)this->event_type;
321   stream << " " << type->id 
322          << " " << type->father->id 
323          << " " << source->id 
324          << " " << dest->id 
325          << " " << type->name;
326   print_row();
327 }
328
329 DefineEntityValueEvent::DefineEntityValueEvent (val_t value)
330 {
331   this->event_type                           = PAJE_DefineEntityValue;
332   this->timestamp                            = 0;
333   this->value = value;
334
335   XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
336
337   //print it
338   print();
339 }
340
341
342 void DefineEntityValueEvent::print() {
343   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
344   stream << std::fixed << std::setprecision(TRACE_precision());
345   stream << (int)this->event_type;
346   stream << " "   << value->id
347          << " "   << value->father->id
348          << " "   << value->name;
349   if(value->color)
350     stream << " \"" << value->color << "\"";
351   print_row();
352 }
353
354 CreateContainerEvent::CreateContainerEvent (container_t container)
355 {
356   this->event_type                             = PAJE_CreateContainer;
357   this->timestamp                              = SIMIX_get_clock();
358   this->container = container;
359
360   XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
361
362   //print it
363   print();
364 }
365
366 void CreateContainerEvent::print() {
367   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
368   stream << std::fixed << std::setprecision(TRACE_precision());
369   stream << (int)this->event_type;
370   print_timestamp(this);
371   stream << " "   << container->id
372          << " "   << container->type->id
373          << " "   << container->father->id
374          << " \"" << container->name << "\"";
375
376   print_row();
377 }
378
379 DestroyContainerEvent::DestroyContainerEvent (container_t container)
380 {
381   this->event_type                              = PAJE_DestroyContainer;
382   this->timestamp                               = SIMIX_get_clock();
383   this->container = container;
384
385   XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
386
387   print();
388 }
389
390 void DestroyContainerEvent::print() {
391   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
392   stream << std::fixed << std::setprecision(TRACE_precision());
393   stream << (int)this->event_type;
394   print_timestamp(this);
395   stream << " "   << container->type->id
396          << " "   << container->id;
397
398   print_row();
399 }
400
401 SetVariableEvent::SetVariableEvent (double timestamp, container_t container, type_t type, double value)
402 {
403   this->event_type                         = PAJE_SetVariable;
404   this->timestamp                          = timestamp;
405   this->type      = type;
406   this->container = container;
407   this->value     = value;
408
409   XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
410
411   insert_into_buffer (this);
412 }
413
414 void SetVariableEvent::print() {
415   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
416   stream << std::fixed << std::setprecision(TRACE_precision());
417   stream << (int)this->event_type;
418   print_timestamp(this);
419   stream << " " << type->id
420          << " " << container->id
421          << " " << value;
422   print_row();
423 }
424
425 AddVariableEvent::AddVariableEvent (double timestamp, container_t container, type_t type, double value)
426 {
427   this->event_type                         = PAJE_AddVariable;
428   this->timestamp                          = timestamp;
429   this->type      = type;
430   this->container = container;
431   this->value     = value;
432
433   XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
434
435   insert_into_buffer (this);
436 }
437
438 void AddVariableEvent::print() {
439   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
440   stream << std::fixed << std::setprecision(TRACE_precision());
441   stream << (int)this->event_type;
442   print_timestamp(this);
443   stream << " " << type->id
444          << " " << container->id
445          << " " << value;
446   print_row();
447 }
448
449 SubVariableEvent::SubVariableEvent (double timestamp, container_t container, type_t type, double value)
450 {
451   this->event_type                         = PAJE_SubVariable;
452   this->timestamp                          = timestamp;
453   this->type      = type;
454   this->container = container;
455   this->value     = value;
456
457   XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
458
459   insert_into_buffer (this);
460 }
461
462 void SubVariableEvent::print() {
463   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
464   stream << std::fixed << std::setprecision(TRACE_precision());
465   stream << (int)this->event_type;
466   print_timestamp(this);
467   stream << " " << type->id
468          << " " << container->id
469          << " " << value;
470   print_row();
471 }
472
473 SetStateEvent::SetStateEvent (double timestamp, container_t container, type_t type, val_t value)
474 {
475   this->event_type                      = PAJE_SetState;
476   this->timestamp                       = timestamp;
477   this->type      = type;
478   this->container = container;
479   this->value     = value;
480
481 #if HAVE_SMPI
482   if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
483     smpi_trace_call_location_t* loc = smpi_trace_get_call_location();
484     filename   = loc->filename;
485     linenumber = loc->linenumber;
486   }
487 #endif
488
489   XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
490
491   insert_into_buffer (this);
492 }
493
494 void SetStateEvent::print() {
495   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
496   stream << std::fixed << std::setprecision(TRACE_precision());
497   stream << (int)this->event_type;
498   print_timestamp(this);
499   stream << " " << type->id
500          << " " << container->id;
501   stream << " " <<value->id;
502 #if HAVE_SMPI
503   if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
504     stream << " \"" << filename
505            << "\" " << linenumber;
506   }
507 #endif
508   print_row();
509 }
510
511 PushStateEvent::PushStateEvent (double timestamp, container_t container, type_t type, val_t value, void* extra)
512 {
513   this->event_type                  = PAJE_PushState;
514   this->timestamp                   = timestamp;
515   this->type = type;
516   this->container = container;
517   this->value     = value;
518   this->extra     = extra;
519
520 #if HAVE_SMPI
521   if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
522     smpi_trace_call_location_t* loc = smpi_trace_get_call_location();
523     filename   = loc->filename;
524     linenumber = loc->linenumber;
525   }
526 #endif
527
528   XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
529
530   insert_into_buffer (this);
531 }
532
533 PushStateEvent::PushStateEvent (double timestamp, container_t container, type_t type, val_t value)
534  : PushStateEvent(timestamp, container, type, value, nullptr)
535 {}
536 void PushStateEvent::print() {
537   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
538   stream << std::fixed << std::setprecision(TRACE_precision());
539   stream << (int)this->event_type;
540   print_timestamp(this);
541   stream << " " << type->id
542          << " " << container->id;
543   stream << " " <<value->id;
544
545   if (TRACE_display_sizes()) {
546     stream << " ";
547     if (extra != nullptr) {
548       stream << static_cast<instr_extra_data>(extra)->send_size;
549     }
550     else {
551       stream << 0;
552     }
553   }
554 #if HAVE_SMPI
555   if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
556     stream << " \"" << filename
557            << "\" " << linenumber;
558   }
559 #endif
560   print_row();
561
562   if (extra != nullptr) {
563     if (static_cast<instr_extra_data>(extra)->sendcounts != nullptr)
564       xbt_free(static_cast<instr_extra_data>(extra)->sendcounts);
565     if (static_cast<instr_extra_data>(extra)->recvcounts != nullptr)
566       xbt_free(static_cast<instr_extra_data>(extra)->recvcounts);
567     xbt_free(extra);
568   }
569 }
570
571
572 PopStateEvent::PopStateEvent (double timestamp, container_t container, type_t type)
573 {
574   this->event_type                      = PAJE_PopState;
575   this->timestamp                       = timestamp;
576   this->type      = type;
577   this->container = container;
578
579   XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
580
581   insert_into_buffer (this);
582 }
583
584 void PopStateEvent::print() {
585   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
586   stream << std::fixed << std::setprecision(TRACE_precision());
587   stream << (int)this->event_type;
588   print_timestamp(this);
589   stream << " " << type->id
590          << " " << container->id;
591   print_row();
592 }
593
594 ResetStateEvent::ResetStateEvent (double timestamp, container_t container, type_t type)
595 {
596   this->event_type                        = PAJE_ResetState;
597   this->timestamp                         = timestamp;
598   this->type      = type;
599   this->container = container;
600
601   XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
602
603   insert_into_buffer (this);
604 }
605
606 void ResetStateEvent::print() {
607   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
608   stream << std::fixed << std::setprecision(TRACE_precision());
609   stream << (int)this->event_type;
610   print_timestamp(this);
611   stream << " " << type->id
612          << " " << container->id;
613   print_row();
614 }
615
616 StartLinkEvent::StartLinkEvent (double timestamp, container_t container,
617     type_t type, container_t sourceContainer, const char *value, const char *key)
618   : StartLinkEvent(timestamp, container, type, sourceContainer, value, key, -1)
619 {}
620
621 StartLinkEvent::StartLinkEvent (double timestamp, container_t container, type_t type, container_t sourceContainer,
622                                 const char *value, const char *key, int size)
623 {
624   event_type                             = PAJE_StartLink;
625   this->timestamp       = timestamp;
626   this->type            = type;
627   this->container       = container;
628   this->sourceContainer = sourceContainer;
629   this->value           = xbt_strdup(value);
630   this->key             = xbt_strdup(key);
631   this->size            = size;
632
633   XBT_DEBUG("%s: event_type=%d, timestamp=%f, value:%s", __FUNCTION__,
634       (int)event_type, this->timestamp, this->value);
635
636   insert_into_buffer (this);
637 }
638
639 void StartLinkEvent::print() {
640   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
641   stream << std::fixed << std::setprecision(TRACE_precision());
642   stream << (int)this->event_type;
643   print_timestamp(this);
644   stream << " " <<type->id
645          << " " <<container->id
646          << " " <<value;
647   stream << " " << sourceContainer->id
648          << " " << key;
649
650   if (TRACE_display_sizes()) {
651     stream << " " << size;
652   }
653   print_row();
654 }
655
656 EndLinkEvent::EndLinkEvent (double timestamp, container_t container, type_t type, container_t destContainer,
657                       const char *value, const char *key)
658 {
659   this->event_type                         = PAJE_EndLink;
660   this->timestamp                          = timestamp;
661   this->type          = type;
662   this->container     = container;
663   this->destContainer = destContainer;
664   this->value         = xbt_strdup(value);
665   this->key           = xbt_strdup(key);
666
667   XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
668
669   insert_into_buffer (this);
670 }
671
672
673 void EndLinkEvent::print() {
674   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
675   stream << std::fixed << std::setprecision(TRACE_precision());
676   stream << (int)this->event_type;
677   print_timestamp(this);
678   stream << " " <<type->id
679          << " " <<container->id
680          << " " <<value;
681   stream << " " << destContainer->id
682          << " " << key;
683   print_row();
684 }
685
686 NewEvent::NewEvent (double timestamp, container_t container, type_t type, val_t value)
687 {
688   this->event_type                      = PAJE_NewEvent;
689   this->timestamp                       = timestamp;
690   this->type      = type;
691   this->container = container;
692   this->value     = value;
693
694   XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
695
696   insert_into_buffer (this);
697 }
698
699 void NewEvent::print () {
700   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
701   stream << std::fixed << std::setprecision(TRACE_precision());
702   stream << (int)this->event_type;
703   print_timestamp(this);
704   stream << " " << type->id
705          << " " << container->id
706          << " " << value->id;
707   print_row();
708 }