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