Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move mc:api::get_remote_heap_bytes() to RemoteProcess
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 6 Aug 2022 23:05:56 +0000 (01:05 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 6 Aug 2022 23:05:56 +0000 (01:05 +0200)
src/mc/VisitedState.cpp
src/mc/api.cpp [deleted file]
src/mc/api.hpp
src/mc/explo/LivenessChecker.cpp
src/mc/remote/RemoteProcess.cpp
src/mc/remote/RemoteProcess.hpp
tools/cmake/DefinePackages.cmake

index 790d90a..7c81cc7 100644 (file)
@@ -20,7 +20,7 @@ namespace simgrid::mc {
 VisitedState::VisitedState(unsigned long state_number, unsigned int actor_count)
     : actor_count_(actor_count), num(state_number)
 {
-  this->heap_bytes_used = Api::get().get_remote_heap_bytes();
+  this->heap_bytes_used = mc_model_checker->get_remote_process().get_remote_heap_bytes();
   this->system_state = std::make_shared<simgrid::mc::Snapshot>(state_number);
 }
 
diff --git a/src/mc/api.cpp b/src/mc/api.cpp
deleted file mode 100644 (file)
index d866d44..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (c) 2020-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. */
-
-#include "api.hpp"
-
-#include "src/kernel/activity/MailboxImpl.hpp"
-#include "src/kernel/activity/MutexImpl.hpp"
-#include "src/kernel/actor/SimcallObserver.hpp"
-#include "src/mc/api/RemoteApp.hpp"
-#include "src/mc/explo/Exploration.hpp"
-#include "src/mc/mc_base.hpp"
-#include "src/mc/mc_exit.hpp"
-#include "src/mc/mc_private.hpp"
-#include "src/mc/remote/RemoteProcess.hpp"
-#include "src/surf/HostImpl.hpp"
-
-#include <xbt/asserts.h>
-#include <xbt/log.h>
-#include "simgrid/s4u/Host.hpp"
-#include "xbt/string.hpp"
-#if HAVE_SMPI
-#include "src/smpi/include/smpi_request.hpp"
-#endif
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(Api, mc, "Logging specific to MC Facade APIs ");
-XBT_LOG_EXTERNAL_CATEGORY(mc_global);
-
-namespace simgrid::mc {
-
-std::size_t Api::get_remote_heap_bytes() const
-{
-  RemoteProcess& process    = mc_model_checker->get_remote_process();
-  auto heap_bytes_used      = mmalloc_get_bytes_used_remote(process.get_heap()->heaplimit, process.get_malloc_info());
-  return heap_bytes_used;
-}
-} // namespace simgrid::mc
index b5422c2..9a47ed8 100644 (file)
@@ -19,8 +19,6 @@
 
 namespace simgrid::mc {
 
-XBT_DECLARE_ENUM_CLASS(ExplorationAlgorithm, Safety, UDPOR, Liveness, CommDeterminism);
-
 /*
 ** This class aimes to implement FACADE APIs for simgrid. The FACADE layer sits between the CheckerSide
 ** (Unfolding_Checker, DPOR, ...) layer and the
@@ -41,19 +39,12 @@ private:
   };
 
 public:
-  // No copy:
-  Api(Api const&) = delete;
-  void operator=(Api const&) = delete;
-
   static Api& get()
   {
     static Api api;
     return api;
   }
 
-  // REMOTE APIs
-  std::size_t get_remote_heap_bytes() const;
-
   // AUTOMATION APIs
   inline DerefAndCompareByActorsCountAndUsedHeap compare_pair() const
   {
index fac5334..8730db9 100644 (file)
@@ -25,7 +25,7 @@ VisitedPair::VisitedPair(int pair_num, xbt_automaton_state_t prop_state,
   this->app_state_ = std::move(app_state);
   if (not this->app_state_->get_system_state())
     this->app_state_->set_system_state(std::make_shared<Snapshot>(pair_num));
-  this->heap_bytes_used     = Api::get().get_remote_heap_bytes();
+  this->heap_bytes_used     = mc_model_checker->get_remote_process().get_remote_heap_bytes();
   this->actor_count_        = app_state_->get_actor_count();
   this->other_num           = -1;
   this->atomic_propositions = std::move(atomic_propositions);
index ac1e9b2..324e5ed 100644 (file)
@@ -167,6 +167,10 @@ void RemoteProcess::refresh_malloc_info()
   this->read_bytes(this->heap_info.data(), count * sizeof(malloc_info), remote(this->heap->heapinfo));
   this->cache_flags_ |= RemoteProcess::cache_malloc;
 }
+std::size_t RemoteProcess::get_remote_heap_bytes()
+{
+  return mmalloc_get_bytes_used_remote(get_heap()->heaplimit, get_malloc_info());
+}
 
 /** @brief Finds the range of the different memory segments and binary paths */
 void RemoteProcess::init_memory_map_info()
index b2c7558..c2244f3 100644 (file)
@@ -125,6 +125,8 @@ public:
       this->refresh_malloc_info();
     return this->heap_info.data();
   }
+  /* Get the amount of memory mallocated in the remote process (requires mmalloc) */
+  std::size_t get_remote_heap_bytes();
 
   void clear_cache() { this->cache_flags_ = RemoteProcess::cache_none; }
 
index f1b2fa5..28adc9a 100644 (file)
@@ -637,7 +637,6 @@ set(MC_SRC
   src/mc/ModelChecker.hpp
   src/mc/VisitedState.cpp
   src/mc/VisitedState.hpp
-  src/mc/api.cpp
   src/mc/api.hpp
   src/mc/api/ActorState.hpp
   src/mc/api/State.cpp