Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : MUTEX_UNLOCK is invisible for MC
[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 #include "../smpi/private.h"
14 #include <smpi/smpi.h>
15
16 #ifndef MC_COMM_PATTERN_H
17 #define MC_COMM_PATTERN_H
18
19 SG_BEGIN_DECL()
20
21 typedef struct s_mc_comm_pattern{
22   int num;
23   smx_synchro_t comm;
24   e_smx_comm_type_t type;
25   unsigned long src_proc;
26   unsigned long dst_proc;
27   const char *src_host;
28   const char *dst_host;
29   char *rdv;
30   ssize_t data_size;
31   void *data;
32   int tag;
33   int index;
34 } s_mc_comm_pattern_t, *mc_comm_pattern_t;
35
36 typedef struct s_mc_list_comm_pattern{
37   unsigned int index_comm;
38   xbt_dynar_t list;
39 }s_mc_list_comm_pattern_t, *mc_list_comm_pattern_t;
40
41 extern xbt_dynar_t initial_communications_pattern;
42 extern xbt_dynar_t incomplete_communications_pattern;
43
44 typedef enum {
45   MC_CALL_TYPE_NONE,
46   MC_CALL_TYPE_SEND,
47   MC_CALL_TYPE_RECV,
48   MC_CALL_TYPE_WAIT,
49   MC_CALL_TYPE_WAITANY,
50 } e_mc_call_type_t;
51
52 typedef enum {
53   NONE_DIFF,
54   TYPE_DIFF,
55   RDV_DIFF,
56   TAG_DIFF,
57   SRC_PROC_DIFF,
58   DST_PROC_DIFF,
59   DATA_SIZE_DIFF,
60   DATA_DIFF,
61 } e_mc_comm_pattern_difference_t;
62
63 static inline e_mc_call_type_t mc_get_call_type(smx_simcall_t req)
64 {
65   switch(req->call) {
66   case SIMCALL_COMM_ISEND:
67     return MC_CALL_TYPE_SEND;
68   case SIMCALL_COMM_IRECV:
69     return MC_CALL_TYPE_RECV;
70   case SIMCALL_COMM_WAIT:
71     return MC_CALL_TYPE_WAIT;
72   case SIMCALL_COMM_WAITANY:
73     return MC_CALL_TYPE_WAITANY;
74   default:
75     return MC_CALL_TYPE_NONE;
76   }
77 }
78
79 void get_comm_pattern(xbt_dynar_t communications_pattern, smx_simcall_t request, e_mc_call_type_t call_type, int backtracking);
80 void handle_comm_pattern(e_mc_call_type_t call_type, smx_simcall_t request, int value, xbt_dynar_t current_pattern, int backtracking);
81 void comm_pattern_free_voidp(void *p);
82 void list_comm_pattern_free_voidp(void *p);
83 void complete_comm_pattern(xbt_dynar_t list, smx_synchro_t comm, unsigned int issuer, int backtracking);
84 void MC_pre_modelcheck_comm_determinism(void);
85 void MC_modelcheck_comm_determinism(void);
86
87 SG_END_DECL()
88
89 #endif