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 #define INSTR_DEFAULT_STR_SIZE 500
16 #include "instr/instr.h"
18 #include "simdag/private.h"
19 #include "simix/private.h"
29 typedef struct s_type *type_t;
30 typedef struct s_type {
34 struct s_type *father;
47 typedef struct s_container *container_t;
48 typedef struct s_container {
49 char *name; /* Unique name of this container */
50 char *id; /* Unique id of this container */
51 type_t type; /* Type of this container */
52 int level; /* Level in the hierarchy, root level is 0 */
53 e_container_types kind; /* This container is of what kind */
54 struct s_container *father;
58 extern xbt_dict_t created_categories;
61 void TRACE_paje_create_header(void);
62 void TRACE_paje_start(void);
63 void TRACE_paje_end(void);
64 void pajeDefineContainerType(const char *alias, const char *containerType,
66 void pajeDefineStateType(const char *alias, const char *containerType,
68 void pajeDefineEventTypeWithColor(const char *alias, const char *containerType,
69 const char *name, const char *color);
70 void pajeDefineEventType(const char *alias, const char *containerType,
72 void pajeDefineLinkType(const char *alias, const char *containerType,
73 const char *sourceContainerType,
74 const char *destContainerType, const char *name);
75 void pajeCreateContainer(double time, const char *alias, const char *type,
76 const char *container, const char *name);
77 void pajeDestroyContainer(double time, const char *type,
78 const char *container);
79 void pajeSetState(double time, const char *entityType,
80 const char *container, const char *value);
81 void pajePushState(double time, const char *entityType,
82 const char *container, const char *value);
83 void pajePopState(double time, const char *entityType,
84 const char *container);
85 void pajeStartLink(double time, const char *entityType,
86 const char *container, const char *value,
87 const char *sourceContainer, const char *key);
88 void pajeStartLinkWithVolume(double time, const char *entityType,
89 const char *container, const char *value,
90 const char *sourceContainer, const char *key,
92 void pajeEndLink(double time, const char *entityType,
93 const char *container, const char *value,
94 const char *destContainer, const char *key);
95 void pajeDefineVariableType(const char *alias, const char *containerType,
97 void pajeDefineVariableTypeWithColor(const char *alias, const char *containerType,
98 const char *name, const char *color);
99 void pajeSetVariable(double time, const char *entityType,
100 const char *container, const char *value);
101 void pajeAddVariable(double time, const char *entityType,
102 const char *container, const char *value);
103 void pajeSubVariable(double time, const char *entityType,
104 const char *container, const char *value);
105 void pajeNewEvent(double time, const char *entityType,
106 const char *container, const char *value);
108 /* declaration of instrumentation functions from msg_task_instr.c */
109 char *TRACE_task_container(m_task_t task, char *output, int len);
110 void TRACE_msg_task_alloc(void);
111 void TRACE_msg_task_release(void);
112 void TRACE_msg_task_create(m_task_t task);
113 void TRACE_msg_task_execute_start(m_task_t task);
114 void TRACE_msg_task_execute_end(m_task_t task);
115 void TRACE_msg_task_destroy(m_task_t task);
116 void TRACE_msg_task_get_start(void);
117 void TRACE_msg_task_get_end(double start_time, m_task_t task);
118 int TRACE_msg_task_put_start(m_task_t task); //returns TRUE if the task_put_end must be called
119 void TRACE_msg_task_put_end(void);
121 /* declaration of instrumentation functions from msg_process_instr.c */
122 char *TRACE_process_alias_container(m_process_t process, m_host_t host,
123 char *output, int len);
124 char *TRACE_process_container(m_process_t process, char *output, int len);
125 void TRACE_msg_process_alloc(void);
126 void TRACE_msg_process_release(void);
127 void TRACE_msg_process_change_host(m_process_t process, m_host_t old_host,
129 void TRACE_msg_process_kill(m_process_t process);
130 void TRACE_msg_process_suspend(m_process_t process);
131 void TRACE_msg_process_resume(m_process_t process);
132 void TRACE_msg_process_sleep_in(m_process_t process); //called from msg/gos.c
133 void TRACE_msg_process_sleep_out(m_process_t process);
134 void TRACE_msg_process_end(m_process_t process);
136 /* declaration of instrumentation functions from msg_volume.c */
137 void TRACE_msg_volume_start(m_task_t task);
138 void TRACE_msg_volume_finish(m_task_t task);
141 void TRACE_smx_host_execute(smx_action_t act);
142 void TRACE_smx_action_communicate(smx_action_t act, smx_process_t proc);
143 void TRACE_smx_action_destroy(smx_action_t act);
145 /* from surf_instr.c */
146 void TRACE_surf_alloc(void);
147 void TRACE_surf_release(void);
148 void TRACE_surf_host_set_power(double date, const char *resource, double power);
149 void TRACE_surf_link_set_bandwidth(double date, const char *resource, double bandwidth);
150 void TRACE_surf_link_set_latency(double date, const char *resource, double latency);
151 void TRACE_surf_action(surf_action_t surf_action, const char *category);
154 void TRACE_surf_gtnets_communicate(void *action, int src, int dst);
155 int TRACE_surf_gtnets_get_src(void *action);
156 int TRACE_surf_gtnets_get_dst(void *action);
157 void TRACE_surf_gtnets_destroy(void *action);
159 /* from smpi_instr.c */
160 void TRACE_internal_smpi_set_category (const char *category);
161 const char *TRACE_internal_smpi_get_category (void);
162 void TRACE_smpi_alloc(void);
163 void TRACE_smpi_release(void);
164 void TRACE_smpi_init(int rank);
165 void TRACE_smpi_finalize(int rank);
166 void TRACE_smpi_start(void);
167 void TRACE_smpi_collective_in(int rank, int root, const char *operation);
168 void TRACE_smpi_collective_out(int rank, int root, const char *operation);
169 void TRACE_smpi_ptp_in(int rank, int src, int dst, const char *operation);
170 void TRACE_smpi_ptp_out(int rank, int src, int dst, const char *operation);
171 void TRACE_smpi_send(int rank, int src, int dst);
172 void TRACE_smpi_recv(int rank, int src, int dst);
174 /* from instr_config.c */
175 int TRACE_start (void);
176 int TRACE_end (void);
177 void TRACE_activate (void);
178 void TRACE_desactivate (void);
179 int TRACE_is_active (void);
180 int TRACE_is_enabled(void);
181 int TRACE_is_configured(void);
182 int TRACE_smpi_is_enabled(void);
183 int TRACE_smpi_is_grouped(void);
184 int TRACE_categorized (void);
185 int TRACE_uncategorized (void);
186 int TRACE_msg_task_is_enabled(void);
187 int TRACE_msg_process_is_enabled(void);
188 int TRACE_msg_volume_is_enabled(void);
189 char *TRACE_get_filename(void);
190 char *TRACE_get_platform_method(void);
191 char *TRACE_get_triva_uncat_conf (void);
192 char *TRACE_get_triva_cat_conf (void);
193 void TRACE_global_init(int *argc, char **argv);
194 void TRACE_help(int detailed);
195 void TRACE_generate_triva_uncat_conf (void);
196 void TRACE_generate_triva_cat_conf (void);
198 /* from resource_utilization.c */
199 void TRACE_surf_host_set_utilization(const char *resource,
200 smx_action_t smx_action,
201 surf_action_t surf_action,
202 double value, double now,
204 void TRACE_surf_link_set_utilization(const char *resource, smx_action_t smx_action,
205 surf_action_t surf_action,
206 double value, double now,
208 void TRACE_surf_resource_utilization_start(smx_action_t action);
209 void TRACE_surf_resource_utilization_event(smx_action_t action, double now,
211 const char *variable,
212 const char *resource,
214 void TRACE_surf_resource_utilization_end(smx_action_t action);
215 void TRACE_surf_resource_utilization_alloc(void);
216 void TRACE_surf_resource_utilization_release(void);
219 void TRACE_sd_task_create(SD_task_t task);
220 void TRACE_sd_task_destroy(SD_task_t task);
222 /* instr_routing.c */
223 container_t newContainer (const char *name, e_container_types kind, container_t father);
224 container_t getContainer (const char *name);
225 type_t newContainerType (const char *typename, e_entity_types kind, type_t father);
226 type_t newEventType (const char *typename, e_entity_types kind, const char *color, type_t father);
227 type_t newVariableType (const char *typename, e_entity_types kind, const char *color, type_t father);
228 type_t newLinkType (const char *typename, e_entity_types kind, type_t father, type_t source, type_t dest);
229 type_t newStateType (const char *typename, e_entity_types kind, type_t father);
230 type_t getType (const char *name);
231 void destroyContainer (container_t container);
232 void instr_routing_define_callbacks (void);
233 int instr_link_is_traced (const char *name);
234 char *instr_variable_type (const char *name, const char *resource);
235 char *instr_resource_type (const char *resource_name);
236 void instr_destroy_platform (void);
237 void instr_new_user_variable_type (const char *new_typename, const char *color);
238 void instr_new_user_link_variable_type (const char *new_typename, const char *color);
239 void instr_new_user_host_variable_type (const char *new_typename, const char *color);
240 int instr_platform_traced (void);
242 #endif /* HAVE_TRACING */
243 #endif /* INSTR_PRIVATE_H_ */