1 /* Copyright (c) 2010-2014. The SimGrid Team.
2 * All rights reserved. */
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. */
7 #ifndef INSTR_PRIVATE_H_
8 #define INSTR_PRIVATE_H_
10 #include "instr/instr.h"
11 #include "instr/instr_interface.h"
12 #include "internal_config.h"
13 #include "simgrid_config.h"
19 /* Need to define function drand48 for Windows */
21 # define drand48() (rand()/(RAND_MAX + 1.0))
24 #define INSTR_DEFAULT_STR_SIZE 500
26 #include "xbt/graph.h"
28 #include "simgrid/platf.h"
31 PAJE_DefineContainerType,
32 PAJE_DefineVariableType,
36 PAJE_DefineEntityValue,
38 PAJE_DestroyContainer,
59 typedef struct s_type *type_t;
60 typedef struct s_type {
65 struct s_type *father;
67 xbt_dict_t values; //valid for all types except variable and container
70 typedef struct s_val *val_t;
71 typedef struct s_val {
89 typedef struct s_container *container_t;
90 typedef struct s_container {
91 sg_routing_edge_t net_elm;
92 char *name; /* Unique name of this container */
93 char *id; /* Unique id of this container */
94 type_t type; /* Type of this container */
95 int level; /* Level in the hierarchy, root level is 0 */
96 e_container_types kind; /* This container is of what kind */
97 struct s_container *father;
101 typedef struct paje_event *paje_event_t;
102 typedef struct paje_event {
104 e_event_type event_type;
105 void (*print) (paje_event_t event);
106 void (*free) (paje_event_t event);
110 typedef struct s_defineContainerType *defineContainerType_t;
111 typedef struct s_defineContainerType {
113 }s_defineContainerType_t;
115 typedef struct s_defineVariableType *defineVariableType_t;
116 typedef struct s_defineVariableType {
118 }s_defineVariableType_t;
120 typedef struct s_defineStateType *defineStateType_t;
121 typedef struct s_defineStateType {
123 }s_defineStateType_t;
125 typedef struct s_defineEventType *defineEventType_t;
126 typedef struct s_defineEventType {
128 }s_defineEventType_t;
130 typedef struct s_defineLinkType *defineLinkType_t;
131 typedef struct s_defineLinkType {
137 typedef struct s_defineEntityValue *defineEntityValue_t;
138 typedef struct s_defineEntityValue {
140 }s_defineEntityValue_t;
142 typedef struct s_createContainer *createContainer_t;
143 typedef struct s_createContainer {
144 container_t container;
145 }s_createContainer_t;
147 typedef struct s_destroyContainer *destroyContainer_t;
148 typedef struct s_destroyContainer {
149 container_t container;
150 }s_destroyContainer_t;
152 typedef struct s_setVariable *setVariable_t;
153 typedef struct s_setVariable {
154 container_t container;
159 typedef struct s_addVariable *addVariable_t;
160 typedef struct s_addVariable {
161 container_t container;
166 typedef struct s_subVariable *subVariable_t;
167 typedef struct s_subVariable {
168 container_t container;
173 typedef struct s_setState *setState_t;
174 typedef struct s_setState {
175 container_t container;
180 typedef struct s_pushState *pushState_t;
181 typedef struct s_pushState {
182 container_t container;
189 typedef struct s_popState *popState_t;
190 typedef struct s_popState {
191 container_t container;
196 typedef struct s_resetState *resetState_t;
197 typedef struct s_resetState {
198 container_t container;
202 typedef struct s_startLink *startLink_t;
203 typedef struct s_startLink {
204 container_t container;
206 container_t sourceContainer;
212 typedef struct s_endLink *endLink_t;
213 typedef struct s_endLink {
214 container_t container;
216 container_t destContainer;
221 typedef struct s_newEvent *newEvent_t;
222 typedef struct s_newEvent {
223 container_t container;
228 extern xbt_dict_t created_categories;
229 extern xbt_dict_t declared_marks;
230 extern xbt_dict_t user_host_variables;
231 extern xbt_dict_t user_vm_variables;
232 extern xbt_dict_t user_link_variables;
233 extern double TRACE_last_timestamp_to_dump;
235 /* instr_paje_header.c */
236 void TRACE_header(int basic, int size);
239 void TRACE_init(void);
240 void TRACE_finalize(void);
241 void TRACE_paje_init(void);
242 void TRACE_paje_start(void);
243 void TRACE_paje_end(void);
244 void TRACE_paje_dump_buffer (int force);
245 XBT_PUBLIC(void) new_pajeDefineContainerType(type_t type);
246 XBT_PUBLIC(void) new_pajeDefineVariableType(type_t type);
247 XBT_PUBLIC(void) new_pajeDefineStateType(type_t type);
248 XBT_PUBLIC(void) new_pajeDefineEventType(type_t type);
249 XBT_PUBLIC(void) new_pajeDefineLinkType(type_t type, type_t source, type_t dest);
250 XBT_PUBLIC(void) new_pajeDefineEntityValue (val_t type);
251 XBT_PUBLIC(void) new_pajeCreateContainer (container_t container);
252 XBT_PUBLIC(void) new_pajeDestroyContainer (container_t container);
253 XBT_PUBLIC(void) new_pajeSetVariable (double timestamp, container_t container, type_t type, double value);
254 XBT_PUBLIC(void) new_pajeAddVariable (double timestamp, container_t container, type_t type, double value);
255 XBT_PUBLIC(void) new_pajeSubVariable (double timestamp, container_t container, type_t type, double value);
256 XBT_PUBLIC(void) new_pajeSetState (double timestamp, container_t container, type_t type, val_t value);
257 XBT_PUBLIC(void) new_pajePushState (double timestamp, container_t container, type_t type, val_t value);
258 XBT_PUBLIC(void) new_pajePushStateWithExtra (double timestamp, container_t container, type_t type, val_t value, void* extra);
259 XBT_PUBLIC(void) new_pajePopState (double timestamp, container_t container, type_t type);
260 XBT_PUBLIC(void) new_pajeResetState (double timestamp, container_t container, type_t type);
261 XBT_PUBLIC(void) new_pajeStartLink (double timestamp, container_t container, type_t type, container_t sourceContainer, const char *value, const char *key);
262 XBT_PUBLIC(void) new_pajeStartLinkWithSize (double timestamp, container_t container, type_t type, container_t sourceContainer, const char *value, const char *key, int size);
263 XBT_PUBLIC(void) new_pajeEndLink (double timestamp, container_t container, type_t type, container_t destContainer, const char *value, const char *key);
264 XBT_PUBLIC(void) new_pajeNewEvent (double timestamp, container_t container, type_t type, val_t value);
267 void TRACE_surf_gtnets_communicate(void *action, void *src, void *dst);
269 /* from instr_config.c */
270 int TRACE_needs_platform (void);
271 int TRACE_is_enabled(void);
272 int TRACE_platform(void);
273 int TRACE_platform_topology(void);
274 int TRACE_is_configured(void);
275 int TRACE_categorized (void);
276 int TRACE_uncategorized (void);
277 int TRACE_msg_process_is_enabled(void);
278 int TRACE_msg_vm_is_enabled(void);
279 int TRACE_buffer (void);
280 int TRACE_disable_link(void);
281 int TRACE_disable_power(void);
282 int TRACE_onelink_only (void);
283 int TRACE_disable_destroy (void);
284 int TRACE_basic (void);
285 int TRACE_display_sizes (void);
286 char *TRACE_get_comment (void);
287 char *TRACE_get_comment_file (void);
288 char *TRACE_get_filename(void);
289 char *TRACE_get_viva_uncat_conf (void);
290 char *TRACE_get_viva_cat_conf (void);
291 void TRACE_generate_viva_uncat_conf (void);
292 void TRACE_generate_viva_cat_conf (void);
293 void instr_pause_tracing (void);
294 void instr_resume_tracing (void);
296 /* Public functions used in SMPI */
297 XBT_PUBLIC(int) TRACE_smpi_is_enabled(void);
298 XBT_PUBLIC(int) TRACE_smpi_is_grouped(void);
299 XBT_PUBLIC(int) TRACE_smpi_is_computing(void);
300 XBT_PUBLIC(int) TRACE_smpi_view_internals(void);
302 /* from resource_utilization.c */
303 void TRACE_surf_host_set_utilization(const char *resource,
304 const char *category,
308 void TRACE_surf_link_set_utilization(const char *resource,
309 const char *category,
313 void TRACE_surf_resource_utilization_alloc(void);
316 extern xbt_dict_t trivaNodeTypes;
317 extern xbt_dict_t trivaEdgeTypes;
318 long long int instr_new_paje_id (void);
319 void PJ_container_alloc (void);
320 void PJ_container_release (void);
321 XBT_PUBLIC(container_t) PJ_container_new (const char *name, e_container_types kind, container_t father);
322 XBT_PUBLIC(container_t) PJ_container_get (const char *name);
323 XBT_PUBLIC(container_t) PJ_container_get_or_null (const char *name);
324 XBT_PUBLIC(container_t) PJ_container_get_root (void);
325 XBT_PUBLIC(void) PJ_container_set_root (container_t root);
326 XBT_PUBLIC(void) PJ_container_free (container_t container);
327 XBT_PUBLIC(void) PJ_container_free_all (void);
328 XBT_PUBLIC(void) PJ_container_remove_from_parent (container_t container);
330 /* instr_paje_types.c */
331 void PJ_type_alloc (void);
332 void PJ_type_release (void);
333 XBT_PUBLIC(type_t) PJ_type_get_root (void);
334 type_t PJ_type_container_new (const char *name, type_t father);
335 type_t PJ_type_event_new (const char *name, type_t father);
336 type_t PJ_type_variable_new (const char *name, const char *color, type_t father);
337 type_t PJ_type_link_new (const char *name, type_t father, type_t source, type_t dest);
338 type_t PJ_type_state_new (const char *name, type_t father);
339 XBT_PUBLIC(type_t) PJ_type_get (const char *name, const type_t father);
340 XBT_PUBLIC(type_t) PJ_type_get_or_null (const char *name, type_t father);
341 void PJ_type_free (type_t type);
342 void PJ_type_free_all (void);
344 /* instr_paje_values.c */
345 XBT_PUBLIC(val_t) PJ_value_new (const char *name, const char *color, type_t father);
346 XBT_PUBLIC(val_t) PJ_value_get_or_new (const char *name, const char *color, type_t father);
347 XBT_PUBLIC(val_t) PJ_value_get (const char *name, const type_t father);
348 void PJ_value_free (val_t value);
350 void print_pajeDefineContainerType(paje_event_t event);
351 void print_pajeDefineVariableType(paje_event_t event);
352 void print_pajeDefineStateType(paje_event_t event);
353 void print_pajeDefineEventType(paje_event_t event);
354 void print_pajeDefineLinkType(paje_event_t event);
355 void print_pajeDefineEntityValue (paje_event_t event);
356 void print_pajeCreateContainer(paje_event_t event);
357 void print_pajeDestroyContainer(paje_event_t event);
358 void print_pajeSetVariable(paje_event_t event);
359 void print_pajeAddVariable(paje_event_t event);
360 void print_pajeSubVariable(paje_event_t event);
361 void print_pajeSetState(paje_event_t event);
362 void print_pajePushState(paje_event_t event);
363 void print_pajePopState(paje_event_t event);
364 void print_pajeResetState(paje_event_t event);
365 void print_pajeStartLink(paje_event_t event);
366 void print_pajeEndLink(paje_event_t event);
367 void print_pajeNewEvent (paje_event_t event);
369 void print_TIPushState(paje_event_t event);
370 void print_TICreateContainer(paje_event_t event);
371 void print_TIDestroyContainer(paje_event_t event);
372 void TRACE_TI_start(void);
373 void TRACE_TI_end(void);
374 void TRACE_TI_init(void);
376 void print_NULL (paje_event_t event);
377 void TRACE_paje_dump_buffer (int force);
378 void dump_comment_file (const char *filename);
379 void dump_comment (const char *comment);
384 typedef struct instr_trace_writer {
385 void (*print_DefineContainerType) (paje_event_t event);
386 void (*print_DefineVariableType)(paje_event_t event);
387 void (*print_DefineStateType)(paje_event_t event);
388 void (*print_DefineEventType)(paje_event_t event);
389 void (*print_DefineLinkType)(paje_event_t event);
390 void (*print_DefineEntityValue)(paje_event_t event);
391 void (*print_CreateContainer)(paje_event_t event);
392 void (*print_DestroyContainer)(paje_event_t event);
393 void (*print_SetVariable)(paje_event_t event);
394 void (*print_AddVariable)(paje_event_t event);
395 void (*print_SubVariable)(paje_event_t event);
396 void (*print_SetState)(paje_event_t event);
397 void (*print_PushState)(paje_event_t event);
398 void (*print_PopState)(paje_event_t event);
399 void (*print_ResetState)(paje_event_t event);
400 void (*print_StartLink)(paje_event_t event);
401 void (*print_EndLink)(paje_event_t event);
402 void (*print_NewEvent) (paje_event_t event);
403 } s_instr_trace_writer_t;
407 struct s_instr_extra_data;
408 typedef struct s_instr_extra_data *instr_extra_data;
439 TRACING_REDUCE_SCATTER,
447 typedef struct s_instr_extra_data {
455 const char* datatype1;
456 const char* datatype2;
460 } s_instr_extra_data_t;
464 #endif /* HAVE_TRACING */
467 #include "instr/jedule/jedule_sd_binding.h"
470 #endif /* INSTR_PRIVATE_H_ */