1 /* Copyright (c) 2007-2021. The SimGrid Team. All rights reserved. */
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. */
6 #ifndef SIMGRID_MC_PATTERN_H
7 #define SIMGRID_MC_PATTERN_H
9 #include "src/kernel/activity/CommImpl.hpp"
14 enum class PatternCommunicationType {
20 class PatternCommunication {
23 RemotePtr<simgrid::kernel::activity::CommImpl> comm_addr{nullptr};
24 PatternCommunicationType type = PatternCommunicationType::send;
25 unsigned long src_proc = 0;
26 unsigned long dst_proc = 0;
27 const xbt::string* src_host = nullptr;
28 const xbt::string* dst_host = nullptr;
30 std::vector<char> data;
34 PatternCommunication dup() const
36 simgrid::mc::PatternCommunication res;
38 res.comm_addr = this->comm_addr;
39 res.type = this->type;
42 res.dst_proc = this->dst_proc;
43 res.dst_host = this->dst_host;
45 res.data = this->data;
47 res.index = this->index;
52 /* On every state, each actor has an entry of the following type.
53 * This represents both the actor and its transition because
54 * an actor cannot have more than one enabled transition at a given time.
57 /* Possible exploration status of an actor transition in a state.
58 * Either the checker did not consider the transition, or it was considered and still to do, or considered and done.
60 enum class InterleavingType {
61 /** This actor transition is not considered by the checker (yet?) */
63 /** The checker algorithm decided that this actor transitions should be done at some point */
65 /** The checker algorithm decided that this should be done, but it was done in the meanwhile */
69 /** Exploration control information */
70 InterleavingType state = InterleavingType::disabled;
73 /** Number of times that the process was considered to be executed */
74 // TODO, make this private
75 unsigned int times_considered = 0;
77 bool is_disabled() const { return this->state == InterleavingType::disabled; }
78 bool is_done() const { return this->state == InterleavingType::done; }
79 bool is_todo() const { return this->state == InterleavingType::todo; }
80 /** Mark that we should try executing this process at some point in the future of the checker algorithm */
83 this->state = InterleavingType::todo;
84 this->times_considered = 0;
86 void set_done() { this->state = InterleavingType::done; }
90 } // namespace simgrid