Logo AND Algorithmique Numérique Distribuée

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