Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : get hash of local and global variables which are not pointers
[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/file_stat.h"
10 #include "xbt/lib.h"
11 #include "simgrid/simix.h"
12 #include "simgrid_config.h"     // for HAVE_TRACING
13
14 SG_BEGIN_DECL()
15
16 /* ******************************** Mailbox ************************************ */
17
18 /** @brief Mailbox datatype
19  *  @ingroup msg_task_usage
20  *
21  * Object representing a communication rendez-vous point, on which
22  * the sender finds the receiver it wants to communicate with. As a
23  * MSG user, you will only rarely manipulate any of these objects
24  * directly, since most of the public interface (such as
25  * #MSG_task_send and friends) hide this object behind a string
26  * alias. That mean that you don't provide the mailbox on which you
27  * want to send your task, but only the name of this mailbox. */
28 typedef struct s_smx_rvpoint *msg_mailbox_t;
29
30
31 /* ******************************** Host ************************************ */
32
33 extern int MSG_HOST_LEVEL;
34
35 /** @brief Host datatype.
36     @ingroup m_host_management
37
38     A <em>location</em> (or <em>host</em>) is any possible place where
39     a process may run. Thus it is represented as a <em>physical
40     resource with computing capabilities</em>, some <em>mailboxes</em>
41     to enable running process to communicate with remote ones, and
42     some <em>private data</em> that can be only accessed by local
43     process.
44  */
45 typedef xbt_dictelm_t msg_host_t;
46 typedef s_xbt_dictelm_t s_msg_host_t;
47
48 typedef struct msg_host_priv {
49   xbt_swag_t vms;
50 #ifdef MSG_USE_DEPRECATED
51   msg_mailbox_t *mailboxes;     /**< the channels  */
52 #endif
53 } s_msg_host_priv_t, *msg_host_priv_t;
54
55 static inline msg_host_priv_t MSG_host_priv(msg_host_t host){
56   return (msg_host_priv_t )xbt_lib_get_level(host, MSG_HOST_LEVEL);
57 }
58
59
60
61 /* ******************************** Task ************************************ */
62
63 typedef struct simdata_task *simdata_task_t;
64
65 typedef struct msg_task {
66   char *name;                   /**< @brief task name if any */
67   simdata_task_t simdata;       /**< @brief simulator data */
68   void *data;                   /**< @brief user data */
69 #ifdef HAVE_TRACING
70   long long int counter;        /* task unique identifier for instrumentation */
71   char *category;               /* task category for instrumentation */
72 #endif
73 } s_msg_task_t;
74
75 /** @brief Task datatype.
76     @ingroup m_task_management 
77
78     A <em>task</em> may then be defined by a <em>computing
79     amount</em>, a <em>message size</em> and some <em>private
80     data</em>.
81  */
82 typedef struct msg_task *msg_task_t;
83
84 /* ********************************  VM ************************************* */
85 typedef struct msg_vm *msg_vm_t;
86
87 typedef enum {
88   msg_vm_state_suspended, msg_vm_state_running, msg_vm_state_migrating
89 } e_msg_vm_state_t;
90
91 typedef struct msg_vm {
92   char *name;
93   s_xbt_swag_hookup_t all_vms_hookup;
94   s_xbt_swag_hookup_t host_vms_hookup;
95   xbt_dynar_t processes;
96   e_msg_vm_state_t state;
97   msg_host_t location;
98   int coreAmount;
99 } s_msg_vm_t;
100
101 /* ******************************** File ************************************ */
102 typedef struct simdata_file *simdata_file_t;
103
104 typedef struct msg_file {
105   char *name;                   /**< @brief file name */
106   simdata_file_t simdata;                /**< @brief simulator data  */
107   void *data;                   /**< @brief user data */
108 } s_msg_file_t;
109
110 /** @brief File datatype.
111     @ingroup msg_file_management 
112  
113     You should consider this as an opaque object.
114  */
115 typedef struct msg_file *msg_file_t;
116
117
118 /** @brief File datatype.
119     @ingroup msg_file_management
120
121     You should consider this as an opaque object.
122  */
123 typedef s_file_stat_t s_msg_stat_t, *msg_stat_t;
124
125
126 /*************** Begin GPU ***************/
127 typedef struct simdata_gpu_task *simdata_gpu_task_t;
128
129 typedef struct msg_gpu_task {
130   char *name;                   /**< @brief task name if any */
131   simdata_gpu_task_t simdata;       /**< @brief simulator data */
132 #ifdef HAVE_TRACING
133   long long int counter;        /* task unique identifier for instrumentation */
134   char *category;               /* task category for instrumentation */
135 #endif
136 } s_msg_gpu_task_t;
137
138 /** @brief GPU task datatype.
139     @ingroup m_task_management
140
141     A <em>task</em> may then be defined by a <em>computing
142     amount</em>, a <em>dispatch latency</em> and a <em>collect latency</em>.
143     \see m_task_management
144 */
145 typedef struct msg_gpu_task *msg_gpu_task_t;
146 /*************** End GPU ***************/
147
148 /**
149  * \brief @brief Communication action.
150  * \ingroup msg_task_usage
151  *
152  * Object representing an ongoing communication between processes. Such beast is usually obtained by using #MSG_task_isend, #MSG_task_irecv or friends.
153  */
154 typedef struct msg_comm *msg_comm_t;
155
156 /** \brief Default value for an uninitialized #msg_task_t.
157     \ingroup m_task_management 
158 */
159 #define MSG_TASK_UNINITIALIZED NULL
160
161 /* ****************************** Process *********************************** */
162
163 /** @brief Process datatype.
164     @ingroup m_process_management
165
166     A process may be defined as a <em>code</em>, with some
167     <em>private data</em>, executing in a <em>location</em>. 
168  
169     You should not access directly to the fields of the pointed
170     structure, but always use the provided API to interact with
171     processes.
172  */
173 typedef struct s_smx_process *msg_process_t;
174
175 #ifdef MSG_USE_DEPRECATED
176
177 /* Compatibility typedefs */
178 typedef int                     m_channel_t;
179 typedef msg_gpu_task_t          m_gpu_task_t;
180 typedef msg_host_t              m_host_t;
181 typedef msg_process_t           m_process_t;
182 typedef msg_task_t              m_task_t;
183 typedef s_msg_gpu_task_t        s_m_gpu_task_t;
184 typedef s_msg_host_t            s_m_host_t;
185 typedef s_msg_task_t            s_m_task_t;
186 #endif
187
188 SG_END_DECL()
189 #endif