Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
99eccbc12afbe2748bfee5c0857b3ddbb506bd43
[simgrid.git] / src / 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 extern int tracing_active;      /* declared in paje.c */
15
16 #define IS_TRACING                        (tracing_active)
17 #define IS_TRACED(n)          (n->category)
18 #define IS_TRACING_TASKS      (TRACE_msg_task_is_enabled())
19 #define IS_TRACING_PLATFORM   (TRACE_platform_is_enabled())
20 #define IS_TRACING_PROCESSES  (TRACE_msg_process_is_enabled())
21 #define IS_TRACING_VOLUME     (TRACE_msg_volume_is_enabled())
22 #define IS_TRACING_SMPI       (TRACE_smpi_is_enabled())
23
24 #include "instr/instr.h"
25 #include "msg/msg.h"
26 #include "simdag/private.h"
27 #include "simix/private.h"
28
29 /* from paje.c */
30 void TRACE_paje_create_header(void);
31 void TRACE_paje_start(FILE * file);
32 FILE *TRACE_paje_end(void);
33 void pajeDefineContainerType(const char *alias, const char *containerType,
34                              const char *name);
35 void pajeDefineStateType(const char *alias, const char *containerType,
36                          const char *name);
37 void pajeDefineEventType(const char *alias, const char *containerType,
38                          const char *name);
39 void pajeDefineLinkType(const char *alias, const char *containerType,
40                         const char *sourceContainerType,
41                         const char *destContainerType, const char *name);
42 void pajeCreateContainer(double time, const char *alias, const char *type,
43                          const char *container, const char *name);
44 void pajeDestroyContainer(double time, const char *type,
45                           const char *container);
46 void pajeSetState(double time, const char *entityType,
47                   const char *container, const char *value);
48 void pajePushState(double time, const char *entityType,
49                    const char *container, const char *value);
50 void pajePopState(double time, const char *entityType,
51                   const char *container);
52 void pajeStartLink(double time, const char *entityType,
53                    const char *container, const char *value,
54                    const char *sourceContainer, const char *key);
55 void pajeStartLinkWithVolume(double time, const char *entityType,
56                              const char *container, const char *value,
57                              const char *sourceContainer, const char *key,
58                              double volume);
59 void pajeEndLink(double time, const char *entityType,
60                  const char *container, const char *value,
61                  const char *destContainer, const char *key);
62 void pajeDefineVariableType(const char *alias, const char *containerType,
63                             const char *name);
64 void pajeSetVariable(double time, const char *entityType,
65                      const char *container, const char *value);
66 void pajeAddVariable(double time, const char *entityType,
67                      const char *container, const char *value);
68 void pajeSubVariable(double time, const char *entityType,
69                      const char *container, const char *value);
70 void pajeNewEvent(double time, const char *entityType,
71                   const char *container, const char *value);
72
73 /* from general.c */
74 char *TRACE_paje_msg_container(m_task_t task, char *host, char *output,
75                                int len);
76 char *TRACE_paje_smx_container(smx_action_t action, int seqnumber,
77                                char *host, char *output, int len);
78 char *TRACE_paje_surf_container(void *action, int seqnumber, char *output,
79                                 int len);
80 char *TRACE_host_container(m_host_t host, char *output, int len);
81 char *TRACE_task_container(m_task_t task, char *output, int len);
82 char *TRACE_process_container(m_process_t process, char *output, int len);
83 char *TRACE_process_alias_container(m_process_t process, m_host_t host,
84                                     char *output, int len);
85 char *TRACE_task_alias_container(m_task_t task, m_process_t process,
86                                  m_host_t host, char *output, int len);
87
88 /* from categories.c */
89 void TRACE_category_alloc(void);
90 void TRACE_category_release(void);
91 void TRACE_category_set(smx_process_t proc, const char *category);
92 char *TRACE_category_get(smx_process_t proc);
93 void TRACE_category_unset(smx_process_t proc);
94 void TRACE_msg_category_set(smx_process_t proc, m_task_t task);
95
96 /* declaration of instrumentation functions from msg_task_instr.c */
97 void TRACE_msg_task_alloc(void);
98 void TRACE_msg_task_release(void);
99 void TRACE_msg_task_create(m_task_t task);
100 void TRACE_msg_task_execute_start(m_task_t task);
101 void TRACE_msg_task_execute_end(m_task_t task);
102 void TRACE_msg_task_destroy(m_task_t task);
103 void TRACE_msg_task_get_start(void);
104 void TRACE_msg_task_get_end(double start_time, m_task_t task);
105 int TRACE_msg_task_put_start(m_task_t task);    //returns TRUE if the task_put_end must be called
106 void TRACE_msg_task_put_end(void);
107
108 /* declaration of instrumentation functions from msg_process_instr.c */
109 void TRACE_msg_process_alloc(void);
110 void TRACE_msg_process_release(void);
111 void TRACE_msg_process_change_host(m_process_t process, m_host_t old_host,
112                                    m_host_t new_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 /* declaration of instrumentation functions from msg_volume.c */
121 void TRACE_msg_volume_start(m_task_t task);
122 void TRACE_msg_volume_finish(m_task_t task);
123
124 /* from smx.c */
125 void TRACE_smx_action_execute(smx_action_t act);
126 void TRACE_smx_action_communicate(smx_action_t act, smx_process_t proc);
127 void TRACE_smx_action_destroy(smx_action_t act);
128
129 /* from surf_instr.c */
130 void TRACE_surf_alloc(void);
131 void TRACE_surf_release(void);
132 void TRACE_surf_host_declaration(const char *name, double power);
133 void TRACE_surf_host_set_power(double date, const char *resource,
134                                double power);
135 void TRACE_surf_host_define_id(const char *name, int host_id);
136 void TRACE_surf_host_vivaldi_parse(char *host, double x, double y,
137                                    double h);
138 void TRACE_surf_link_declaration(void *link, char *name, double bw,
139                                  double lat);
140 void TRACE_surf_link_set_bandwidth(double date, void *link,
141                                    double bandwidth);
142 void TRACE_surf_link_set_latency(double date, void *link, double latency);
143 void TRACE_surf_save_onelink(void);
144 int TRACE_surf_link_is_traced(void *link);
145 void TRACE_surf_action(surf_action_t surf_action, const char *category);
146
147 //for tracing gtnets
148 void TRACE_surf_gtnets_communicate(void *action, int src, int dst);
149 int TRACE_surf_gtnets_get_src(void *action);
150 int TRACE_surf_gtnets_get_dst(void *action);
151 void TRACE_surf_gtnets_destroy(void *action);
152
153 /* from smpi_instr.c */
154 void TRACE_smpi_alloc(void);
155 void TRACE_smpi_release(void);
156 void TRACE_smpi_init(int rank);
157 void TRACE_smpi_finalize(int rank);
158 void TRACE_smpi_start(void);
159 void TRACE_smpi_collective_in(int rank, int root, const char *operation);
160 void TRACE_smpi_collective_out(int rank, int root, const char *operation);
161 void TRACE_smpi_ptp_in(int rank, int src, int dst, const char *operation);
162 void TRACE_smpi_ptp_out(int rank, int src, int dst, const char *operation);
163 void TRACE_smpi_send(int rank, int src, int dst);
164 void TRACE_smpi_recv(int rank, int src, int dst);
165
166 /* from instr_config.c */
167 int TRACE_is_configured(void);
168 int TRACE_smpi_is_enabled(void);
169 int TRACE_platform_is_enabled(void);
170 int TRACE_msg_task_is_enabled(void);
171 int TRACE_msg_process_is_enabled(void);
172 int TRACE_msg_volume_is_enabled(void);
173 char *TRACE_get_filename(void);
174 char *TRACE_get_platform_method(void);
175 void TRACE_global_init(int *argc, char **argv);
176
177 /* from resource_utilization.c */
178 void TRACE_surf_host_set_utilization(const char *name,
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(void *link, 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 #endif
202
203 #endif                          /* PRIVATE_H_ */