X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/08e7455d67920bbd7a87f440d00f2c1e071314a0..06a4291371a1f3425628a6715242dfab4cdb010c:/src/mc/Transition.hpp diff --git a/src/mc/Transition.hpp b/src/mc/Transition.hpp index 2527d8c7be..8bf38a96df 100644 --- a/src/mc/Transition.hpp +++ b/src/mc/Transition.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2021. The SimGrid Team. +/* Copyright (c) 2015-2022. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -7,6 +7,11 @@ #ifndef SIMGRID_MC_TRANSITION_HPP #define SIMGRID_MC_TRANSITION_HPP +#include "simgrid/forward.h" // aid_t +#include "src/kernel/actor/SimcallObserver.hpp" +#include "src/mc/remote/RemotePtr.hpp" +#include + namespace simgrid { namespace mc { @@ -19,8 +24,17 @@ namespace mc { * calls. */ class Transition { + /* Textual representation of the transition, to display backtraces */ + static unsigned long executed_transitions_; + static unsigned long replayed_transitions_; + + friend State; // FIXME remove this once we have a proper class to handle the statistics + +protected: + std::string textual_ = ""; + public: - int pid_ = 0; + aid_t aid_ = 0; /* Which transition was executed for this simcall * @@ -30,9 +44,73 @@ public: * * * random can produce different values. */ - int argument_ = 0; + int times_considered_ = 0; + + Transition() = default; + Transition(aid_t issuer, int times_considered) : aid_(issuer), times_considered_(times_considered) {} + + void init(aid_t aid, int times_considered); + + virtual std::string to_string(bool verbose = false); + const char* to_cstring(bool verbose = false); + + /* Moves the application toward a path that was already explored, but don't change the current transition */ + void replay() const; + + virtual bool depends(const Transition* other) const { return true; } + + /* Returns the total amount of transitions executed so far (for statistics) */ + static unsigned long get_executed_transitions() { return executed_transitions_; } + /* Returns the total amount of transitions replayed so far while backtracing (for statistics) */ + static unsigned long get_replayed_transitions() { return replayed_transitions_; } +}; + +class CommSendTransition; +class CommRecvTransition; + +class CommWaitTransition : public Transition { + double timeout_; + void* comm_; + aid_t sender_; + aid_t receiver_; + unsigned mbox_; + void* src_buff_; + void* dst_buff_; + size_t size_; + friend CommSendTransition; + friend CommRecvTransition; + +public: + CommWaitTransition(aid_t issuer, int times_considered, char* buffer); + std::string to_string(bool verbose) override; + bool depends(const Transition* other) const override; +}; + +class CommRecvTransition : public Transition { + unsigned mbox_; + void* dst_buff_; + +public: + CommRecvTransition(aid_t issuer, int times_considered, char* buffer); + std::string to_string(bool verbose) override; + bool depends(const Transition* other) const override; +}; + +class CommSendTransition : public Transition { + unsigned mbox_; + void* src_buff_; + size_t size_; + +public: + CommSendTransition(aid_t issuer, int times_considered, char* buffer); + std::string to_string(bool verbose) override; + bool depends(const Transition* other) const override; }; +/** Make a new transition from serialized description */ +Transition* recv_transition(aid_t issuer, int times_considered, kernel::actor::SimcallObserver::Simcall simcall, + char* buffer); + } // namespace mc } // namespace simgrid