namespace simgrid::mc {
/** @brief Save the current state */
-VisitedState::VisitedState(unsigned long state_number, unsigned int actor_count)
- : actor_count_(actor_count), num_(state_number)
+VisitedState::VisitedState(unsigned long state_number, unsigned int actor_count, std::size_t heap_bytes_used)
+ : heap_bytes_used_(heap_bytes_used), actor_count_(actor_count), num_(state_number)
{
- this->heap_bytes_used_ = mc_model_checker->get_remote_process().get_remote_heap_bytes();
this->system_state_ = std::make_shared<simgrid::mc::Snapshot>(state_number);
}
}
/** @brief Checks whether a given state has already been visited by the algorithm. */
-std::unique_ptr<simgrid::mc::VisitedState> VisitedStates::addVisitedState(unsigned long state_number,
- simgrid::mc::State* graph_state)
+std::unique_ptr<simgrid::mc::VisitedState>
+VisitedStates::addVisitedState(unsigned long state_number, simgrid::mc::State* graph_state, std::size_t heap_bytes_used)
{
- auto new_state = std::make_unique<simgrid::mc::VisitedState>(state_number, graph_state->get_actor_count());
+ auto new_state =
+ std::make_unique<simgrid::mc::VisitedState>(state_number, graph_state->get_actor_count(), heap_bytes_used);
+
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());
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, unsigned int actor_count);
+ explicit VisitedState(unsigned long state_number, unsigned int actor_count, std::size_t heap_bytes_used);
};
class XBT_PRIVATE VisitedStates {
std::vector<std::unique_ptr<simgrid::mc::VisitedState>> states_;
public:
void clear() { states_.clear(); }
- std::unique_ptr<simgrid::mc::VisitedState> addVisitedState(unsigned long state_number,
- simgrid::mc::State* graph_state);
+ std::unique_ptr<simgrid::mc::VisitedState>
+ addVisitedState(unsigned long state_number, simgrid::mc::State* graph_state, std::size_t heap_bytes_used);
private:
void prune();
/* Check whether we already explored next_state in the past (but only if interested in state-equality reduction) */
if (_sg_mc_max_visited_states > 0)
- visited_state_ = visited_states_.addVisitedState(next_state->get_num(), next_state.get());
+ visited_state_ = visited_states_.addVisitedState(next_state->get_num(), next_state.get(),
+ get_remote_app().get_remote_process().get_remote_heap_bytes());
/* If this is a new state (or if we don't care about state-equality reduction) */
if (visited_state_ == nullptr) {