1 /* Copyright (c) 2007-2022. 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"
10 #include "src/mc/remote/RemotePtr.hpp"
15 enum class PatternCommunicationType {
21 class PatternCommunication {
24 RemotePtr<simgrid::kernel::activity::CommImpl> comm_addr{nullptr};
25 PatternCommunicationType type = PatternCommunicationType::send;
26 unsigned long src_proc = 0;
27 unsigned long dst_proc = 0;
29 std::vector<char> data;
33 PatternCommunication dup() const
35 simgrid::mc::PatternCommunication res;
37 res.comm_addr = this->comm_addr;
38 res.type = this->type;
41 res.dst_proc = this->dst_proc;
43 res.data = this->data;
45 res.index = this->index;
50 /* On every state, each actor has an entry of the following type.
51 * This represents both the actor and its transition because
52 * an actor cannot have more than one enabled transition at a given time.
55 /* Possible exploration status of an actor transition in a state.
56 * Either the checker did not consider the transition, or it was considered and still to do, or considered and done.
58 enum class InterleavingType {
59 /** This actor transition is not considered by the checker (yet?) */
61 /** The checker algorithm decided that this actor transitions should be done at some point */
63 /** The checker algorithm decided that this should be done, but it was done in the meanwhile */
67 /** Exploration control information */
68 InterleavingType state_ = InterleavingType::disabled;
70 /** Number of times that the process was considered to be executed */
71 unsigned int times_considered_ = 0;
74 unsigned int get_times_considered() const { return times_considered_; }
75 unsigned int get_times_considered_and_inc() { return times_considered_++; }
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