X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/839aa39cec9e814fb9a6ccd5b3c3b870d25c7506..af6d6b158ab3c99f190cb670b1918bbadaa9e250:/src/mc/explo/Exploration.hpp diff --git a/src/mc/explo/Exploration.hpp b/src/mc/explo/Exploration.hpp index 0be71ab095..327818e461 100644 --- a/src/mc/explo/Exploration.hpp +++ b/src/mc/explo/Exploration.hpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2016-2022. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2016-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. */ @@ -7,10 +6,14 @@ #ifndef SIMGRID_MC_CHECKER_HPP #define SIMGRID_MC_CHECKER_HPP -#include "src/mc/api.hpp" +#include "simgrid/forward.h" +#include "src/mc/api/RemoteApp.hpp" +#include "src/mc/mc_record.hpp" +#include -namespace simgrid { -namespace mc { +#include + +namespace simgrid::mc { /** A model-checking exploration algorithm * @@ -21,15 +24,14 @@ namespace mc { * you might be able to write your model-checking algorithm as plain * imperative code instead. * - * It is expected to interact with the model-checking core through the - * `Session` interface (but currently the `Session` interface does not - * have all the necessary features). */ + * It is expected to interact with the model-checked application through the + * `RemoteApp` interface (that is currently not perfectly sufficient to that extend). */ // abstract class Exploration : public xbt::Extendable { - Session* session_; + std::unique_ptr remote_app_; public: - explicit Exploration(Session* session) : session_(session) {} + explicit Exploration(const std::vector& args); // No copy: Exploration(Exploration const&) = delete; @@ -53,18 +55,29 @@ public: virtual std::vector get_textual_trace() = 0; /** Log additional information about the state of the model-checker */ - virtual void log_state() = 0; + virtual void log_state(); - Session& get_session() { return *session_; } + RemoteApp& get_remote_app() { return *remote_app_.get(); } }; // External constructors so that the types (and the types of their content) remain hidden -XBT_PUBLIC Exploration* create_liveness_checker(Session* session); -XBT_PUBLIC Exploration* create_dfs_exploration(Session* session); -XBT_PUBLIC Exploration* create_communication_determinism_checker(Session* session); -XBT_PUBLIC Exploration* create_udpor_checker(Session* session); +XBT_PUBLIC Exploration* create_liveness_checker(const std::vector& args); +XBT_PUBLIC Exploration* create_dfs_exploration(const std::vector& args); +XBT_PUBLIC Exploration* create_communication_determinism_checker(const std::vector& args); +XBT_PUBLIC Exploration* create_udpor_checker(const std::vector& args); + +// FIXME: kill this template and use lambdas in boost::range_equal +struct DerefAndCompareByActorsCountAndUsedHeap { + template bool operator()(X const& a, Y const& b) const + { + return std::make_pair(a->actor_count_, a->heap_bytes_used) < std::make_pair(b->actor_count_, b->heap_bytes_used); + } +}; +static inline DerefAndCompareByActorsCountAndUsedHeap compare_pair_by_actor_count_and_used_heap() +{ + return DerefAndCompareByActorsCountAndUsedHeap(); +} -} // namespace mc -} // namespace simgrid +} // namespace simgrid::mc #endif