Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
e7d8355f4d97383be7d113811926a1741bf8d13b
[simgrid.git] / src / instr / instr_private.h
1 /* Copyright (c) 2010. The SimGrid Team.
2  * All rights reserved.                                                     */
3
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. */
6
7 #ifndef INSTR_PRIVATE_H_
8 #define INSTR_PRIVATE_H_
9
10 #include "simgrid_config.h"
11
12 #ifdef HAVE_TRACING
13
14 #define INSTR_DEFAULT_STR_SIZE 500
15
16 #include "instr/instr.h"
17 #include "msg/msg.h"
18 #include "simdag/private.h"
19 #include "simix/private.h"
20
21 typedef enum {
22   TYPE_VARIABLE,
23   TYPE_LINK,
24   TYPE_CONTAINER,
25   TYPE_STATE,
26   TYPE_EVENT,
27 } e_entity_types;
28
29 typedef struct s_type *type_t;
30 typedef struct s_type {
31   char *id;
32   char *name;
33   e_entity_types kind;
34   struct s_type *father;
35   xbt_dict_t children;
36 }s_type_t;
37
38 typedef enum {
39   INSTR_HOST,
40   INSTR_LINK,
41   INSTR_ROUTER,
42   INSTR_AS,
43   INSTR_SMPI,
44   INSTR_MSG_PROCESS,
45   INSTR_MSG_TASK,
46 } e_container_types;
47
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;
56   xbt_dict_t children;
57 }s_container_t;
58
59 extern xbt_dict_t created_categories;
60
61 /* from paje.c */
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,
66                              const char *name);
67 void pajeDefineStateType(const char *alias, const char *containerType,
68                          const char *name);
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,
72                          const char *name);
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,
92                              double volume);
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,
97                             const char *name);
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);
108
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);
119
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,
125                                    m_host_t new_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);
132
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);
136
137 /* from smx.c */
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);
141
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);
149
150 //for tracing gtnets
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);
155
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);
170
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);
194
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,
200                                      double delta);
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,
204                                      double delta);
205 void TRACE_surf_resource_utilization_start(smx_action_t action);
206 void TRACE_surf_resource_utilization_event(smx_action_t action, double now,
207                                            double delta,
208                                            const char *variable,
209                                            const char *resource,
210                                            double value);
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);
214
215 /* sd_instr.c */
216 void TRACE_sd_task_create(SD_task_t task);
217 void TRACE_sd_task_destroy(SD_task_t task);
218
219 /* instr_paje.c */
220 container_t newContainer (const char *name, e_container_types kind, container_t father);
221 container_t getContainer (const char *name);
222 container_t getContainerByName (const char *name);
223 char *getContainerIdByName (const char *name);
224 char *getVariableTypeIdByName (const char *name, type_t father);
225 container_t getRootContainer (void);
226 void instr_paje_init (container_t root);
227 type_t getRootType (void);
228 type_t getContainerType (const char *name, type_t father);
229 type_t getEventType (const char *name, const char *color, type_t father);
230 type_t getVariableType (const char *name, const char *color, type_t father);
231 type_t getLinkType (const char *name, type_t father, type_t source, type_t dest);
232 type_t getStateType (const char *name, type_t father);
233 type_t getType (const char *name);
234 void destroyContainer (container_t container);
235 void destroyAllContainers (void);
236
237 /* instr_routing.c */
238 void instr_routing_define_callbacks (void);
239 void instr_new_user_variable_type (const char *new_typename, const char *color);
240 void instr_new_user_link_variable_type  (const char *new_typename, const char *color);
241 void instr_new_user_host_variable_type  (const char *new_typename, const char *color);
242 int instr_platform_traced (void);
243
244 #endif /* HAVE_TRACING */
245 #endif /* INSTR_PRIVATE_H_ */