namespace simgrid::mc {
/** @brief Save the current state */
-VisitedState::VisitedState(unsigned long state_number) : num(state_number)
+VisitedState::VisitedState(unsigned long state_number, unsigned int actor_count)
+ : actor_count_(actor_count), num(state_number)
{
this->heap_bytes_used = Api::get().get_remote_heap_bytes();
- this->actors_count = mc_model_checker->get_remote_process().actors().size();
this->system_state = std::make_shared<simgrid::mc::Snapshot>(state_number);
}
std::unique_ptr<simgrid::mc::VisitedState>
VisitedStates::addVisitedState(unsigned long state_number, simgrid::mc::State* graph_state, bool compare_snapshots)
{
- auto new_state = std::make_unique<simgrid::mc::VisitedState>(state_number);
+ auto new_state = std::make_unique<simgrid::mc::VisitedState>(state_number, graph_state->get_actor_count());
graph_state->set_system_state(new_state->system_state);
XBT_DEBUG("Snapshot %p of visited state %ld (exploration stack state %ld)", new_state->system_state.get(),
new_state->num, graph_state->get_num());
public:
std::shared_ptr<simgrid::mc::Snapshot> system_state = nullptr;
std::size_t heap_bytes_used = 0;
- int actors_count = 0;
- long num = 0; // unique id of that state in the storage of all stored IDs
+ int actor_count_;
+ long num; // unique id of that state in the storage of all stored IDs
long original_num = -1; // num field of the VisitedState to which I was declared equal to (used for dot_output)
- explicit VisitedState(unsigned long state_number);
+ explicit VisitedState(unsigned long state_number, unsigned int actor_count);
};
class XBT_PRIVATE VisitedStates {
struct DerefAndCompareByActorsCountAndUsedHeap {
template <class X, class Y> bool operator()(X const& a, Y const& b) const
{
- return std::make_pair(a->actors_count, a->heap_bytes_used) < std::make_pair(b->actors_count, b->heap_bytes_used);
+ return std::make_pair(a->actor_count_, a->heap_bytes_used) < std::make_pair(b->actor_count_, b->heap_bytes_used);
}
};
}
XBT_VERB("(%ld - %ld) Same hash: 0x%" PRIx64, s1->num_state_, s2->num_state_, s1->hash_);
- /* Compare enabled processes */
- if (s1->enabled_processes_ != s2->enabled_processes_) {
- XBT_VERB("(%ld - %ld) Different amount of enabled processes", s1->num_state_, s2->num_state_);
- return false;
- }
+ /* TODO: re-enable the quick filter of counting enabled processes in each snapshots */
/* Compare size of stacks */
for (unsigned long i = 0; i < s1->stacks_.size(); i++) {
int next = state->next_transition();
if (next < 0) { // If there is no more transition in the current state, backtrack.
- XBT_DEBUG("There remains %zu actors, but none to interleave (depth %zu).",
- mc_model_checker->get_remote_process().actors().size(), stack_.size() + 1);
+ XBT_DEBUG("There remains %d actors, but none to interleave (depth %zu).", state->get_actor_count(),
+ stack_.size() + 1);
- if (mc_model_checker->get_remote_process().actors().empty()) {
+ if (state->get_actor_count() == 0) {
mc_model_checker->finalize_app();
XBT_VERB("Execution came to an end at %s (state: %ld, depth: %zu)", get_record_trace().to_string().c_str(),
state->get_num(), stack_.size());
if (not this->graph_state->get_system_state())
this->graph_state->set_system_state(std::make_shared<Snapshot>(pair_num));
this->heap_bytes_used = Api::get().get_remote_heap_bytes();
- this->actors_count = mc_model_checker->get_remote_process().actors().size();
+ this->actor_count_ = mc_model_checker->get_remote_process().actors().size();
this->other_num = -1;
this->atomic_propositions = std::move(atomic_propositions);
}
xbt_automaton_state_t automaton_state;
std::shared_ptr<const std::vector<int>> atomic_propositions;
std::size_t heap_bytes_used = 0;
- int actors_count = 0;
+ int actor_count_;
VisitedPair(int pair_num, xbt_automaton_state_t automaton_state,
std::shared_ptr<const std::vector<int>> atomic_propositions, std::shared_ptr<State> graph_state);
{
XBT_DEBUG("Taking snapshot %ld", num_state);
- for (auto const& p : process->actors())
- enabled_processes_.insert(p.copy.get_buffer()->get_pid());
-
snapshot_handle_ignore(this);
/* Save the std heap and the writable mapped pages of libsimgrid and binary */
long num_state_;
std::size_t heap_bytes_used_ = 0;
std::vector<std::unique_ptr<Region>> snapshot_regions_;
- std::set<pid_t> enabled_processes_;
std::vector<std::size_t> stack_sizes_;
std::vector<s_mc_snapshot_stack_t> stacks_;
std::vector<simgrid::mc::IgnoredHeapRegion> to_ignore_;