X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4e2e0c7b210a6e58e5f73abd197c8accfd215a0d..50753d5f8442a47c17c4035724201a18a7ff6146:/src/mc/explo/Exploration.hpp diff --git a/src/mc/explo/Exploration.hpp b/src/mc/explo/Exploration.hpp index ee5471c596..aa6d420245 100644 --- a/src/mc/explo/Exploration.hpp +++ b/src/mc/explo/Exploration.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2022. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2016-2023. 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. */ @@ -29,19 +29,30 @@ namespace simgrid::mc { // abstract class Exploration : public xbt::Extendable { std::unique_ptr remote_app_; + static Exploration* instance_; + + FILE* dot_output_ = nullptr; public: - explicit Exploration(const std::vector& args); + explicit Exploration(const std::vector& args, bool need_memory_introspection); + virtual ~Exploration(); + static Exploration* get_instance() { return instance_; } // No copy: Exploration(Exploration const&) = delete; Exploration& operator=(Exploration const&) = delete; - virtual ~Exploration() = default; - /** Main function of this algorithm */ virtual void run() = 0; + /** Produce an error message indicating that the application crashed (status was produced by waitpid) */ + XBT_ATTRIB_NORETURN void report_crash(int status); + /** Produce an error message indicating that a property was violated */ + XBT_ATTRIB_NORETURN void report_assertion_failure(); + + /** Kill the application and the model-checker (which exits with `status`)*/ + XBT_ATTRIB_NORETURN void system_exit(int status) const; + /* These methods are callbacks called by the model-checking engine * to get and display information about the current state of the * model-checking algorithm: */ @@ -58,6 +69,9 @@ public: virtual void log_state(); RemoteApp& get_remote_app() { return *remote_app_.get(); } + + /** Print something to the dot output file*/ + void dot_output(const char* fmt, ...) XBT_ATTRIB_PRINTF(2, 3); }; // External constructors so that the types (and the types of their content) remain hidden @@ -66,18 +80,6 @@ XBT_PUBLIC Exploration* create_dfs_exploration(const std::vector& args, b XBT_PUBLIC Exploration* create_communication_determinism_checker(const std::vector& args, bool with_dpor); 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 simgrid::mc #endif