Logo AND Algorithmique Numérique Distribuée

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