Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
copy_incomplete_comm_pattern() and copy_index_comm_pattern() moved from mc_api to...
[simgrid.git] / src / mc / mc_comm_pattern.hpp
1 /* Copyright (c) 2007-2020. 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 <vector>
10 #include "src/mc/mc_pattern.hpp"
11
12 namespace simgrid {
13 namespace mc {
14
15 enum class CallType {
16   NONE,
17   SEND,
18   RECV,
19   WAIT,
20   WAITANY,
21 };
22
23 enum class CommPatternDifference {
24   NONE,
25   TYPE,
26   RDV,
27   TAG,
28   SRC_PROC,
29   DST_PROC,
30   DATA_SIZE,
31   DATA,
32 };
33
34 struct PatternCommunicationList {
35   unsigned int index_comm = 0;
36   std::vector<std::unique_ptr<simgrid::mc::PatternCommunication>> list;
37 };
38 } // namespace mc
39 } // namespace simgrid
40
41 extern XBT_PRIVATE std::vector<simgrid::mc::PatternCommunicationList> initial_communications_pattern;
42 extern XBT_PRIVATE std::vector<std::vector<simgrid::mc::PatternCommunication*>> incomplete_communications_pattern;
43
44 static inline simgrid::mc::CallType MC_get_call_type(const s_smx_simcall* req)
45 {
46   using simgrid::mc::CallType;
47   using simgrid::simix::Simcall;
48   switch (req->call_) {
49     case Simcall::COMM_ISEND:
50       return CallType::SEND;
51     case Simcall::COMM_IRECV:
52       return CallType::RECV;
53     case Simcall::COMM_WAIT:
54       return CallType::WAIT;
55     case Simcall::COMM_WAITANY:
56       return CallType::WAITANY;
57     default:
58       return CallType::NONE;
59   }
60 }
61
62 #endif