Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
e71d88dbb3dbb4c2f47dc1f874d71dba11af76d5
[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 } e_entity_types;
27
28 typedef struct s_type *type_t;
29 typedef struct s_type {
30   char *id;
31   char *name;
32   e_entity_types kind;
33   struct s_type *father;
34   xbt_dict_t children;
35 }s_type_t;
36
37 typedef enum {
38   INSTR_HOST,
39   INSTR_LINK,
40   INSTR_ROUTER,
41   INSTR_AS,
42   INSTR_SMPI,
43 } e_container_types;
44
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;
53   xbt_dict_t children;
54 }s_container_t;
55
56 extern xbt_dict_t created_categories;
57
58 /* from paje.c */
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,
63                              const char *name);
64 void pajeDefineStateType(const char *alias, const char *containerType,
65                          const char *name);
66 void pajeDefineEventType(const char *alias, const char *containerType,
67                          const char *name);
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,
87                              double volume);
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,
92                             const char *name);
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);
103
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);
116
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,
124                                    m_host_t new_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);
131
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);
135
136 /* from smx.c */
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);
140
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);
148
149 //for tracing gtnets
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);
154
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);
169
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);
193
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,
199                                      double delta);
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,
203                                      double delta);
204 void TRACE_surf_resource_utilization_start(smx_action_t action);
205 void TRACE_surf_resource_utilization_event(smx_action_t action, double now,
206                                            double delta,
207                                            const char *variable,
208                                            const char *resource,
209                                            double value);
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);
213
214 /* sd_instr.c */
215 void TRACE_sd_task_create(SD_task_t task);
216 void TRACE_sd_task_destroy(SD_task_t task);
217
218 /* instr_routing.c */
219 void instr_routing_define_callbacks (void);
220 int instr_link_is_traced (const char *name);
221 char *instr_variable_type (const char *name, const char *resource);
222 char *instr_resource_type (const char *resource_name);
223 void instr_destroy_platform (void);
224 void instr_new_user_variable_type (const char *new_typename, const char *color);
225 void instr_new_user_link_variable_type  (const char *new_typename, const char *color);
226 void instr_new_user_host_variable_type  (const char *new_typename, const char *color);
227 int instr_platform_traced (void);
228
229 #endif /* HAVE_TRACING */
230 #endif /* INSTR_PRIVATE_H_ */