1 /* Copyright (c) 2010. The SimGrid Team.
2 * All rights reserved. */
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. */
7 #ifndef INSTR_PRIVATE_H_
8 #define INSTR_PRIVATE_H_
10 #include "simgrid_config.h"
14 #define INSTR_DEFAULT_STR_SIZE 500
16 #include "instr/instr.h"
18 #include "simdag/private.h"
19 #include "simix/private.h"
28 typedef struct s_type *type_t;
29 typedef struct s_type {
33 struct s_type *father;
44 typedef struct s_container *container_t;
45 typedef struct s_container {
46 char *name; /* Unique name of this container */
47 char *id; /* Unique id of this container */
48 type_t type; /* Type of this container */
49 int level; /* Level in the hierarchy, root level is 0 */
50 e_container_types kind; /* This container is of what kind */
51 struct s_container *father;
55 extern xbt_dict_t created_categories;
58 void TRACE_paje_create_header(void);
59 void TRACE_paje_start(void);
60 void TRACE_paje_end(void);
61 void pajeDefineContainerType(const char *alias, const char *containerType,
63 void pajeDefineStateType(const char *alias, const char *containerType,
65 void pajeDefineEventType(const char *alias, const char *containerType,
67 void pajeDefineLinkType(const char *alias, const char *containerType,
68 const char *sourceContainerType,
69 const char *destContainerType, const char *name);
70 void pajeCreateContainer(double time, const char *alias, const char *type,
71 const char *container, const char *name);
72 void pajeDestroyContainer(double time, const char *type,
73 const char *container);
74 void pajeSetState(double time, const char *entityType,
75 const char *container, const char *value);
76 void pajePushState(double time, const char *entityType,
77 const char *container, const char *value);
78 void pajePopState(double time, const char *entityType,
79 const char *container);
80 void pajeStartLink(double time, const char *entityType,
81 const char *container, const char *value,
82 const char *sourceContainer, const char *key);
83 void pajeStartLinkWithVolume(double time, const char *entityType,
84 const char *container, const char *value,
85 const char *sourceContainer, const char *key,
87 void pajeEndLink(double time, const char *entityType,
88 const char *container, const char *value,
89 const char *destContainer, const char *key);
90 void pajeDefineVariableType(const char *alias, const char *containerType,
92 void pajeDefineVariableTypeWithColor(const char *alias, const char *containerType,
93 const char *name, const char *color);
94 void pajeSetVariable(double time, const char *entityType,
95 const char *container, const char *value);
96 void pajeAddVariable(double time, const char *entityType,
97 const char *container, const char *value);
98 void pajeSubVariable(double time, const char *entityType,
99 const char *container, const char *value);
100 void pajeNewEvent(double time, const char *entityType,
101 const char *container, const char *value);
103 /* declaration of instrumentation functions from msg_task_instr.c */
104 char *TRACE_task_container(m_task_t task, char *output, int len);
105 void TRACE_msg_task_alloc(void);
106 void TRACE_msg_task_release(void);
107 void TRACE_msg_task_create(m_task_t task);
108 void TRACE_msg_task_execute_start(m_task_t task);
109 void TRACE_msg_task_execute_end(m_task_t task);
110 void TRACE_msg_task_destroy(m_task_t task);
111 void TRACE_msg_task_get_start(void);
112 void TRACE_msg_task_get_end(double start_time, m_task_t task);
113 int TRACE_msg_task_put_start(m_task_t task); //returns TRUE if the task_put_end must be called
114 void TRACE_msg_task_put_end(void);
116 /* declaration of instrumentation functions from msg_process_instr.c */
117 char *TRACE_process_alias_container(m_process_t process, m_host_t host,
118 char *output, int len);
119 char *TRACE_process_container(m_process_t process, char *output, int len);
120 void TRACE_msg_process_alloc(void);
121 void TRACE_msg_process_release(void);
122 void TRACE_msg_process_change_host(m_process_t process, m_host_t old_host,
124 void TRACE_msg_process_kill(m_process_t process);
125 void TRACE_msg_process_suspend(m_process_t process);
126 void TRACE_msg_process_resume(m_process_t process);
127 void TRACE_msg_process_sleep_in(m_process_t process); //called from msg/gos.c
128 void TRACE_msg_process_sleep_out(m_process_t process);
129 void TRACE_msg_process_end(m_process_t process);
131 /* declaration of instrumentation functions from msg_volume.c */
132 void TRACE_msg_volume_start(m_task_t task);
133 void TRACE_msg_volume_finish(m_task_t task);
136 void TRACE_smx_host_execute(smx_action_t act);
137 void TRACE_smx_action_communicate(smx_action_t act, smx_process_t proc);
138 void TRACE_smx_action_destroy(smx_action_t act);
140 /* from surf_instr.c */
141 void TRACE_surf_alloc(void);
142 void TRACE_surf_release(void);
143 void TRACE_surf_host_set_power(double date, const char *resource, double power);
144 void TRACE_surf_link_set_bandwidth(double date, const char *resource, double bandwidth);
145 void TRACE_surf_link_set_latency(double date, const char *resource, double latency);
146 void TRACE_surf_action(surf_action_t surf_action, const char *category);
149 void TRACE_surf_gtnets_communicate(void *action, int src, int dst);
150 int TRACE_surf_gtnets_get_src(void *action);
151 int TRACE_surf_gtnets_get_dst(void *action);
152 void TRACE_surf_gtnets_destroy(void *action);
154 /* from smpi_instr.c */
155 void TRACE_internal_smpi_set_category (const char *category);
156 const char *TRACE_internal_smpi_get_category (void);
157 void TRACE_smpi_alloc(void);
158 void TRACE_smpi_release(void);
159 void TRACE_smpi_init(int rank);
160 void TRACE_smpi_finalize(int rank);
161 void TRACE_smpi_start(void);
162 void TRACE_smpi_collective_in(int rank, int root, const char *operation);
163 void TRACE_smpi_collective_out(int rank, int root, const char *operation);
164 void TRACE_smpi_ptp_in(int rank, int src, int dst, const char *operation);
165 void TRACE_smpi_ptp_out(int rank, int src, int dst, const char *operation);
166 void TRACE_smpi_send(int rank, int src, int dst);
167 void TRACE_smpi_recv(int rank, int src, int dst);
169 /* from instr_config.c */
170 int TRACE_start (void);
171 int TRACE_end (void);
172 void TRACE_activate (void);
173 void TRACE_desactivate (void);
174 int TRACE_is_active (void);
175 int TRACE_is_enabled(void);
176 int TRACE_is_configured(void);
177 int TRACE_smpi_is_enabled(void);
178 int TRACE_smpi_is_grouped(void);
179 int TRACE_categorized (void);
180 int TRACE_uncategorized (void);
181 int TRACE_msg_task_is_enabled(void);
182 int TRACE_msg_process_is_enabled(void);
183 int TRACE_msg_volume_is_enabled(void);
184 char *TRACE_get_filename(void);
185 char *TRACE_get_platform_method(void);
186 char *TRACE_get_triva_uncat_conf (void);
187 char *TRACE_get_triva_cat_conf (void);
188 void TRACE_global_init(int *argc, char **argv);
189 void TRACE_help(int detailed);
190 void TRACE_generate_triva_uncat_conf (void);
191 void TRACE_generate_triva_cat_conf (void);
193 /* from resource_utilization.c */
194 void TRACE_surf_host_set_utilization(const char *resource,
195 smx_action_t smx_action,
196 surf_action_t surf_action,
197 double value, double now,
199 void TRACE_surf_link_set_utilization(const char *resource, smx_action_t smx_action,
200 surf_action_t surf_action,
201 double value, double now,
203 void TRACE_surf_resource_utilization_start(smx_action_t action);
204 void TRACE_surf_resource_utilization_event(smx_action_t action, double now,
206 const char *variable,
207 const char *resource,
209 void TRACE_surf_resource_utilization_end(smx_action_t action);
210 void TRACE_surf_resource_utilization_alloc(void);
211 void TRACE_surf_resource_utilization_release(void);
214 void TRACE_sd_task_create(SD_task_t task);
215 void TRACE_sd_task_destroy(SD_task_t task);
217 /* instr_routing.c */
218 void instr_routing_define_callbacks (void);
219 int instr_link_is_traced (const char *name);
220 char *instr_variable_type (const char *name, const char *resource);
221 char *instr_resource_type (const char *resource_name);
222 void instr_destroy_platform (void);
223 void instr_new_user_variable_type (const char *new_typename, const char *color);
224 void instr_new_user_link_variable_type (const char *new_typename, const char *color);
225 void instr_new_user_host_variable_type (const char *new_typename, const char *color);
226 int instr_platform_traced (void);
228 #endif /* HAVE_TRACING */
229 #endif /* INSTR_PRIVATE_H_ */