Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Distinguish access to sender-side and receiver-side user data in smx_action_t.
[simgrid.git] / src / simix / smurf_private.h
1 /* Copyright (c) 2007, 2008, 2009, 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 _SIMIX_SMURF_PRIVATE_H
8 #define _SIMIX_SMURF_PRIVATE_H
9
10 /********************************* Requests ***********************************/
11 typedef enum {
12   REQ_HOST_GET_BY_NAME,
13   REQ_HOST_GET_NAME,
14   REQ_HOST_GET_PROPERTIES,
15   REQ_HOST_GET_SPEED,
16   REQ_HOST_GET_AVAILABLE_SPEED,
17   REQ_HOST_GET_STATE,
18   REQ_HOST_GET_DATA,
19   REQ_HOST_SET_DATA,
20   REQ_HOST_EXECUTE,
21   REQ_HOST_PARALLEL_EXECUTE,
22   REQ_HOST_EXECUTION_DESTROY,
23   REQ_HOST_EXECUTION_CANCEL,
24   REQ_HOST_EXECUTION_GET_REMAINS,
25   REQ_HOST_EXECUTION_GET_STATE,
26   REQ_HOST_EXECUTION_SET_PRIORITY,
27   REQ_HOST_EXECUTION_WAIT,
28   REQ_PROCESS_CREATE,
29   REQ_PROCESS_KILL,
30   REQ_PROCESS_CHANGE_HOST,
31   REQ_PROCESS_SUSPEND,
32   REQ_PROCESS_RESUME,
33   REQ_PROCESS_COUNT,
34   REQ_PROCESS_GET_DATA,
35   REQ_PROCESS_SET_DATA,
36   REQ_PROCESS_GET_HOST,
37   REQ_PROCESS_GET_NAME,
38   REQ_PROCESS_IS_SUSPENDED,
39   REQ_PROCESS_GET_PROPERTIES,
40   REQ_PROCESS_SLEEP,
41   REQ_RDV_CREATE,
42   REQ_RDV_DESTROY,
43   REQ_RDV_GEY_BY_NAME,
44   REQ_RDV_COMM_COUNT_BY_HOST,
45   REQ_RDV_GET_HEAD,
46   REQ_COMM_ISEND,
47   REQ_COMM_IRECV,
48   REQ_COMM_DESTROY,
49   REQ_COMM_CANCEL,
50   REQ_COMM_WAITANY,
51   REQ_COMM_WAIT,
52   REQ_COMM_TEST,
53   REQ_COMM_TESTANY,
54   REQ_COMM_GET_REMAINS,
55   REQ_COMM_GET_STATE,
56   REQ_COMM_GET_SRC_DATA,
57   REQ_COMM_GET_DST_DATA,
58   REQ_COMM_GET_SRC_BUFF,
59   REQ_COMM_GET_DST_BUFF,
60   REQ_COMM_GET_SRC_BUFF_SIZE,
61   REQ_COMM_GET_DST_BUFF_SIZE,
62   REQ_COMM_GET_SRC_PROC,
63   REQ_COMM_GET_DST_PROC,
64 #ifdef HAVE_LATENCY_BOUND_TRACKING
65   REQ_COMM_IS_LATENCY_BOUNDED,
66 #endif
67 #ifdef HAVE_TRACING
68   REQ_SET_CATEGORY,
69 #endif
70   REQ_MUTEX_INIT,
71   REQ_MUTEX_DESTROY,
72   REQ_MUTEX_LOCK,
73   REQ_MUTEX_TRYLOCK,
74   REQ_MUTEX_UNLOCK,
75   REQ_COND_INIT,
76   REQ_COND_DESTROY,
77   REQ_COND_SIGNAL,
78   REQ_COND_WAIT,
79   REQ_COND_WAIT_TIMEOUT,
80   REQ_COND_BROADCAST,
81   REQ_SEM_INIT,
82   REQ_SEM_DESTROY,
83   REQ_SEM_RELEASE,
84   REQ_SEM_WOULD_BLOCK,
85   REQ_SEM_ACQUIRE,
86   REQ_SEM_ACQUIRE_TIMEOUT,
87   REQ_SEM_GET_CAPACITY
88 } e_smx_req_t;
89
90 typedef struct s_smx_req {
91   s_xbt_swag_hookup_t state_hookup;
92   e_smx_req_t call;
93   smx_process_t issuer;
94
95   union {
96
97     struct {
98       const char *name;
99       smx_host_t result;
100     } host_get_by_name;
101
102     struct {
103       smx_host_t host;
104       const char* result;
105     } host_get_name;
106
107     struct {
108       smx_host_t host;
109       xbt_dict_t result;
110     } host_get_properties;
111
112     struct {
113       smx_host_t host;
114       double result;
115     } host_get_speed;
116
117     struct {
118       smx_host_t host;
119       double result;
120     } host_get_available_speed;
121
122     struct {
123       smx_host_t host;
124       int result;
125     } host_get_state;
126
127     struct {
128       smx_host_t host;
129       void* result;
130     } host_get_data;
131
132     struct {
133       smx_host_t host;
134       void* data;
135     } host_set_data;
136
137     struct {
138       const char* name;
139       smx_host_t host;
140       double computation_amount;
141       smx_action_t result;
142     } host_execute;
143
144     struct {
145       const char *name;
146       int host_nb;
147       smx_host_t *host_list;
148       double *computation_amount;
149       double *communication_amount;
150       double amount;
151       double rate;
152       smx_action_t result;
153     } host_parallel_execute;
154
155     struct {
156       smx_action_t execution;
157     } host_execution_destroy;
158
159     struct {
160       smx_action_t execution;
161     } host_execution_cancel;
162
163     struct {
164       smx_action_t execution;
165       double result;
166     } host_execution_get_remains;
167
168     struct {
169       smx_action_t execution;
170       e_smx_state_t result;
171     } host_execution_get_state;
172
173     struct {
174       smx_action_t execution;
175       double priority;
176     } host_execution_set_priority;
177
178     struct {
179       smx_action_t execution;
180     } host_execution_wait;
181
182     struct {
183       const char *name;
184       xbt_main_func_t code;
185       void *data;
186       const char *hostname;
187       int argc;
188       char **argv;
189       xbt_dict_t properties;
190       smx_process_t result;
191     } process_create;
192
193     struct {
194       smx_process_t process;
195     } process_kill;
196
197     struct {
198       smx_process_t process;
199       const char *source;
200       const char *dest;
201     } process_change_host;
202
203     struct {
204       smx_process_t process;
205     } process_suspend;
206
207     struct {
208       smx_process_t process;
209     } process_resume;
210
211     struct {
212       int result;
213     } process_count;
214
215     struct {
216       smx_process_t process;
217       void* result;
218     } process_get_data;
219
220     struct {
221       smx_process_t process;
222       void* data;
223     } process_set_data;
224
225     struct {
226       smx_process_t process;
227       smx_host_t result;
228     } process_get_host;
229
230     struct {
231       smx_process_t process;
232       const char *result;
233     } process_get_name;
234
235     struct {
236       smx_process_t process;
237       int result;
238     } process_is_suspended;
239
240     struct {
241       smx_process_t process;
242       xbt_dict_t result;
243     } process_get_properties;
244
245     struct {
246       double duration;
247       e_smx_state_t result;
248     } process_sleep;
249
250     struct {
251       const char *name;
252       smx_rdv_t result;
253     } rdv_create;
254
255     struct {
256       smx_rdv_t rdv;
257     } rdv_destroy;
258
259     struct {
260       const char* name;
261       smx_rdv_t result;
262     } rdv_get_by_name;
263
264     struct {
265       smx_rdv_t rdv;
266       smx_host_t host;
267       unsigned int result; 
268     } rdv_comm_count_by_host;
269
270     struct {
271       smx_rdv_t rdv;
272       smx_action_t result;
273     } rdv_get_head;
274
275     struct {
276       smx_rdv_t rdv;
277       double task_size;
278       double rate;
279       void *src_buff;
280       size_t src_buff_size;
281       int (*match_fun)(void *, void *);
282       void *data;
283       smx_action_t result;
284     } comm_isend;
285
286     struct {
287       smx_rdv_t rdv;
288       void *dst_buff;
289       size_t *dst_buff_size;
290       int (*match_fun)(void *, void *);
291           void *data;
292       smx_action_t result;
293     } comm_irecv;
294
295     struct {
296       smx_action_t comm;
297     } comm_destroy;
298
299     struct {
300       smx_action_t comm;
301     } comm_cancel;
302
303     struct {
304       xbt_dynar_t comms;
305       unsigned int result;
306     } comm_waitany;
307
308     struct {
309       smx_action_t comm;
310       double timeout;
311     } comm_wait;
312
313     struct {
314       smx_action_t comm;
315       int result;
316     } comm_test;
317
318     struct {
319       xbt_dynar_t comms;
320       int result;
321     } comm_testany;
322
323     struct {
324       smx_action_t comm;
325       double result;
326     } comm_get_remains;
327
328     struct {
329       smx_action_t comm;
330       e_smx_state_t result;
331     } comm_get_state;
332
333     struct {
334       smx_action_t comm;
335       void *result;
336     } comm_get_src_data;
337
338     struct {
339       smx_action_t comm;
340       void *result;
341     } comm_get_dst_data;
342
343     struct {
344       smx_action_t comm;
345       void *result;
346     } comm_get_src_buff;
347
348     struct {
349       smx_action_t comm;
350       void *result;
351     } comm_get_dst_buff;
352
353     struct {
354       smx_action_t comm;
355       size_t result;
356     } comm_get_src_buff_size;
357
358     struct {
359       smx_action_t comm;
360       size_t result;
361     } comm_get_dst_buff_size;
362
363     struct {
364       smx_action_t comm;
365       smx_process_t result;
366     } comm_get_src_proc;
367
368     struct {
369       smx_action_t comm;
370       smx_process_t result;
371     } comm_get_dst_proc;
372
373 #ifdef HAVE_LATENCY_BOUND_TRACKING
374     struct {
375       smx_action_t comm;
376       int result;
377     } comm_is_latency_bounded;
378 #endif
379
380 #ifdef HAVE_TRACING
381     struct {
382       smx_action_t action;
383       const char *category;
384     } set_category;
385 #endif
386
387     struct {
388       smx_mutex_t result;
389     } mutex_init;
390
391     struct {
392       smx_mutex_t mutex;
393     } mutex_lock;
394
395     struct {
396       smx_mutex_t mutex;
397       int result;
398     } mutex_trylock;
399
400     struct {
401       smx_mutex_t mutex;
402     } mutex_unlock;
403
404     struct {
405       smx_mutex_t mutex;
406     } mutex_destroy;
407
408     struct {
409       smx_cond_t result;
410     } cond_init;
411
412     struct {
413       smx_cond_t cond;
414     } cond_destroy;
415
416     struct {
417       smx_cond_t cond;
418     } cond_signal;
419
420     struct {
421       smx_cond_t cond;
422       smx_mutex_t mutex;
423     } cond_wait;
424
425     struct {
426       smx_cond_t cond;
427       smx_mutex_t mutex;
428       double timeout;
429     } cond_wait_timeout;
430
431     struct {
432       smx_cond_t cond;
433     } cond_broadcast;
434
435     struct {
436       int capacity;
437       smx_sem_t result;
438     } sem_init;
439
440     struct {
441       smx_sem_t sem;
442     } sem_destroy;
443
444     struct {
445       smx_sem_t sem;
446     } sem_release;
447
448     struct {
449       smx_sem_t sem;
450       int result;
451     } sem_would_block;
452
453     struct {
454       smx_sem_t sem;
455     } sem_acquire;
456
457     struct {
458       smx_sem_t sem;
459       double timeout;
460     } sem_acquire_timeout;
461
462     struct {
463       smx_sem_t sem;
464       int result;
465     } sem_get_capacity;
466   };
467 } s_smx_req_t, *smx_req_t;
468
469 /******************************** General *************************************/
470
471 void SIMIX_request_init(void);
472 void SIMIX_request_destroy(void);
473 void SIMIX_request_push(smx_req_t);
474 smx_req_t SIMIX_request_pop(void);
475 void SIMIX_request_answer(smx_req_t);
476 void SIMIX_request_pre(smx_req_t);
477 void SIMIX_request_post(smx_action_t);
478 int SIMIX_request_is_visible(smx_req_t req);
479 int SIMIX_request_is_enabled(smx_req_t req);
480
481 #endif
482