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 "simgrid_config.h"
16 /* Need to define function drand48 for Windows */
18 # define drand48() (rand()/(RAND_MAX + 1.0))
21 #define INSTR_DEFAULT_STR_SIZE 500
23 #include "xbt/graph.h"
25 #include "simgrid/platf.h"
28 PAJE_DefineContainerType,
29 PAJE_DefineVariableType,
33 PAJE_DefineEntityValue,
35 PAJE_DestroyContainer,
56 typedef struct s_type *type_t;
57 typedef struct s_type {
62 struct s_type *father;
64 xbt_dict_t values; //valid for all types except variable and container
67 typedef struct s_val *val_t;
68 typedef struct s_val {
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;
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;
109 /* instr_paje_header.c */
110 void TRACE_header(int basic, int size);
113 void TRACE_paje_start(void);
114 void TRACE_paje_end(void);
115 void TRACE_paje_dump_buffer (int force);
116 XBT_PUBLIC(void) new_pajeDefineContainerType(type_t type);
117 XBT_PUBLIC(void) new_pajeDefineVariableType(type_t type);
118 XBT_PUBLIC(void) new_pajeDefineStateType(type_t type);
119 XBT_PUBLIC(void) new_pajeDefineEventType(type_t type);
120 XBT_PUBLIC(void) new_pajeDefineLinkType(type_t type, type_t source, type_t dest);
121 XBT_PUBLIC(void) new_pajeDefineEntityValue (val_t type);
122 XBT_PUBLIC(void) new_pajeCreateContainer (container_t container);
123 XBT_PUBLIC(void) new_pajeDestroyContainer (container_t container);
124 XBT_PUBLIC(void) new_pajeSetVariable (double timestamp, container_t container, type_t type, double value);
125 XBT_PUBLIC(void) new_pajeAddVariable (double timestamp, container_t container, type_t type, double value);
126 XBT_PUBLIC(void) new_pajeSubVariable (double timestamp, container_t container, type_t type, double value);
127 XBT_PUBLIC(void) new_pajeSetState (double timestamp, container_t container, type_t type, val_t value);
128 XBT_PUBLIC(void) new_pajePushState (double timestamp, container_t container, type_t type, val_t value);
129 XBT_PUBLIC(void) new_pajePushStateWithSize (double timestamp, container_t container, type_t type, val_t value, int size);
130 XBT_PUBLIC(void) new_pajePopState (double timestamp, container_t container, type_t type);
131 XBT_PUBLIC(void) new_pajeResetState (double timestamp, container_t container, type_t type);
132 XBT_PUBLIC(void) new_pajeStartLink (double timestamp, container_t container, type_t type, container_t sourceContainer, const char *value, const char *key);
133 XBT_PUBLIC(void) new_pajeStartLinkWithSize (double timestamp, container_t container, type_t type, container_t sourceContainer, const char *value, const char *key, int size);
134 XBT_PUBLIC(void) new_pajeEndLink (double timestamp, container_t container, type_t type, container_t destContainer, const char *value, const char *key);
135 XBT_PUBLIC(void) new_pajeNewEvent (double timestamp, container_t container, type_t type, val_t value);
138 void TRACE_surf_gtnets_communicate(void *action, void *src, void *dst);
140 /* from instr_config.c */
141 int TRACE_needs_platform (void);
142 int TRACE_is_enabled(void);
143 int TRACE_platform(void);
144 int TRACE_platform_topology(void);
145 int TRACE_is_configured(void);
146 int TRACE_categorized (void);
147 int TRACE_uncategorized (void);
148 int TRACE_msg_process_is_enabled(void);
149 int TRACE_msg_vm_is_enabled(void);
150 int TRACE_buffer (void);
151 int TRACE_disable_link(void);
152 int TRACE_disable_power(void);
153 int TRACE_onelink_only (void);
154 int TRACE_disable_destroy (void);
155 int TRACE_basic (void);
156 int TRACE_display_sizes (void);
157 char *TRACE_get_comment (void);
158 char *TRACE_get_comment_file (void);
159 char *TRACE_get_filename(void);
160 char *TRACE_get_viva_uncat_conf (void);
161 char *TRACE_get_viva_cat_conf (void);
162 void TRACE_generate_viva_uncat_conf (void);
163 void TRACE_generate_viva_cat_conf (void);
164 void instr_pause_tracing (void);
165 void instr_resume_tracing (void);
167 /* Public functions used in SMPI */
168 XBT_PUBLIC(int) TRACE_smpi_is_enabled(void);
169 XBT_PUBLIC(int) TRACE_smpi_is_grouped(void);
170 XBT_PUBLIC(int) TRACE_smpi_is_computing(void);
171 XBT_PUBLIC(int) TRACE_smpi_view_internals(void);
173 /* from resource_utilization.c */
174 void TRACE_surf_host_set_utilization(const char *resource,
175 const char *category,
179 void TRACE_surf_link_set_utilization(const char *resource,
180 const char *category,
184 void TRACE_surf_resource_utilization_alloc(void);
187 extern xbt_dict_t trivaNodeTypes;
188 extern xbt_dict_t trivaEdgeTypes;
189 long long int instr_new_paje_id (void);
190 void PJ_container_alloc (void);
191 void PJ_container_release (void);
192 XBT_PUBLIC(container_t) PJ_container_new (const char *name, e_container_types kind, container_t father);
193 XBT_PUBLIC(container_t) PJ_container_get (const char *name);
194 XBT_PUBLIC(container_t) PJ_container_get_or_null (const char *name);
195 XBT_PUBLIC(container_t) PJ_container_get_root (void);
196 XBT_PUBLIC(void) PJ_container_set_root (container_t root);
197 XBT_PUBLIC(void) PJ_container_free (container_t container);
198 XBT_PUBLIC(void) PJ_container_free_all (void);
199 XBT_PUBLIC(void) PJ_container_remove_from_parent (container_t container);
201 /* instr_paje_types.c */
202 void PJ_type_alloc (void);
203 void PJ_type_release (void);
204 XBT_PUBLIC(type_t) PJ_type_get_root (void);
205 type_t PJ_type_container_new (const char *name, type_t father);
206 type_t PJ_type_event_new (const char *name, type_t father);
207 type_t PJ_type_variable_new (const char *name, const char *color, type_t father);
208 type_t PJ_type_link_new (const char *name, type_t father, type_t source, type_t dest);
209 type_t PJ_type_state_new (const char *name, type_t father);
210 XBT_PUBLIC(type_t) PJ_type_get (const char *name, const type_t father);
211 XBT_PUBLIC(type_t) PJ_type_get_or_null (const char *name, type_t father);
212 void PJ_type_free (type_t type);
213 void PJ_type_free_all (void);
215 /* instr_paje_values.c */
216 XBT_PUBLIC(val_t) PJ_value_new (const char *name, const char *color, type_t father);
217 XBT_PUBLIC(val_t) PJ_value_get_or_new (const char *name, const char *color, type_t father);
218 XBT_PUBLIC(val_t) PJ_value_get (const char *name, const type_t father);
219 void PJ_value_free (val_t value);
225 #endif /* HAVE_TRACING */
228 #include "instr/jedule/jedule_sd_binding.h"
231 #endif /* INSTR_PRIVATE_H_ */