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;
48 typedef struct s_container *container_t;
49 typedef struct s_container {
50 char *name; /* Unique name of this container */
51 char *id; /* Unique id of this container */
52 type_t type; /* Type of this container */
53 int level; /* Level in the hierarchy, root level is 0 */
54 e_container_types kind; /* This container is of what kind */
55 struct s_container *father;
59 extern xbt_dict_t created_categories;
62 void TRACE_paje_create_header(void);
63 void TRACE_paje_start(void);
64 void TRACE_paje_end(void);
65 void pajeDefineContainerType(const char *alias, const char *containerType,
67 void pajeDefineStateType(const char *alias, const char *containerType,
69 void pajeDefineEventTypeWithColor(const char *alias, const char *containerType,
70 const char *name, const char *color);
71 void pajeDefineEventType(const char *alias, const char *containerType,
73 void pajeDefineLinkType(const char *alias, const char *containerType,
74 const char *sourceContainerType,
75 const char *destContainerType, const char *name);
76 void pajeCreateContainer(double time, const char *alias, const char *type,
77 const char *container, const char *name);
78 void pajeDestroyContainer(double time, const char *type,
79 const char *container);
80 void pajeSetState(double time, const char *entityType,
81 const char *container, const char *value);
82 void pajePushState(double time, const char *entityType,
83 const char *container, const char *value);
84 void pajePopState(double time, const char *entityType,
85 const char *container);
86 void pajeStartLink(double time, const char *entityType,
87 const char *container, const char *value,
88 const char *sourceContainer, const char *key);
89 void pajeStartLinkWithVolume(double time, const char *entityType,
90 const char *container, const char *value,
91 const char *sourceContainer, const char *key,
93 void pajeEndLink(double time, const char *entityType,
94 const char *container, const char *value,
95 const char *destContainer, const char *key);
96 void pajeDefineVariableType(const char *alias, const char *containerType,
98 void pajeDefineVariableTypeWithColor(const char *alias, const char *containerType,
99 const char *name, const char *color);
100 void pajeSetVariable(double time, const char *entityType,
101 const char *container, const char *value);
102 void pajeAddVariable(double time, const char *entityType,
103 const char *container, const char *value);
104 void pajeSubVariable(double time, const char *entityType,
105 const char *container, const char *value);
106 void pajeNewEvent(double time, const char *entityType,
107 const char *container, const char *value);
109 /* declaration of instrumentation functions from msg_task_instr.c */
110 char *TRACE_task_container(m_task_t task, char *output, int len);
111 void TRACE_msg_task_create(m_task_t task);
112 void TRACE_msg_task_execute_start(m_task_t task);
113 void TRACE_msg_task_execute_end(m_task_t task);
114 void TRACE_msg_task_destroy(m_task_t task);
115 void TRACE_msg_task_get_start(void);
116 void TRACE_msg_task_get_end(double start_time, m_task_t task);
117 int TRACE_msg_task_put_start(m_task_t task); //returns TRUE if the task_put_end must be called
118 void TRACE_msg_task_put_end(void);
120 /* declaration of instrumentation functions from msg_process_instr.c */
121 char *TRACE_process_alias_container(m_process_t process, m_host_t host,
122 char *output, int len);
123 char *TRACE_process_container(m_process_t process, char *output, int len);
124 void TRACE_msg_process_change_host(m_process_t process, m_host_t old_host,
126 void TRACE_msg_process_kill(m_process_t process);
127 void TRACE_msg_process_suspend(m_process_t process);
128 void TRACE_msg_process_resume(m_process_t process);
129 void TRACE_msg_process_sleep_in(m_process_t process); //called from msg/gos.c
130 void TRACE_msg_process_sleep_out(m_process_t process);
131 void TRACE_msg_process_end(m_process_t process);
133 /* declaration of instrumentation functions from msg_volume.c */
134 void TRACE_msg_volume_start(m_task_t task);
135 void TRACE_msg_volume_finish(m_task_t task);
138 void TRACE_smx_host_execute(smx_action_t act);
139 void TRACE_smx_action_communicate(smx_action_t act, smx_process_t proc);
140 void TRACE_smx_action_destroy(smx_action_t act);
142 /* from surf_instr.c */
143 void TRACE_surf_alloc(void);
144 void TRACE_surf_release(void);
145 void TRACE_surf_host_set_power(double date, const char *resource, double power);
146 void TRACE_surf_link_set_bandwidth(double date, const char *resource, double bandwidth);
147 void TRACE_surf_link_set_latency(double date, const char *resource, double latency);
148 void TRACE_surf_action(surf_action_t surf_action, const char *category);
151 void TRACE_surf_gtnets_communicate(void *action, int src, int dst);
152 int TRACE_surf_gtnets_get_src(void *action);
153 int TRACE_surf_gtnets_get_dst(void *action);
154 void TRACE_surf_gtnets_destroy(void *action);
156 /* from smpi_instr.c */
157 void TRACE_internal_smpi_set_category (const char *category);
158 const char *TRACE_internal_smpi_get_category (void);
159 void TRACE_smpi_alloc(void);
160 void TRACE_smpi_release(void);
161 void TRACE_smpi_init(int rank);
162 void TRACE_smpi_finalize(int rank);
163 void TRACE_smpi_start(void);
164 void TRACE_smpi_collective_in(int rank, int root, const char *operation);
165 void TRACE_smpi_collective_out(int rank, int root, const char *operation);
166 void TRACE_smpi_ptp_in(int rank, int src, int dst, const char *operation);
167 void TRACE_smpi_ptp_out(int rank, int src, int dst, const char *operation);
168 void TRACE_smpi_send(int rank, int src, int dst);
169 void TRACE_smpi_recv(int rank, int src, int dst);
171 /* from instr_config.c */
172 int TRACE_start (void);
173 int TRACE_end (void);
174 void TRACE_activate (void);
175 void TRACE_desactivate (void);
176 int TRACE_is_active (void);
177 int TRACE_is_enabled(void);
178 int TRACE_is_configured(void);
179 int TRACE_smpi_is_enabled(void);
180 int TRACE_smpi_is_grouped(void);
181 int TRACE_categorized (void);
182 int TRACE_uncategorized (void);
183 int TRACE_msg_task_is_enabled(void);
184 int TRACE_msg_process_is_enabled(void);
185 int TRACE_msg_volume_is_enabled(void);
186 char *TRACE_get_filename(void);
187 char *TRACE_get_platform_method(void);
188 char *TRACE_get_triva_uncat_conf (void);
189 char *TRACE_get_triva_cat_conf (void);
190 void TRACE_global_init(int *argc, char **argv);
191 void TRACE_help(int detailed);
192 void TRACE_generate_triva_uncat_conf (void);
193 void TRACE_generate_triva_cat_conf (void);
195 /* from resource_utilization.c */
196 void TRACE_surf_host_set_utilization(const char *resource,
197 smx_action_t smx_action,
198 surf_action_t surf_action,
199 double value, double now,
201 void TRACE_surf_link_set_utilization(const char *resource, smx_action_t smx_action,
202 surf_action_t surf_action,
203 double value, double now,
205 void TRACE_surf_resource_utilization_start(smx_action_t action);
206 void TRACE_surf_resource_utilization_event(smx_action_t action, double now,
208 const char *variable,
209 const char *resource,
211 void TRACE_surf_resource_utilization_end(smx_action_t action);
212 void TRACE_surf_resource_utilization_alloc(void);
213 void TRACE_surf_resource_utilization_release(void);
216 void TRACE_sd_task_create(SD_task_t task);
217 void TRACE_sd_task_destroy(SD_task_t task);
220 extern xbt_dict_t trivaNodeTypes;
221 extern xbt_dict_t trivaEdgeTypes;
222 container_t newContainer (const char *name, e_container_types kind, container_t father);
223 container_t getContainer (const char *name);
224 container_t getContainerByName (const char *name);
225 char *getContainerIdByName (const char *name);
226 char *getVariableTypeIdByName (const char *name, type_t father);
227 container_t getRootContainer (void);
228 void instr_paje_init (container_t root);
229 type_t getRootType (void);
230 type_t getContainerType (const char *name, type_t father);
231 type_t getEventType (const char *name, const char *color, type_t father);
232 type_t getVariableType (const char *name, const char *color, type_t father);
233 type_t getLinkType (const char *name, type_t father, type_t source, type_t dest);
234 type_t getStateType (const char *name, type_t father);
235 type_t getType (const char *name);
236 void destroyContainer (container_t container);
237 void destroyAllContainers (void);
239 /* instr_routing.c */
240 void instr_routing_define_callbacks (void);
241 void instr_new_user_variable_type (const char *new_typename, const char *color);
242 void instr_new_user_link_variable_type (const char *new_typename, const char *color);
243 void instr_new_user_host_variable_type (const char *new_typename, const char *color);
244 int instr_platform_traced (void);
246 #endif /* HAVE_TRACING */
247 #endif /* INSTR_PRIVATE_H_ */