Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Define and throw simgrid::TracingError.
[simgrid.git] / src / instr / jedule / jedule.cpp
1 /* Copyright (c) 2010-2019. 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 "xbt/asserts.h"
8 #include "simgrid/jedule/jedule.hpp"
9
10 #if SIMGRID_HAVE_JEDULE
11
12 namespace simgrid{
13 namespace jedule {
14
15 void Jedule::add_meta_info(char* key, char* value)
16 {
17   xbt_assert(key != nullptr);
18   xbt_assert(value != nullptr);
19
20   this->meta_info_.insert({key, value});
21 }
22
23 void Jedule::write_output(FILE* file)
24 {
25   if (not this->event_set_.empty()) {
26     fprintf(file, "<jedule>\n");
27
28     if (not this->meta_info_.empty()) {
29       fprintf(file, "  <jedule_meta>\n");
30       for (auto const& elm : this->meta_info_)
31         fprintf(file, "        <prop key=\"%s\" value=\"%s\" />\n",elm.first,elm.second);
32       fprintf(file, "  </jedule_meta>\n");
33     }
34
35     fprintf(file, "  <platform>\n");
36     this->root_container_.print(file);
37     fprintf(file, "  </platform>\n");
38
39     fprintf(file, "  <events>\n");
40     for (auto const& event : this->event_set_)
41       event.print(file);
42     fprintf(file, "  </events>\n");
43
44     fprintf(file, "</jedule>\n");
45   }
46 }
47
48 }
49 }
50 #endif