Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cb8e1f0bc820f9a4ae39edfa2bfcab1ac627d8b1
[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   char *color;
34   e_entity_types kind;
35   struct s_type *father;
36   xbt_dict_t children;
37 }s_type_t;
38
39 typedef enum {
40   INSTR_HOST,
41   INSTR_LINK,
42   INSTR_ROUTER,
43   INSTR_AS,
44   INSTR_SMPI,
45   INSTR_MSG_PROCESS,
46   INSTR_MSG_TASK,
47 } e_container_types;
48
49 typedef struct s_container *container_t;
50 typedef struct s_container {
51   char *name;     /* Unique name of this container */
52   char *id;       /* Unique id of this container */
53   type_t type;    /* Type of this container */
54   int level;      /* Level in the hierarchy, root level is 0 */
55   e_container_types kind; /* This container is of what kind */
56   struct s_container *father;
57   xbt_dict_t children;
58 }s_container_t;
59
60 extern xbt_dict_t created_categories;
61 extern double TRACE_last_timestamp_to_dump;
62
63 /* from paje.c */
64 void TRACE_paje_create_header(void);
65 void TRACE_paje_start(void);
66 void TRACE_paje_end(void);
67 void TRACE_paje_dump_buffer (void);
68 void new_pajeDefineContainerType(type_t type);
69 void new_pajeDefineVariableType(type_t type);
70 void new_pajeDefineStateType(type_t type);
71 void new_pajeDefineEventType(type_t type);
72 void new_pajeDefineLinkType(type_t type, type_t source, type_t dest);
73 void new_pajeCreateContainer (container_t container);
74 void new_pajeDestroyContainer (container_t container);
75 void new_pajeSetVariable (double timestamp, container_t container, type_t type, double value);
76 void new_pajeAddVariable (double timestamp, container_t container, type_t type, double value);
77 void new_pajeSubVariable (double timestamp, container_t container, type_t type, double value);
78 void new_pajeSetState (double timestamp, container_t container, type_t type, const char *value);
79 void new_pajePushState (double timestamp, container_t container, type_t type, const char *value);
80 void new_pajePopState (double timestamp, container_t container, type_t type);
81 void new_pajeStartLink (double timestamp, container_t container, type_t type, container_t sourceContainer, const char *value, const char *key);
82 void new_pajeEndLink (double timestamp, container_t container, type_t type, container_t destContainer, const char *value, const char *key);
83 void new_pajeNewEvent (double timestamp, container_t container, type_t type, const char *value);
84
85 /* declaration of instrumentation functions from msg_task_instr.c */
86 char *TRACE_task_container(m_task_t task, char *output, int len);
87 void TRACE_msg_task_create(m_task_t task);
88 void TRACE_msg_task_execute_start(m_task_t task);
89 void TRACE_msg_task_execute_end(m_task_t task);
90 void TRACE_msg_task_destroy(m_task_t task);
91 void TRACE_msg_task_get_start(void);
92 void TRACE_msg_task_get_end(double start_time, m_task_t task);
93 int TRACE_msg_task_put_start(m_task_t task);    //returns TRUE if the task_put_end must be called
94 void TRACE_msg_task_put_end(void);
95
96 /* declaration of instrumentation functions from msg_process_instr.c */
97 char *TRACE_process_alias_container(m_process_t process, m_host_t host,
98                                     char *output, int len);
99 char *TRACE_process_container(m_process_t process, char *output, int len);
100 void TRACE_msg_process_change_host(m_process_t process, m_host_t old_host,
101                                    m_host_t new_host);
102 void TRACE_msg_process_kill(m_process_t process);
103 void TRACE_msg_process_suspend(m_process_t process);
104 void TRACE_msg_process_resume(m_process_t process);
105 void TRACE_msg_process_sleep_in(m_process_t process);   //called from msg/gos.c
106 void TRACE_msg_process_sleep_out(m_process_t process);
107 void TRACE_msg_process_end(m_process_t process);
108
109 /* declaration of instrumentation functions from msg_volume.c */
110 void TRACE_msg_volume_start(m_task_t task);
111 void TRACE_msg_volume_finish(m_task_t task);
112
113 /* from smx.c */
114 void TRACE_smx_host_execute(smx_action_t act);
115 void TRACE_smx_action_communicate(smx_action_t act, smx_process_t proc);
116 void TRACE_smx_action_destroy(smx_action_t act);
117
118 /* from surf_instr.c */
119 void TRACE_surf_alloc(void);
120 void TRACE_surf_release(void);
121 void TRACE_surf_host_set_power(double date, const char *resource, double power);
122 void TRACE_surf_link_set_bandwidth(double date, const char *resource, double bandwidth);
123 void TRACE_surf_link_set_latency(double date, const char *resource, double latency);
124 void TRACE_surf_action(surf_action_t surf_action, const char *category);
125
126 //for tracing gtnets
127 void TRACE_surf_gtnets_communicate(void *action, int src, int dst);
128 int TRACE_surf_gtnets_get_src(void *action);
129 int TRACE_surf_gtnets_get_dst(void *action);
130 void TRACE_surf_gtnets_destroy(void *action);
131
132 /* from smpi_instr.c */
133 void TRACE_internal_smpi_set_category (const char *category);
134 const char *TRACE_internal_smpi_get_category (void);
135 void TRACE_smpi_alloc(void);
136 void TRACE_smpi_release(void);
137 void TRACE_smpi_init(int rank);
138 void TRACE_smpi_finalize(int rank);
139 void TRACE_smpi_start(void);
140 void TRACE_smpi_collective_in(int rank, int root, const char *operation);
141 void TRACE_smpi_collective_out(int rank, int root, const char *operation);
142 void TRACE_smpi_ptp_in(int rank, int src, int dst, const char *operation);
143 void TRACE_smpi_ptp_out(int rank, int src, int dst, const char *operation);
144 void TRACE_smpi_send(int rank, int src, int dst);
145 void TRACE_smpi_recv(int rank, int src, int dst);
146
147 /* from instr_config.c */
148 int TRACE_start (void);
149 int TRACE_end (void);
150 void TRACE_activate (void);
151 void TRACE_desactivate (void);
152 int TRACE_is_active (void);
153 int TRACE_is_enabled(void);
154 int TRACE_is_configured(void);
155 int TRACE_smpi_is_enabled(void);
156 int TRACE_smpi_is_grouped(void);
157 int TRACE_categorized (void);
158 int TRACE_uncategorized (void);
159 int TRACE_msg_task_is_enabled(void);
160 int TRACE_msg_process_is_enabled(void);
161 int TRACE_msg_volume_is_enabled(void);
162 char *TRACE_get_filename(void);
163 char *TRACE_get_platform_method(void);
164 char *TRACE_get_triva_uncat_conf (void);
165 char *TRACE_get_triva_cat_conf (void);
166 void TRACE_global_init(int *argc, char **argv);
167 void TRACE_help(int detailed);
168 void TRACE_generate_triva_uncat_conf (void);
169 void TRACE_generate_triva_cat_conf (void);
170
171 /* from resource_utilization.c */
172 void TRACE_surf_host_set_utilization(const char *resource,
173                                      smx_action_t smx_action,
174                                      surf_action_t surf_action,
175                                      double value, double now,
176                                      double delta);
177 void TRACE_surf_link_set_utilization(const char *resource, smx_action_t smx_action,
178                                      surf_action_t surf_action,
179                                      double value, double now,
180                                      double delta);
181 void TRACE_surf_resource_utilization_start(smx_action_t action);
182 void TRACE_surf_resource_utilization_event(smx_action_t action, double now,
183                                            double delta,
184                                            const char *variable,
185                                            const char *resource,
186                                            double value);
187 void TRACE_surf_resource_utilization_end(smx_action_t action);
188 void TRACE_surf_resource_utilization_alloc(void);
189 void TRACE_surf_resource_utilization_release(void);
190
191 /* sd_instr.c */
192 void TRACE_sd_task_create(SD_task_t task);
193 void TRACE_sd_task_destroy(SD_task_t task);
194
195 /* instr_paje.c */
196 extern xbt_dict_t trivaNodeTypes;
197 extern xbt_dict_t trivaEdgeTypes;
198 container_t newContainer (const char *name, e_container_types kind, container_t father);
199 container_t getContainer (const char *name);
200 container_t getContainerByName (const char *name);
201 char *getContainerIdByName (const char *name);
202 char *getVariableTypeIdByName (const char *name, type_t father);
203 container_t getRootContainer (void);
204 void instr_paje_init (container_t root);
205 type_t getRootType (void);
206 type_t getContainerType (const char *name, type_t father);
207 type_t getEventType (const char *name, const char *color, type_t father);
208 type_t getVariableType (const char *name, const char *color, type_t father);
209 type_t getLinkType (const char *name, type_t father, type_t source, type_t dest);
210 type_t getStateType (const char *name, type_t father);
211 type_t getType (const char *name);
212 void destroyContainer (container_t container);
213 void destroyAllContainers (void);
214
215 /* instr_routing.c */
216 void instr_routing_define_callbacks (void);
217 void instr_new_user_variable_type (const char *new_typename, const char *color);
218 void instr_new_user_link_variable_type  (const char *new_typename, const char *color);
219 void instr_new_user_host_variable_type  (const char *new_typename, const char *color);
220 int instr_platform_traced (void);
221
222 #endif /* HAVE_TRACING */
223 #endif /* INSTR_PRIVATE_H_ */