Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Implement pthread_join in MC mode for sthread
[simgrid.git] / src / mc / ModelChecker.hpp
index ecb376e46a13c692cab1d6fbb54cbf573ab7b343..09fbfcbdf6e93a5e4bdce6714f0c3461edadbaa7 100644 (file)
@@ -15,8 +15,7 @@
 #include <memory>
 #include <set>
 
-namespace simgrid {
-namespace mc {
+namespace simgrid::mc {
 
 /** State of the model-checker (global variables for the model checker)
  */
@@ -29,10 +28,9 @@ class ModelChecker {
   std::unique_ptr<RemoteProcess> remote_process_;
   Exploration* exploration_ = nullptr;
 
-  unsigned long visited_states_ = 0;
+  FILE* dot_output_ = nullptr;
 
-  // Expect MessageType::SIMCALL_TO_STRING or MessageType::SIMCALL_DOT_LABEL
-  std::string simcall_to_string(MessageType type, aid_t aid, int times_considered);
+  unsigned long visited_states_ = 0;
 
 public:
   ModelChecker(ModelChecker const&) = delete;
@@ -67,13 +65,24 @@ public:
   unsigned long get_visited_states() const { return visited_states_; }
   void inc_visited_states() { visited_states_++; }
 
+  void dot_output(const char* fmt, ...) XBT_ATTRIB_PRINTF(2, 3);
+  void dot_output_flush()
+  {
+    if (dot_output_ != nullptr)
+      fflush(dot_output_);
+  }
+  void dot_output_close()
+  {
+    if (dot_output_ != nullptr)
+      fclose(dot_output_);
+  }
+
 private:
   void setup_ignore();
   bool handle_message(const char* buffer, ssize_t size);
   void handle_waitpid();
 };
 
-}
-}
+} // namespace simgrid::mc
 
 #endif