Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
only 3 more functions to go in mc::api
[simgrid.git] / src / mc / api.cpp
1 /* Copyright (c) 2020-2022. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include "api.hpp"
7
8 #include "src/kernel/activity/MailboxImpl.hpp"
9 #include "src/kernel/activity/MutexImpl.hpp"
10 #include "src/kernel/actor/SimcallObserver.hpp"
11 #include "src/mc/api/RemoteApp.hpp"
12 #include "src/mc/explo/Exploration.hpp"
13 #include "src/mc/mc_base.hpp"
14 #include "src/mc/mc_exit.hpp"
15 #include "src/mc/mc_private.hpp"
16 #include "src/mc/remote/RemoteProcess.hpp"
17 #include "src/surf/HostImpl.hpp"
18
19 #include <xbt/asserts.h>
20 #include <xbt/log.h>
21 #include "simgrid/s4u/Host.hpp"
22 #include "xbt/string.hpp"
23 #if HAVE_SMPI
24 #include "src/smpi/include/smpi_request.hpp"
25 #endif
26
27 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(Api, mc, "Logging specific to MC Facade APIs ");
28 XBT_LOG_EXTERNAL_CATEGORY(mc_global);
29
30 namespace simgrid::mc {
31
32 std::size_t Api::get_remote_heap_bytes() const
33 {
34   RemoteProcess& process    = mc_model_checker->get_remote_process();
35   auto heap_bytes_used      = mmalloc_get_bytes_used_remote(process.get_heap()->heaplimit, process.get_malloc_info());
36   return heap_bytes_used;
37 }
38
39 bool Api::snapshot_equal(const Snapshot* s1, const Snapshot* s2) const
40 {
41   return simgrid::mc::snapshot_equal(s1, s2);
42 }
43
44 simgrid::mc::Snapshot* Api::take_snapshot(long num_state) const
45 {
46   auto snapshot = new simgrid::mc::Snapshot(num_state);
47   return snapshot;
48 }
49
50 } // namespace simgrid::mc