1 /* Copyright (c) 2010-2013. 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"
17 /* Need to define function drand48 for Windows */
19 # define drand48() (rand()/(RAND_MAX + 1.0))
22 #define INSTR_DEFAULT_STR_SIZE 500
24 #include "xbt/graph.h"
26 #include "simgrid/platf.h"
29 PAJE_DefineContainerType,
30 PAJE_DefineVariableType,
34 PAJE_DefineEntityValue,
36 PAJE_DestroyContainer,
57 typedef struct s_type *type_t;
58 typedef struct s_type {
63 struct s_type *father;
65 xbt_dict_t values; //valid for all types except variable and container
68 typedef struct s_val *val_t;
69 typedef struct s_val {
87 typedef struct s_container *container_t;
88 typedef struct s_container {
89 sg_routing_edge_t net_elm;
90 char *name; /* Unique name of this container */
91 char *id; /* Unique id of this container */
92 type_t type; /* Type of this container */
93 int level; /* Level in the hierarchy, root level is 0 */
94 e_container_types kind; /* This container is of what kind */
95 struct s_container *father;
99 typedef struct paje_event *paje_event_t;
100 typedef struct paje_event {
102 e_event_type event_type;
103 void (*print) (paje_event_t event);
104 void (*free) (paje_event_t event);
108 typedef struct s_defineContainerType *defineContainerType_t;
109 typedef struct s_defineContainerType {
111 }s_defineContainerType_t;
113 typedef struct s_defineVariableType *defineVariableType_t;
114 typedef struct s_defineVariableType {
116 }s_defineVariableType_t;
118 typedef struct s_defineStateType *defineStateType_t;
119 typedef struct s_defineStateType {
121 }s_defineStateType_t;
123 typedef struct s_defineEventType *defineEventType_t;
124 typedef struct s_defineEventType {
126 }s_defineEventType_t;
128 typedef struct s_defineLinkType *defineLinkType_t;
129 typedef struct s_defineLinkType {
135 typedef struct s_defineEntityValue *defineEntityValue_t;
136 typedef struct s_defineEntityValue {
138 }s_defineEntityValue_t;
140 typedef struct s_createContainer *createContainer_t;
141 typedef struct s_createContainer {
142 container_t container;
143 }s_createContainer_t;
145 typedef struct s_destroyContainer *destroyContainer_t;
146 typedef struct s_destroyContainer {
147 container_t container;
148 }s_destroyContainer_t;
150 typedef struct s_setVariable *setVariable_t;
151 typedef struct s_setVariable {
152 container_t container;
157 typedef struct s_addVariable *addVariable_t;
158 typedef struct s_addVariable {
159 container_t container;
164 typedef struct s_subVariable *subVariable_t;
165 typedef struct s_subVariable {
166 container_t container;
171 typedef struct s_setState *setState_t;
172 typedef struct s_setState {
173 container_t container;
178 typedef struct s_pushState *pushState_t;
179 typedef struct s_pushState {
180 container_t container;
187 typedef struct s_popState *popState_t;
188 typedef struct s_popState {
189 container_t container;
194 typedef struct s_resetState *resetState_t;
195 typedef struct s_resetState {
196 container_t container;
200 typedef struct s_startLink *startLink_t;
201 typedef struct s_startLink {
202 container_t container;
204 container_t sourceContainer;
210 typedef struct s_endLink *endLink_t;
211 typedef struct s_endLink {
212 container_t container;
214 container_t destContainer;
219 typedef struct s_newEvent *newEvent_t;
220 typedef struct s_newEvent {
221 container_t container;
226 extern xbt_dict_t created_categories;
227 extern xbt_dict_t declared_marks;
228 extern xbt_dict_t user_host_variables;
229 extern xbt_dict_t user_vm_variables;
230 extern xbt_dict_t user_link_variables;
231 extern double TRACE_last_timestamp_to_dump;
233 /* instr_paje_header.c */
234 void TRACE_header(int basic, int size);
237 void TRACE_init(void);
238 void TRACE_finalize(void);
239 void TRACE_paje_init(void);
240 void TRACE_paje_start(void);
241 void TRACE_paje_end(void);
242 void TRACE_paje_dump_buffer (int force);
243 XBT_PUBLIC(void) new_pajeDefineContainerType(type_t type);
244 XBT_PUBLIC(void) new_pajeDefineVariableType(type_t type);
245 XBT_PUBLIC(void) new_pajeDefineStateType(type_t type);
246 XBT_PUBLIC(void) new_pajeDefineEventType(type_t type);
247 XBT_PUBLIC(void) new_pajeDefineLinkType(type_t type, type_t source, type_t dest);
248 XBT_PUBLIC(void) new_pajeDefineEntityValue (val_t type);
249 XBT_PUBLIC(void) new_pajeCreateContainer (container_t container);
250 XBT_PUBLIC(void) new_pajeDestroyContainer (container_t container);
251 XBT_PUBLIC(void) new_pajeSetVariable (double timestamp, container_t container, type_t type, double value);
252 XBT_PUBLIC(void) new_pajeAddVariable (double timestamp, container_t container, type_t type, double value);
253 XBT_PUBLIC(void) new_pajeSubVariable (double timestamp, container_t container, type_t type, double value);
254 XBT_PUBLIC(void) new_pajeSetState (double timestamp, container_t container, type_t type, val_t value);
255 XBT_PUBLIC(void) new_pajePushState (double timestamp, container_t container, type_t type, val_t value);
256 XBT_PUBLIC(void) new_pajePushStateWithExtra (double timestamp, container_t container, type_t type, val_t value, void* extra);
257 XBT_PUBLIC(void) new_pajePopState (double timestamp, container_t container, type_t type);
258 XBT_PUBLIC(void) new_pajeResetState (double timestamp, container_t container, type_t type);
259 XBT_PUBLIC(void) new_pajeStartLink (double timestamp, container_t container, type_t type, container_t sourceContainer, const char *value, const char *key);
260 XBT_PUBLIC(void) new_pajeStartLinkWithSize (double timestamp, container_t container, type_t type, container_t sourceContainer, const char *value, const char *key, int size);
261 XBT_PUBLIC(void) new_pajeEndLink (double timestamp, container_t container, type_t type, container_t destContainer, const char *value, const char *key);
262 XBT_PUBLIC(void) new_pajeNewEvent (double timestamp, container_t container, type_t type, val_t value);
265 void TRACE_surf_gtnets_communicate(void *action, void *src, void *dst);
267 /* from instr_config.c */
268 int TRACE_needs_platform (void);
269 int TRACE_is_enabled(void);
270 int TRACE_platform(void);
271 int TRACE_platform_topology(void);
272 int TRACE_is_configured(void);
273 int TRACE_categorized (void);
274 int TRACE_uncategorized (void);
275 int TRACE_msg_process_is_enabled(void);
276 int TRACE_msg_vm_is_enabled(void);
277 int TRACE_buffer (void);
278 int TRACE_disable_link(void);
279 int TRACE_disable_power(void);
280 int TRACE_onelink_only (void);
281 int TRACE_disable_destroy (void);
282 int TRACE_basic (void);
283 int TRACE_display_sizes (void);
284 char *TRACE_get_comment (void);
285 char *TRACE_get_comment_file (void);
286 char *TRACE_get_filename(void);
287 char *TRACE_get_viva_uncat_conf (void);
288 char *TRACE_get_viva_cat_conf (void);
289 void TRACE_generate_viva_uncat_conf (void);
290 void TRACE_generate_viva_cat_conf (void);
291 void instr_pause_tracing (void);
292 void instr_resume_tracing (void);
294 /* Public functions used in SMPI */
295 XBT_PUBLIC(int) TRACE_smpi_is_enabled(void);
296 XBT_PUBLIC(int) TRACE_smpi_is_grouped(void);
297 XBT_PUBLIC(int) TRACE_smpi_is_computing(void);
298 XBT_PUBLIC(int) TRACE_smpi_view_internals(void);
300 /* from resource_utilization.c */
301 void TRACE_surf_host_set_utilization(const char *resource,
302 const char *category,
306 void TRACE_surf_link_set_utilization(const char *resource,
307 const char *category,
311 void TRACE_surf_resource_utilization_alloc(void);
314 extern xbt_dict_t trivaNodeTypes;
315 extern xbt_dict_t trivaEdgeTypes;
316 long long int instr_new_paje_id (void);
317 void PJ_container_alloc (void);
318 void PJ_container_release (void);
319 XBT_PUBLIC(container_t) PJ_container_new (const char *name, e_container_types kind, container_t father);
320 XBT_PUBLIC(container_t) PJ_container_get (const char *name);
321 XBT_PUBLIC(container_t) PJ_container_get_or_null (const char *name);
322 XBT_PUBLIC(container_t) PJ_container_get_root (void);
323 XBT_PUBLIC(void) PJ_container_set_root (container_t root);
324 XBT_PUBLIC(void) PJ_container_free (container_t container);
325 XBT_PUBLIC(void) PJ_container_free_all (void);
326 XBT_PUBLIC(void) PJ_container_remove_from_parent (container_t container);
328 /* instr_paje_types.c */
329 void PJ_type_alloc (void);
330 void PJ_type_release (void);
331 XBT_PUBLIC(type_t) PJ_type_get_root (void);
332 type_t PJ_type_container_new (const char *name, type_t father);
333 type_t PJ_type_event_new (const char *name, type_t father);
334 type_t PJ_type_variable_new (const char *name, const char *color, type_t father);
335 type_t PJ_type_link_new (const char *name, type_t father, type_t source, type_t dest);
336 type_t PJ_type_state_new (const char *name, type_t father);
337 XBT_PUBLIC(type_t) PJ_type_get (const char *name, const type_t father);
338 XBT_PUBLIC(type_t) PJ_type_get_or_null (const char *name, type_t father);
339 void PJ_type_free (type_t type);
340 void PJ_type_free_all (void);
342 /* instr_paje_values.c */
343 XBT_PUBLIC(val_t) PJ_value_new (const char *name, const char *color, type_t father);
344 XBT_PUBLIC(val_t) PJ_value_get_or_new (const char *name, const char *color, type_t father);
345 XBT_PUBLIC(val_t) PJ_value_get (const char *name, const type_t father);
346 void PJ_value_free (val_t value);
349 void print_pajeDefineContainerType(paje_event_t event);
350 void print_pajeDefineVariableType(paje_event_t event);
351 void print_pajeDefineStateType(paje_event_t event);
352 void print_pajeDefineEventType(paje_event_t event);
353 void print_pajeDefineLinkType(paje_event_t event);
354 void print_pajeDefineEntityValue (paje_event_t event);
355 void print_pajeCreateContainer(paje_event_t event);
356 void print_pajeDestroyContainer(paje_event_t event);
357 void print_pajeSetVariable(paje_event_t event);
358 void print_pajeAddVariable(paje_event_t event);
359 void print_pajeSubVariable(paje_event_t event);
360 void print_pajeSetState(paje_event_t event);
361 void print_pajePushState(paje_event_t event);
362 void print_pajePopState(paje_event_t event);
363 void print_pajeResetState(paje_event_t event);
364 void print_pajeStartLink(paje_event_t event);
365 void print_pajeEndLink(paje_event_t event);
366 void print_pajeNewEvent (paje_event_t event);
368 void print_TIPushState(paje_event_t event);
369 void print_TICreateContainer(paje_event_t event);
370 void print_TIDestroyContainer(paje_event_t event);
371 void TRACE_TI_start(void);
372 void TRACE_TI_end(void);
373 void TRACE_TI_init(void);
375 void print_NULL (paje_event_t event);
376 void TRACE_paje_dump_buffer (int force);
377 void dump_comment_file (const char *filename);
378 void dump_comment (const char *comment);
383 typedef struct instr_trace_writer {
384 void (*print_DefineContainerType) (paje_event_t event);
385 void (*print_DefineVariableType)(paje_event_t event);
386 void (*print_DefineStateType)(paje_event_t event);
387 void (*print_DefineEventType)(paje_event_t event);
388 void (*print_DefineLinkType)(paje_event_t event);
389 void (*print_DefineEntityValue)(paje_event_t event);
390 void (*print_CreateContainer)(paje_event_t event);
391 void (*print_DestroyContainer)(paje_event_t event);
392 void (*print_SetVariable)(paje_event_t event);
393 void (*print_AddVariable)(paje_event_t event);
394 void (*print_SubVariable)(paje_event_t event);
395 void (*print_SetState)(paje_event_t event);
396 void (*print_PushState)(paje_event_t event);
397 void (*print_PopState)(paje_event_t event);
398 void (*print_ResetState)(paje_event_t event);
399 void (*print_StartLink)(paje_event_t event);
400 void (*print_EndLink)(paje_event_t event);
401 void (*print_NewEvent) (paje_event_t event);
402 } s_instr_trace_writer_t;
406 struct s_instr_extra_data;
407 typedef struct s_instr_extra_data *instr_extra_data;
438 TRACING_REDUCE_SCATTER,
446 typedef struct s_instr_extra_data {
454 const char* datatype1;
455 const char* datatype2;
459 } s_instr_extra_data_t;
461 #endif /* HAVE_TRACING */
464 #include "instr/jedule/jedule_sd_binding.h"
472 #endif /* INSTR_PRIVATE_H_ */