Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Access memory from another process
[simgrid.git] / src / mc / mc_comm_pattern.h
1 /* Copyright (c) 2007-2014. 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 #include <stdint.h>
8
9 #include <simgrid_config.h>
10 #include <xbt/dynar.h>
11
12 #include "../simix/smx_private.h"
13
14 #ifndef MC_COMM_PATTERN_H
15 #define MC_COMM_PATTERN_H
16
17 SG_BEGIN_DECL()
18
19 typedef struct s_mc_comm_pattern{
20   int num;
21   smx_synchro_t comm;
22   e_smx_comm_type_t type;
23   unsigned long src_proc;
24   unsigned long dst_proc;
25   const char *src_host;
26   const char *dst_host;
27   char *rdv;
28   ssize_t data_size;
29   void *data;
30 } s_mc_comm_pattern_t, *mc_comm_pattern_t;
31
32 extern xbt_dynar_t initial_communications_pattern;
33 extern xbt_dynar_t communications_pattern;
34 extern xbt_dynar_t incomplete_communications_pattern;
35
36 // Can we use the SIMIX syscall for this?
37 typedef enum mc_call_type {
38   MC_CALL_TYPE_NONE,
39   MC_CALL_TYPE_SEND,
40   MC_CALL_TYPE_RECV,
41   MC_CALL_TYPE_WAIT,
42   MC_CALL_TYPE_WAITANY,
43 } mc_call_type;
44
45 static inline mc_call_type mc_get_call_type(smx_simcall_t req)
46 {
47   switch(req->call) {
48   case SIMCALL_COMM_ISEND:
49     return MC_CALL_TYPE_SEND;
50   case SIMCALL_COMM_IRECV:
51     return MC_CALL_TYPE_RECV;
52   case SIMCALL_COMM_WAIT:
53     return MC_CALL_TYPE_WAIT;
54   case SIMCALL_COMM_WAITANY:
55     return MC_CALL_TYPE_WAITANY;
56   default:
57     return MC_CALL_TYPE_NONE;
58   }
59 }
60
61 void get_comm_pattern(xbt_dynar_t communications_pattern, smx_simcall_t request, mc_call_type call_type);
62 void mc_update_comm_pattern(mc_call_type call_type, smx_simcall_t request, int value, xbt_dynar_t current_pattern);
63 void complete_comm_pattern(xbt_dynar_t list, smx_synchro_t comm);
64 void MC_pre_modelcheck_comm_determinism(void);
65 void MC_modelcheck_comm_determinism(void);
66
67 SG_END_DECL()
68
69 #endif