+++ /dev/null
-/* Copyright (c) 2014-2022. The SimGrid Team. All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#include <cinttypes>
-#include <cstdint>
-
-#include "xbt/log.h"
-
-#include "mc/datatypes.h"
-#include "src/mc/mc_hash.hpp"
-#include "src/mc/mc_private.hpp"
-#include "src/mc/sosp/Snapshot.hpp"
-#include <mc/mc.h>
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_hash, mc, "Logging specific to mc_hash");
-
-namespace simgrid::mc {
-
-namespace {
-
-class djb_hash {
- hash_type state_ = 5381LL;
-
-public:
- template<class T>
- void update(T& x)
- {
- state_ = (state_ << 5) + state_ + x;
- }
- hash_type value() const { return state_; }
-};
-
-}
-
-hash_type hash(Snapshot const& snapshot)
-{
- XBT_DEBUG("START hash %ld", snapshot.num_state_);
- djb_hash hash;
- // TODO:
- // * nb_processes
- // * heap_bytes_used
- // * root variables
- // * basic stack frame information
- // * stack frame local variables
- XBT_DEBUG("END hash %ld", snapshot.num_state_);
- return hash.value();
-}
-
-} // namespace simgrid::mc
+++ /dev/null
-/* Copyright (c) 2007-2022. The SimGrid Team. All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#ifndef SIMGRID_MC_HASH_HPP
-#define SIMGRID_MC_HASH_HPP
-
-#include "xbt/base.h"
-#include "src/mc/mc_forward.hpp"
-
-namespace simgrid::mc {
-
-using hash_type = std::uint64_t;
-
-XBT_PRIVATE hash_type hash(simgrid::mc::Snapshot const& snapshot);
-
-} // namespace simgrid::mc
-
-#endif
#include "src/mc/sosp/Snapshot.hpp"
#include "src/mc/mc_config.hpp"
-#include "src/mc/mc_hash.hpp"
#include <cstddef> /* std::size_t */
if (_sg_mc_max_visited_states > 0 || not _sg_mc_property_file.get().empty()) {
snapshot_stacks(process);
- hash_ = simgrid::mc::hash(*this);
+ hash_ = this->do_hash();
}
ignore_restore();
process->clear_cache();
}
+/* ----------- Hashing logic -------------- */
+class djb_hash {
+ hash_type state_ = 5381LL;
+
+public:
+ template <class T> void update(T& x) { state_ = (state_ << 5) + state_ + x; }
+ hash_type value() const { return state_; }
+};
+hash_type Snapshot::do_hash() const
+{
+ XBT_DEBUG("START hash %ld", num_state_);
+ djb_hash hash;
+ // TODO:
+ // * nb_processes
+ // * heap_bytes_used
+ // * root variables
+ // * basic stack frame information
+ // * stack frame local variables
+ XBT_DEBUG("END hash %ld", num_state_);
+ return hash.value();
+}
+
} // namespace simgrid::mc
/** Ignored data
*
- * Some parts of the snapshot are ignored by zeroing them out: the real
- * values is stored here.
- * */
+ * Some parts of the snapshot are ignored by zeroing them out: the real values is stored here.
+ */
struct s_mc_snapshot_ignored_data_t {
void* start;
std::vector<char> data;
namespace simgrid::mc {
+using hash_type = std::uint64_t;
+
class XBT_PRIVATE Snapshot final : public AddressSpace {
public:
/* Initialization */
void snapshot_stacks(RemoteProcess* process);
void handle_ignore();
void ignore_restore() const;
+ hash_type do_hash() const;
};
} // namespace simgrid::mc
src/mc/mc_client_api.cpp
src/mc/mc_exit.hpp
src/mc/mc_forward.hpp
- src/mc/mc_hash.cpp
- src/mc/mc_hash.hpp
src/mc/mc_private.hpp
src/mc/mc_record.cpp
src/mc/mc_safety.hpp