1 /* Copyright (c) 2010. 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 "simgrid_config.h"
14 /* Need to define function drand48 for Windows */
16 # define drand48() (rand()/(RAND_MAX + 1.0))
19 #define INSTR_DEFAULT_STR_SIZE 500
21 #include "instr/instr.h"
23 #include "simdag/private.h"
24 #include "simix/smx_private.h"
25 #include "xbt/graph_private.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;
105 /* instr_paje_header.c */
106 void TRACE_header(int basic);
109 void TRACE_paje_start(void);
110 void TRACE_paje_end(void);
111 void TRACE_paje_dump_buffer (int force);
112 void new_pajeDefineContainerType(type_t type);
113 void new_pajeDefineVariableType(type_t type);
114 void new_pajeDefineStateType(type_t type);
115 void new_pajeDefineEventType(type_t type);
116 void new_pajeDefineLinkType(type_t type, type_t source, type_t dest);
117 void new_pajeDefineEntityValue (val_t type);
118 void new_pajeCreateContainer (container_t container);
119 void new_pajeDestroyContainer (container_t container);
120 void new_pajeSetVariable (double timestamp, container_t container, type_t type, double value);
121 void new_pajeAddVariable (double timestamp, container_t container, type_t type, double value);
122 void new_pajeSubVariable (double timestamp, container_t container, type_t type, double value);
123 void new_pajeSetState (double timestamp, container_t container, type_t type, val_t value);
124 void new_pajePushState (double timestamp, container_t container, type_t type, val_t value);
125 void new_pajePopState (double timestamp, container_t container, type_t type);
126 void new_pajeResetState (double timestamp, container_t container, type_t type);
127 void new_pajeStartLink (double timestamp, container_t container, type_t type, container_t sourceContainer, const char *value, const char *key);
128 void new_pajeEndLink (double timestamp, container_t container, type_t type, container_t destContainer, const char *value, const char *key);
129 void new_pajeNewEvent (double timestamp, container_t container, type_t type, val_t value);
131 /* declaration of instrumentation functions from msg_task_instr.c */
132 void TRACE_msg_set_task_category(msg_task_t task, const char *category);
133 void TRACE_msg_task_create(msg_task_t task);
134 void TRACE_msg_task_execute_start(msg_task_t task);
135 void TRACE_msg_task_execute_end(msg_task_t task);
136 void TRACE_msg_task_destroy(msg_task_t task);
137 void TRACE_msg_task_get_start(void);
138 void TRACE_msg_task_get_end(double start_time, msg_task_t task);
139 int TRACE_msg_task_put_start(msg_task_t task); //returns TRUE if the task_put_end must be called
140 void TRACE_msg_task_put_end(void);
142 /* declaration of instrumentation functions from msg_process_instr.c */
143 char *instr_process_id (msg_process_t proc, char *str, int len);
144 char *instr_process_id_2 (const char *process_name, int process_pid, char *str, int len);
145 void TRACE_msg_process_change_host(msg_process_t process, msg_host_t old_host,
146 msg_host_t new_host);
147 void TRACE_msg_process_create (const char *process_name, int process_pid, msg_host_t host);
148 void TRACE_msg_process_destroy (const char *process_name, int process_pid, msg_host_t host);
149 void TRACE_msg_process_kill(msg_process_t process);
150 void TRACE_msg_process_suspend(msg_process_t process);
151 void TRACE_msg_process_resume(msg_process_t process);
152 void TRACE_msg_process_sleep_in(msg_process_t process); //called from msg/gos.c
153 void TRACE_msg_process_sleep_out(msg_process_t process);
154 void TRACE_msg_process_end(msg_process_t process);
156 /* declaration of instrumentation functions from instr_msg_vm.c */
157 char *instr_vm_id (msg_vm_t vm, char *str, int len);
158 char *instr_vm_id_2 (const char *vm_name, char *str, int len);
159 void TRACE_msg_vm_change_host(msg_vm_t vm, msg_host_t old_host,
160 msg_host_t new_host);
161 void TRACE_msg_vm_create (const char *vm_name, msg_host_t host);
162 void TRACE_msg_vm_kill(msg_vm_t process);
163 void TRACE_msg_vm_suspend(msg_vm_t vm);
164 void TRACE_msg_vm_resume(msg_vm_t vm);
165 void TRACE_msg_vm_sleep_in(msg_vm_t vm);
166 void TRACE_msg_vm_sleep_out(msg_vm_t vm);
167 void TRACE_msg_vm_end(msg_vm_t vm);
169 /* from surf_instr.c */
170 void TRACE_surf_alloc(void);
171 void TRACE_surf_release(void);
172 void TRACE_surf_host_set_power(double date, const char *resource, double power);
173 void TRACE_surf_link_set_bandwidth(double date, const char *resource, double bandwidth);
174 void TRACE_surf_link_set_latency(double date, const char *resource, double latency);
175 void TRACE_surf_action(surf_action_t surf_action, const char *category);
178 void TRACE_surf_gtnets_communicate(void *action, void *src, void *dst);
180 /* from smpi_instr.c */
181 void TRACE_internal_smpi_set_category (const char *category);
182 const char *TRACE_internal_smpi_get_category (void);
183 void TRACE_smpi_alloc(void);
184 void TRACE_smpi_release(void);
185 void TRACE_smpi_init(int rank);
186 void TRACE_smpi_finalize(int rank);
187 void TRACE_smpi_collective_in(int rank, int root, const char *operation);
188 void TRACE_smpi_collective_out(int rank, int root, const char *operation);
189 void TRACE_smpi_computing_init(int rank);
190 void TRACE_smpi_computing_out(int rank);
191 void TRACE_smpi_computing_in(int rank);
192 void TRACE_smpi_ptp_in(int rank, int src, int dst, const char *operation);
193 void TRACE_smpi_ptp_out(int rank, int src, int dst, const char *operation);
194 void TRACE_smpi_send(int rank, int src, int dst);
195 void TRACE_smpi_recv(int rank, int src, int dst);
197 /* from instr_config.c */
198 int TRACE_start (void);
199 int TRACE_end (void);
200 int TRACE_needs_platform (void);
201 int TRACE_is_enabled(void);
202 int TRACE_platform(void);
203 int TRACE_platform_topology(void);
204 int TRACE_is_configured(void);
205 int TRACE_smpi_is_enabled(void);
206 int TRACE_smpi_is_grouped(void);
207 int TRACE_smpi_is_computing(void);
208 int TRACE_categorized (void);
209 int TRACE_uncategorized (void);
210 int TRACE_msg_process_is_enabled(void);
211 int TRACE_msg_vm_is_enabled(void);
212 int TRACE_buffer (void);
213 int TRACE_onelink_only (void);
214 int TRACE_disable_destroy (void);
215 int TRACE_basic (void);
216 char *TRACE_get_comment (void);
217 char *TRACE_get_comment_file (void);
218 char *TRACE_get_filename(void);
219 char *TRACE_get_viva_uncat_conf (void);
220 char *TRACE_get_viva_cat_conf (void);
221 void TRACE_global_init(int *argc, char **argv);
222 void TRACE_help(int detailed);
223 void TRACE_generate_viva_uncat_conf (void);
224 void TRACE_generate_viva_cat_conf (void);
225 void instr_pause_tracing (void);
226 void instr_resume_tracing (void);
228 /* from resource_utilization.c */
229 void TRACE_surf_host_set_utilization(const char *resource,
230 const char *category,
234 void TRACE_surf_link_set_utilization(const char *resource,
235 const char *category,
239 void TRACE_surf_resource_utilization_alloc(void);
240 void TRACE_surf_resource_utilization_release(void);
243 extern xbt_dict_t trivaNodeTypes;
244 extern xbt_dict_t trivaEdgeTypes;
245 long long int instr_new_paje_id (void);
246 void PJ_container_alloc (void);
247 void PJ_container_release (void);
248 container_t PJ_container_new (const char *name, e_container_types kind, container_t father);
249 container_t PJ_container_get (const char *name);
250 container_t PJ_container_get_or_null (const char *name);
251 container_t PJ_container_get_root (void);
252 void PJ_container_set_root (container_t root);
253 void PJ_container_free (container_t container);
254 void PJ_container_free_all (void);
255 void PJ_container_remove_from_parent (container_t container);
257 /* instr_paje_types.c */
258 void PJ_type_alloc (void);
259 void PJ_type_release (void);
260 type_t PJ_type_get_root (void);
261 type_t PJ_type_container_new (const char *name, type_t father);
262 type_t PJ_type_event_new (const char *name, type_t father);
263 type_t PJ_type_variable_new (const char *name, const char *color, type_t father);
264 type_t PJ_type_link_new (const char *name, type_t father, type_t source, type_t dest);
265 type_t PJ_type_state_new (const char *name, type_t father);
266 type_t PJ_type_get (const char *name, const type_t father);
267 type_t PJ_type_get_or_null (const char *name, type_t father);
268 void PJ_type_free (type_t type);
269 void PJ_type_free_all (void);
271 /* instr_paje_values.c */
272 val_t PJ_value_new (const char *name, const char *color, type_t father);
273 val_t PJ_value_get_or_new (const char *name, const char *color, type_t father);
274 val_t PJ_value_get (const char *name, const type_t father);
275 void PJ_value_free (val_t value);
277 /* instr_routing.c */
278 void instr_routing_define_callbacks (void);
279 void instr_new_variable_type (const char *new_typename, const char *color);
280 void instr_new_user_variable_type (const char *father_type, const char *new_typename, const char *color);
281 void instr_new_user_state_type (const char *father_type, const char *new_typename);
282 void instr_new_value_for_user_state_type (const char *typename, const char *value, const char *color);
283 int instr_platform_traced (void);
284 xbt_graph_t instr_routing_platform_graph (void);
285 void instr_routing_platform_graph_export_graphviz (xbt_graph_t g, const char *filename);
287 #endif /* HAVE_TRACING */
290 #include "instr/jedule/jedule_sd_binding.h"
293 #endif /* INSTR_PRIVATE_H_ */