Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix broken tests
[simgrid.git] / src / instr / instr_private.hpp
1 /* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef INSTR_PRIVATE_HPP
7 #define INSTR_PRIVATE_HPP
8
9 #include <xbt/base.h>
10
11 #include "instr/instr_interface.h"
12 #include "simgrid/instr.h"
13 #include "simgrid_config.h"
14 #include "src/instr/instr_paje_containers.hpp"
15 #include "src/instr/instr_paje_events.hpp"
16 #include "src/instr/instr_paje_types.hpp"
17 #include "src/instr/instr_paje_values.hpp"
18 #include "src/internal_config.h"
19 #include "xbt/graph.h"
20 #include <iomanip> /** std::setprecision **/
21 #include <map>
22 #include <set>
23 #include <sstream>
24 #include <string>
25 #include <sys/stat.h>
26 #ifdef WIN32
27 #include <direct.h> // _mkdir
28 /* Need to define function drand48 for Windows */
29 /* FIXME: use _drand48() defined in src/surf/random_mgr.c instead */
30 #define drand48() (rand() / (RAND_MAX + 1.0))
31 #endif
32
33 typedef simgrid::instr::Container* container_t;
34
35 extern "C" {
36
37 extern XBT_PRIVATE std::set<std::string> created_categories;
38 extern XBT_PRIVATE std::set<std::string> declared_marks;
39 extern XBT_PRIVATE std::set<std::string> user_host_variables;
40 extern XBT_PRIVATE std::set<std::string> user_vm_variables;
41 extern XBT_PRIVATE std::set<std::string> user_link_variables;
42 extern XBT_PRIVATE double TRACE_last_timestamp_to_dump;
43
44 /* instr_paje_header.c */
45 XBT_PRIVATE void TRACE_header(bool basic, int size);
46
47 /* from paje.c */
48 XBT_PRIVATE void TRACE_paje_start();
49 XBT_PRIVATE void TRACE_paje_end();
50
51 /* from instr_config.c */
52 XBT_PRIVATE bool TRACE_needs_platform();
53 XBT_PRIVATE bool TRACE_is_enabled();
54 XBT_PRIVATE bool TRACE_platform();
55 XBT_PRIVATE bool TRACE_platform_topology();
56 XBT_PRIVATE bool TRACE_is_configured();
57 XBT_PRIVATE bool TRACE_categorized();
58 XBT_PRIVATE bool TRACE_uncategorized();
59 XBT_PRIVATE bool TRACE_msg_process_is_enabled();
60 XBT_PRIVATE bool TRACE_msg_vm_is_enabled();
61 XBT_PRIVATE bool TRACE_buffer();
62 XBT_PRIVATE bool TRACE_disable_link();
63 XBT_PRIVATE bool TRACE_disable_speed();
64 XBT_PRIVATE bool TRACE_onelink_only();
65 XBT_PRIVATE bool TRACE_disable_destroy();
66 XBT_PRIVATE bool TRACE_basic();
67 XBT_PRIVATE bool TRACE_display_sizes();
68 XBT_PRIVATE int TRACE_precision();
69 XBT_PRIVATE void TRACE_generate_viva_uncat_conf();
70 XBT_PRIVATE void TRACE_generate_viva_cat_conf();
71 XBT_PRIVATE void instr_pause_tracing();
72 XBT_PRIVATE void instr_resume_tracing();
73
74 /* Public functions used in SMPI */
75 XBT_PUBLIC(bool) TRACE_smpi_is_enabled();
76 XBT_PUBLIC(bool) TRACE_smpi_is_grouped();
77 XBT_PUBLIC(bool) TRACE_smpi_is_computing();
78 XBT_PUBLIC(bool) TRACE_smpi_is_sleeping();
79 XBT_PUBLIC(bool) TRACE_smpi_view_internals();
80
81 /* from resource_utilization.c */
82 XBT_PRIVATE void TRACE_surf_host_set_utilization(const char* resource, const char* category, double value, double now,
83                                                  double delta);
84 XBT_PRIVATE void TRACE_surf_link_set_utilization(const char* resource, const char* category, double value, double now,
85                                                  double delta);
86 XBT_PUBLIC(void) TRACE_surf_resource_utilization_alloc();
87
88 /* instr_paje.c */
89 extern XBT_PRIVATE std::set<std::string> trivaNodeTypes;
90 extern XBT_PRIVATE std::set<std::string> trivaEdgeTypes;
91 XBT_PRIVATE long long int instr_new_paje_id();
92 void instr_new_variable_type(std::string new_typename, std::string color);
93 void instr_new_user_variable_type(std::string father_type, std::string new_typename, std::string color);
94 void instr_new_user_state_type(std::string father_type, std::string new_typename);
95 void instr_new_value_for_user_state_type(std::string new_typename, const char* value, std::string color);
96
97 /* instr_config.c */
98 XBT_PRIVATE void TRACE_TI_start();
99 XBT_PRIVATE void TRACE_TI_end();
100
101 XBT_PRIVATE void TRACE_paje_dump_buffer(bool force);
102 XBT_PRIVATE void dump_comment_file(std::string filename);
103 XBT_PRIVATE void dump_comment(std::string comment);
104
105 enum e_caller_type {
106   TRACING_INIT,
107   TRACING_FINALIZE,
108   TRACING_COMM_SIZE,
109   TRACING_COMM_SPLIT,
110   TRACING_COMM_DUP,
111   TRACING_SEND,
112   TRACING_ISEND,
113   TRACING_SSEND,
114   TRACING_ISSEND,
115   TRACING_RECV,
116   TRACING_IRECV,
117   TRACING_SENDRECV,
118   TRACING_TEST,
119   TRACING_WAIT,
120   TRACING_WAITALL,
121   TRACING_WAITANY,
122   TRACING_BARRIER,
123   TRACING_BCAST,
124   TRACING_REDUCE,
125   TRACING_ALLREDUCE,
126   TRACING_ALLTOALL,
127   TRACING_ALLTOALLV,
128   TRACING_GATHER,
129   TRACING_GATHERV,
130   TRACING_SCATTER,
131   TRACING_SCATTERV,
132   TRACING_ALLGATHER,
133   TRACING_ALLGATHERV,
134   TRACING_REDUCE_SCATTER,
135   TRACING_COMPUTING,
136   TRACING_SLEEPING,
137   TRACING_SCAN,
138   TRACING_EXSCAN
139 };
140
141 struct s_instr_extra_data_t {
142   e_caller_type type;
143   int send_size;
144   int recv_size;
145   double comp_size;
146   double sleep_duration;
147   int src;
148   int dst;
149   int root;
150   const char* datatype1;
151   const char* datatype2;
152   int* sendcounts;
153   int* recvcounts;
154   int num_processes;
155 };
156
157 typedef s_instr_extra_data_t* instr_extra_data;
158
159 /* Format of TRACING output.
160  *   - paje is the regular format, that we all know
161  *   - TI is a trick to reuse the tracing functions to generate a time independent trace during the execution. Such
162  *     trace can easily be replayed with smpi_replay afterward. This trick should be removed and replaced by some code
163  *     using the signal that we will create to cleanup the TRACING
164  */
165 enum instr_fmt_type_t { instr_fmt_paje, instr_fmt_TI };
166 extern instr_fmt_type_t instr_fmt_type;
167 }
168 XBT_PRIVATE std::string TRACE_get_comment();
169 XBT_PRIVATE std::string TRACE_get_comment_file();
170 XBT_PRIVATE std::string TRACE_get_filename();
171 XBT_PRIVATE std::string TRACE_get_viva_uncat_conf();
172 XBT_PRIVATE std::string TRACE_get_viva_cat_conf();
173
174 #endif