Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
More Valgrind suppressions, for libcgraph.
[simgrid.git] / include / msg / datatypes.h
1 /* Copyright (c) 2004-2012. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef MSG_DATATYPE_H
7 #define MSG_DATATYPE_H
8 #include "xbt/misc.h"
9 #include "xbt/lib.h"
10 #include "simgrid/simix.h"
11 #include "simgrid_config.h"     // for HAVE_TRACING
12
13 SG_BEGIN_DECL()
14
15 /* ******************************** Mailbox ************************************ */
16
17 /** @brief Mailbox datatype
18  *  @ingroup msg_task_usage
19  *
20  * Object representing a communication rendez-vous point, on which
21  * the sender finds the receiver it wants to communicate with. As a
22  * MSG user, you will only rarely manipulate any of these objects
23  * directly, since most of the public interface (such as
24  * #MSG_task_send and friends) hide this object behind a string
25  * alias. That mean that you don't provide the mailbox on which you
26  * want to send your task, but only the name of this mailbox. */
27 typedef struct s_smx_rvpoint *msg_mailbox_t;
28
29 /* ******************************** Environment ************************************ */
30 typedef struct s_as *msg_as_t;
31
32 /* ******************************** Host ************************************ */
33
34 extern int MSG_HOST_LEVEL;
35
36 /** @brief Host datatype.
37     @ingroup m_host_management
38
39     A <em>location</em> (or <em>host</em>) is any possible place where
40     a process may run. Thus it is represented as a <em>physical
41     resource with computing capabilities</em>, some <em>mailboxes</em>
42     to enable running process to communicate with remote ones, and
43     some <em>private data</em> that can be only accessed by local
44     process.
45  */
46 typedef xbt_dictelm_t msg_host_t;
47 typedef s_xbt_dictelm_t s_msg_host_t;
48
49 typedef struct msg_host_priv {
50   xbt_swag_t vms;
51 #ifdef MSG_USE_DEPRECATED
52   msg_mailbox_t *mailboxes;     /**< the channels  */
53 #endif
54 } s_msg_host_priv_t, *msg_host_priv_t;
55
56 static inline msg_host_priv_t MSG_host_priv(msg_host_t host){
57   return (msg_host_priv_t )xbt_lib_get_level(host, MSG_HOST_LEVEL);
58 }
59
60
61
62 /* ******************************** Task ************************************ */
63
64 typedef struct simdata_task *simdata_task_t;
65
66 typedef struct msg_task {
67   char *name;                   /**< @brief task name if any */
68   simdata_task_t simdata;       /**< @brief simulator data */
69   void *data;                   /**< @brief user data */
70 #ifdef HAVE_TRACING
71   long long int counter;        /* task unique identifier for instrumentation */
72   char *category;               /* task category for instrumentation */
73 #endif
74 } s_msg_task_t;
75
76 /** @brief Task datatype.
77     @ingroup m_task_management 
78
79     A <em>task</em> may then be defined by a <em>computing
80     amount</em>, a <em>message size</em> and some <em>private
81     data</em>.
82  */
83 typedef struct msg_task *msg_task_t;
84
85 /* ********************************  VM ************************************* */
86 typedef struct msg_vm *msg_vm_t;
87
88 typedef enum {
89   msg_vm_state_suspended, msg_vm_state_running, msg_vm_state_migrating
90 } e_msg_vm_state_t;
91
92 typedef struct msg_vm {
93   char *name;
94   s_xbt_swag_hookup_t all_vms_hookup;
95   s_xbt_swag_hookup_t host_vms_hookup;
96   xbt_dynar_t processes;
97   e_msg_vm_state_t state;
98   msg_host_t location;
99   int coreAmount;
100 } s_msg_vm_t;
101
102 /* ******************************** File ************************************ */
103 typedef struct simdata_file *simdata_file_t;
104
105 typedef struct s_file_info {
106   size_t size;
107   char* mount_point;
108   char* storageId;
109   char* storage_type;
110   char* content_type;
111 } s_file_info_t, *msg_file_info_t;
112
113 typedef struct msg_file {
114   char *fullname;               /**< @brief file full name (path+name)*/
115   simdata_file_t simdata;       /**< @brief simulator data  */
116   msg_file_info_t info;
117 } s_msg_file_t;
118
119 /** @brief File datatype.
120  *  @ingroup msg_file_management
121  *
122  *  You should consider this as an opaque object.
123  */
124
125 typedef struct msg_file *msg_file_t;
126
127 /* ******************************** Storage ************************************ */
128 /* TODO: PV: to comment */
129
130 extern int MSG_STORAGE_LEVEL;
131
132 /** @brief Storage datatype.
133  *  @ingroup msg_storage_management
134  *
135  *  You should consider this as an opaque object.
136  */
137 typedef xbt_dictelm_t msg_storage_t;
138 typedef s_xbt_dictelm_t s_msg_storage_t;
139
140 typedef struct msg_storage_priv /* {
141    TODO PV: fill it (or not) !
142 } */ s_msg_storage_priv_t, *msg_storage_priv_t;
143
144 //typedef struct simdata_storage *simdata_storage_t;
145 //
146 //typedef struct msg_storage {
147 //  char *name;
148 //  simdata_storage_t simdata;    /**< @brief simulator data  */
149 //  void *data;                   /**< @brief user data */
150 //} s_msg_storage_t;
151 //
152 //typedef struct msg_storage *msg_storage_t;
153
154 /*************** Begin GPU ***************/
155 typedef struct simdata_gpu_task *simdata_gpu_task_t;
156
157 typedef struct msg_gpu_task {
158   char *name;                   /**< @brief task name if any */
159   simdata_gpu_task_t simdata;       /**< @brief simulator data */
160 #ifdef HAVE_TRACING
161   long long int counter;        /* task unique identifier for instrumentation */
162   char *category;               /* task category for instrumentation */
163 #endif
164 } s_msg_gpu_task_t;
165
166 /** @brief GPU task datatype.
167     @ingroup m_task_management
168
169     A <em>task</em> may then be defined by a <em>computing
170     amount</em>, a <em>dispatch latency</em> and a <em>collect latency</em>.
171     \see m_task_management
172 */
173 typedef struct msg_gpu_task *msg_gpu_task_t;
174 /*************** End GPU ***************/
175
176 /**
177  * \brief @brief Communication action.
178  * \ingroup msg_task_usage
179  *
180  * Object representing an ongoing communication between processes. Such beast is usually obtained by using #MSG_task_isend, #MSG_task_irecv or friends.
181  */
182 typedef struct msg_comm *msg_comm_t;
183
184 /** \brief Default value for an uninitialized #msg_task_t.
185     \ingroup m_task_management 
186 */
187 #define MSG_TASK_UNINITIALIZED NULL
188
189 /* ****************************** Process *********************************** */
190
191 /** @brief Process datatype.
192     @ingroup m_process_management
193
194     A process may be defined as a <em>code</em>, with some
195     <em>private data</em>, executing in a <em>location</em>. 
196  
197     You should not access directly to the fields of the pointed
198     structure, but always use the provided API to interact with
199     processes.
200  */
201 typedef struct s_smx_process *msg_process_t;
202
203 #ifdef MSG_USE_DEPRECATED
204
205 /* Compatibility typedefs */
206 typedef int                     m_channel_t;
207 typedef msg_gpu_task_t          m_gpu_task_t;
208 typedef msg_host_t              m_host_t;
209 typedef msg_process_t           m_process_t;
210 typedef msg_task_t              m_task_t;
211 typedef s_msg_gpu_task_t        s_m_gpu_task_t;
212 typedef s_msg_host_t            s_m_host_t;
213 typedef s_msg_task_t            s_m_task_t;
214 #endif
215
216 SG_END_DECL()
217 #endif