Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
useless cosmetics around NS3 long routes
[simgrid.git] / src / mc / mc_comm_pattern.h
1 /* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef SIMGRID_MC_COMM_PATTERN_H
7 #define SIMGRID_MC_COMM_PATTERN_H
8
9 #include <cstddef>
10
11 #include <vector>
12
13 #include <simgrid_config.h>
14 #include <xbt/dynar.h>
15
16 #include "src/simix/smx_private.h"
17 #include "src/smpi/private.h"
18 #include <smpi/smpi.h>
19
20 #include "src/mc/mc_state.h"
21
22 namespace simgrid {
23 namespace mc {
24
25 struct PatternCommunicationList {
26   unsigned int index_comm = 0;
27   std::vector<std::unique_ptr<simgrid::mc::PatternCommunication>> list;
28 };
29
30 }
31 }
32
33 SG_BEGIN_DECL()
34
35 /**
36  *  Type: `xbt_dynar_t<mc_list_comm_pattern_t>`
37  */
38 extern XBT_PRIVATE xbt_dynar_t initial_communications_pattern;
39
40 /**
41  *  Type: `xbt_dynar_t<xbt_dynar_t<simgrid::mc::PatternCommunication*>>`
42  */
43 extern XBT_PRIVATE xbt_dynar_t incomplete_communications_pattern;
44
45 typedef enum {
46   MC_CALL_TYPE_NONE,
47   MC_CALL_TYPE_SEND,
48   MC_CALL_TYPE_RECV,
49   MC_CALL_TYPE_WAIT,
50   MC_CALL_TYPE_WAITANY,
51 } e_mc_call_type_t;
52
53 typedef enum {
54   NONE_DIFF,
55   TYPE_DIFF,
56   RDV_DIFF,
57   TAG_DIFF,
58   SRC_PROC_DIFF,
59   DST_PROC_DIFF,
60   DATA_SIZE_DIFF,
61   DATA_DIFF,
62 } e_mc_comm_pattern_difference_t;
63
64 static inline e_mc_call_type_t MC_get_call_type(smx_simcall_t req)
65 {
66   switch(req->call) {
67   case SIMCALL_COMM_ISEND:
68     return MC_CALL_TYPE_SEND;
69   case SIMCALL_COMM_IRECV:
70     return MC_CALL_TYPE_RECV;
71   case SIMCALL_COMM_WAIT:
72     return MC_CALL_TYPE_WAIT;
73   case SIMCALL_COMM_WAITANY:
74     return MC_CALL_TYPE_WAITANY;
75   default:
76     return MC_CALL_TYPE_NONE;
77   }
78 }
79
80 XBT_PRIVATE void MC_handle_comm_pattern(e_mc_call_type_t call_type, smx_simcall_t request, int value, xbt_dynar_t current_pattern, int backtracking);
81
82 XBT_PRIVATE void MC_restore_communications_pattern(simgrid::mc::State* state);
83
84 XBT_PRIVATE void MC_state_copy_incomplete_communications_pattern(simgrid::mc::State* state);
85 XBT_PRIVATE void MC_state_copy_index_communications_pattern(simgrid::mc::State* state);
86
87 SG_END_DECL()
88
89 #endif