Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
when parallel ctests are performed, using the default tracing filename may cause...
[simgrid.git] / src / instr / instr_private.h
1 /* Copyright (c) 2010-2013. 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 #ifndef INSTR_PRIVATE_H_
8 #define INSTR_PRIVATE_H_
9
10 #include "instr/instr.h"
11 #include "instr/instr_interface.h"
12 #include "simgrid_config.h"
13
14 #ifdef HAVE_TRACING
15
16 /* Need to define function drand48 for Windows */
17 #ifdef _WIN32
18 #  define drand48() (rand()/(RAND_MAX + 1.0))
19 #endif
20
21 #define INSTR_DEFAULT_STR_SIZE 500
22
23 #include "xbt/graph.h"
24 #include "xbt/dict.h"
25 #include "simgrid/platf.h"
26
27 typedef enum {
28   PAJE_DefineContainerType,
29   PAJE_DefineVariableType,
30   PAJE_DefineStateType,
31   PAJE_DefineEventType,
32   PAJE_DefineLinkType,
33   PAJE_DefineEntityValue,
34   PAJE_CreateContainer,
35   PAJE_DestroyContainer,
36   PAJE_SetVariable,
37   PAJE_AddVariable,
38   PAJE_SubVariable,
39   PAJE_SetState,
40   PAJE_PushState,
41   PAJE_PopState,
42   PAJE_ResetState,
43   PAJE_StartLink,
44   PAJE_EndLink,
45   PAJE_NewEvent
46 } e_event_type;
47
48 typedef enum {
49   TYPE_VARIABLE,
50   TYPE_LINK,
51   TYPE_CONTAINER,
52   TYPE_STATE,
53   TYPE_EVENT
54 } e_entity_types;
55
56 typedef struct s_type *type_t;
57 typedef struct s_type {
58   char *id;
59   char *name;
60   char *color;
61   e_entity_types kind;
62   struct s_type *father;
63   xbt_dict_t children;
64   xbt_dict_t values; //valid for all types except variable and container
65 }s_type_t;
66
67 typedef struct s_val *val_t;
68 typedef struct s_val {
69   char *id;
70   char *name;
71   char *color;
72   type_t father;
73 }s_val_t;
74
75 typedef enum {
76   INSTR_HOST,
77   INSTR_LINK,
78   INSTR_ROUTER,
79   INSTR_AS,
80   INSTR_SMPI,
81   INSTR_MSG_VM,
82   INSTR_MSG_PROCESS,
83   INSTR_MSG_TASK
84 } e_container_types;
85
86 typedef struct s_container *container_t;
87 typedef struct s_container {
88   sg_routing_edge_t net_elm;
89   char *name;     /* Unique name of this container */
90   char *id;       /* Unique id of this container */
91   type_t type;    /* Type of this container */
92   int level;      /* Level in the hierarchy, root level is 0 */
93   e_container_types kind; /* This container is of what kind */
94   struct s_container *father;
95   xbt_dict_t children;
96 }s_container_t;
97
98 extern xbt_dict_t created_categories;
99 extern xbt_dict_t declared_marks;
100 extern xbt_dict_t user_host_variables;
101 extern xbt_dict_t user_vm_variables;
102 extern xbt_dict_t user_link_variables;
103 extern double TRACE_last_timestamp_to_dump;
104
105 /* instr_paje_header.c */
106 void TRACE_header(int basic, int size);
107
108 /* from paje.c */
109 void TRACE_paje_start(void);
110 void TRACE_paje_end(void);
111 void TRACE_paje_dump_buffer (int force);
112 XBT_PUBLIC(void) new_pajeDefineContainerType(type_t type);
113 XBT_PUBLIC(void) new_pajeDefineVariableType(type_t type);
114 XBT_PUBLIC(void) new_pajeDefineStateType(type_t type);
115 XBT_PUBLIC(void) new_pajeDefineEventType(type_t type);
116 XBT_PUBLIC(void) new_pajeDefineLinkType(type_t type, type_t source, type_t dest);
117 XBT_PUBLIC(void) new_pajeDefineEntityValue (val_t type);
118 XBT_PUBLIC(void) new_pajeCreateContainer (container_t container);
119 XBT_PUBLIC(void) new_pajeDestroyContainer (container_t container);
120 XBT_PUBLIC(void) new_pajeSetVariable (double timestamp, container_t container, type_t type, double value);
121 XBT_PUBLIC(void) new_pajeAddVariable (double timestamp, container_t container, type_t type, double value);
122 XBT_PUBLIC(void) new_pajeSubVariable (double timestamp, container_t container, type_t type, double value);
123 XBT_PUBLIC(void) new_pajeSetState (double timestamp, container_t container, type_t type, val_t value);
124 XBT_PUBLIC(void) new_pajePushState (double timestamp, container_t container, type_t type, val_t value);
125 XBT_PUBLIC(void) new_pajePushStateWithSize (double timestamp, container_t container, type_t type, val_t value, int size);
126 XBT_PUBLIC(void) new_pajePopState (double timestamp, container_t container, type_t type);
127 XBT_PUBLIC(void) new_pajeResetState (double timestamp, container_t container, type_t type);
128 XBT_PUBLIC(void) new_pajeStartLink (double timestamp, container_t container, type_t type, container_t sourceContainer, const char *value, const char *key);
129 XBT_PUBLIC(void) new_pajeStartLinkWithSize (double timestamp, container_t container, type_t type, container_t sourceContainer, const char *value, const char *key, int size);
130 XBT_PUBLIC(void) new_pajeEndLink (double timestamp, container_t container, type_t type, container_t destContainer, const char *value, const char *key);
131 XBT_PUBLIC(void) new_pajeNewEvent (double timestamp, container_t container, type_t type, val_t value);
132
133 //for tracing gtnets
134 void TRACE_surf_gtnets_communicate(void *action, void *src, void *dst);
135
136 /* from instr_config.c */
137 int TRACE_needs_platform (void);
138 int TRACE_is_enabled(void);
139 int TRACE_platform(void);
140 int TRACE_platform_topology(void);
141 int TRACE_is_configured(void);
142 int TRACE_categorized (void);
143 int TRACE_uncategorized (void);
144 int TRACE_msg_process_is_enabled(void);
145 int TRACE_msg_vm_is_enabled(void);
146 int TRACE_buffer (void);
147 int TRACE_disable_link(void);
148 int TRACE_disable_power(void);
149 int TRACE_onelink_only (void);
150 int TRACE_disable_destroy (void);
151 int TRACE_basic (void);
152 int TRACE_display_sizes (void);
153 char *TRACE_get_comment (void);
154 char *TRACE_get_comment_file (void);
155 char *TRACE_get_filename(void);
156 char *TRACE_get_viva_uncat_conf (void);
157 char *TRACE_get_viva_cat_conf (void);
158 void TRACE_generate_viva_uncat_conf (void);
159 void TRACE_generate_viva_cat_conf (void);
160 void instr_pause_tracing (void);
161 void instr_resume_tracing (void);
162
163 /* Public functions used in SMPI */
164 XBT_PUBLIC(int) TRACE_smpi_is_enabled(void);
165 XBT_PUBLIC(int) TRACE_smpi_is_grouped(void);
166 XBT_PUBLIC(int) TRACE_smpi_is_computing(void);
167 XBT_PUBLIC(int) TRACE_smpi_view_internals(void);
168
169 /* from resource_utilization.c */
170 void TRACE_surf_host_set_utilization(const char *resource,
171                                      const char *category,
172                                      double value,
173                                      double now,
174                                      double delta);
175 void TRACE_surf_link_set_utilization(const char *resource,
176                                      const char *category,
177                                      double value,
178                                      double now,
179                                      double delta);
180 void TRACE_surf_resource_utilization_alloc(void);
181
182 /* instr_paje.c */
183 extern xbt_dict_t trivaNodeTypes;
184 extern xbt_dict_t trivaEdgeTypes;
185 long long int instr_new_paje_id (void);
186 void PJ_container_alloc (void);
187 void PJ_container_release (void);
188 XBT_PUBLIC(container_t) PJ_container_new (const char *name, e_container_types kind, container_t father);
189 XBT_PUBLIC(container_t) PJ_container_get (const char *name);
190 XBT_PUBLIC(container_t) PJ_container_get_or_null (const char *name);
191 XBT_PUBLIC(container_t) PJ_container_get_root (void);
192 XBT_PUBLIC(void) PJ_container_set_root (container_t root);
193 XBT_PUBLIC(void) PJ_container_free (container_t container);
194 XBT_PUBLIC(void) PJ_container_free_all (void);
195 XBT_PUBLIC(void) PJ_container_remove_from_parent (container_t container);
196
197 /* instr_paje_types.c */
198 void PJ_type_alloc (void);
199 void PJ_type_release (void);
200 XBT_PUBLIC(type_t)  PJ_type_get_root (void);
201 type_t PJ_type_container_new (const char *name, type_t father);
202 type_t PJ_type_event_new (const char *name, type_t father);
203 type_t PJ_type_variable_new (const char *name, const char *color, type_t father);
204 type_t PJ_type_link_new (const char *name, type_t father, type_t source, type_t dest);
205 type_t PJ_type_state_new (const char *name, type_t father);
206 XBT_PUBLIC(type_t)  PJ_type_get (const char *name, const type_t father);
207 XBT_PUBLIC(type_t)  PJ_type_get_or_null (const char *name, type_t father);
208 void PJ_type_free (type_t type);
209 void PJ_type_free_all (void);
210
211 /* instr_paje_values.c */
212 XBT_PUBLIC(val_t)  PJ_value_new (const char *name, const char *color, type_t father);
213 XBT_PUBLIC(val_t)  PJ_value_get_or_new (const char *name, const char *color, type_t father);
214 XBT_PUBLIC(val_t)  PJ_value_get (const char *name, const type_t father);
215 void PJ_value_free (val_t value);
216
217 #endif /* HAVE_TRACING */
218
219 #ifdef HAVE_JEDULE
220 #include "instr/jedule/jedule_sd_binding.h"
221 #endif
222
223 #endif /* INSTR_PRIVATE_H_ */