X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d20f024dba9ff1e9c8822237caaf963b9e913889..54b931da542487537ab6ec3c4c8f5a9ec06822a7:/src/mc/mc_record.hpp diff --git a/src/mc/mc_record.hpp b/src/mc/mc_record.hpp index af9948263f..d8cf3a346f 100644 --- a/src/mc/mc_record.hpp +++ b/src/mc/mc_record.hpp @@ -1,14 +1,13 @@ -/* Copyright (c) 2014-2017. The SimGrid Team. All rights reserved. */ +/* 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. */ /** \file mc_record.hpp * - * This file contains the MC replay/record functionnality. - * A MC path may be recorded by using ``-cfg=model-check/record:1`'`. - * The path is written in the log output and an be replayed with MC disabled - * (even with an non-LC build) with `--cfg=model-check/replay:$replayPath`. + * This file contains the MC replay/record functionality. + * The recorded path is written in the log output and can be replayed with MC disabled + * (even with a non-MC build) using `--cfg=model-check/replay:$replayPath`. * * The same version of Simgrid should be used and the same arguments should be * passed to the application (without the MC specific arguments). @@ -17,34 +16,34 @@ #ifndef SIMGRID_MC_RECORD_HPP #define SIMGRID_MC_RECORD_HPP -#include "src/mc/Transition.hpp" +#include "src/mc/mc_forward.hpp" #include "xbt/base.h" +#include #include -namespace simgrid { -namespace mc { +namespace simgrid::mc { -typedef std::vector RecordTrace; +class RecordTrace { + std::vector transitions_; -/** Convert a string representation of the path into a array of `simgrid::mc::Transition` - */ -XBT_PRIVATE RecordTrace parseRecordTrace(const char* data); -XBT_PRIVATE std::string traceToString(simgrid::mc::RecordTrace const& trace); -XBT_PRIVATE void dumpRecordPath(); +public: + RecordTrace() = default; -XBT_PRIVATE void replay(RecordTrace const& trace); -XBT_PRIVATE void replay(const char* trace); -} -} + /** Build a trace that can be replayed from a string representation */ + explicit RecordTrace(const char* data); + /** Make a string representation that can later be used to create a new trace */ + std::string to_string() const; -/** Whether the MC record mode is enabled - * - * The behaviour is not changed. The only real difference is that - * the path is writtent in the log when an interesting path is found. - */ -#define MC_record_is_active() _sg_do_model_check_record + void push_back(Transition* t) { transitions_.push_back(t); } + + /** Replay all transitions of a trace */ + void replay() const; + + /** Parse and replay a string representation */ + static void replay(const std::string& trace); +}; -// **** Data conversion +} // namespace simgrid::mc #endif