Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : communications determinism with visited state equality reduction
[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   int index;
31 } s_mc_comm_pattern_t, *mc_comm_pattern_t;
32
33 typedef struct s_mc_list_comm_pattern{
34   unsigned int index_comm;
35   xbt_dynar_t list;
36 }s_mc_list_comm_pattern_t, *mc_list_comm_pattern_t;
37
38 extern xbt_dynar_t initial_communications_pattern;
39 extern xbt_dynar_t incomplete_communications_pattern;
40
41 typedef enum {
42   MC_CALL_TYPE_NONE,
43   MC_CALL_TYPE_SEND,
44   MC_CALL_TYPE_RECV,
45   MC_CALL_TYPE_WAIT,
46   MC_CALL_TYPE_WAITANY,
47 } e_mc_call_type_t;
48
49 typedef enum {
50   NONE_DIFF,
51   TYPE_DIFF,
52   RDV_DIFF,
53   SRC_PROC_DIFF,
54   DST_PROC_DIFF,
55   DATA_SIZE_DIFF,
56   DATA_DIFF,
57 } e_mc_comm_pattern_difference_t;
58
59 static inline e_mc_call_type_t mc_get_call_type(smx_simcall_t req)
60 {
61   switch(req->call) {
62   case SIMCALL_COMM_ISEND:
63     return MC_CALL_TYPE_SEND;
64   case SIMCALL_COMM_IRECV:
65     return MC_CALL_TYPE_RECV;
66   case SIMCALL_COMM_WAIT:
67     return MC_CALL_TYPE_WAIT;
68   case SIMCALL_COMM_WAITANY:
69     return MC_CALL_TYPE_WAITANY;
70   default:
71     return MC_CALL_TYPE_NONE;
72   }
73 }
74
75 void get_comm_pattern(xbt_dynar_t communications_pattern, smx_simcall_t request, e_mc_call_type_t call_type);
76 void handle_comm_pattern(e_mc_call_type_t call_type, smx_simcall_t request, int value, xbt_dynar_t current_pattern, int backtracking);
77 void comm_pattern_free_voidp(void *p);
78 void list_comm_pattern_free_voidp(void *p);
79 void complete_comm_pattern(xbt_dynar_t list, smx_synchro_t comm, int backtracking);
80 void MC_pre_modelcheck_comm_determinism(void);
81 void MC_modelcheck_comm_determinism(void);
82
83 SG_END_DECL()
84
85 #endif