Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
9a47ed89bf4b8dc4d0723e156cdf71778ad6af82
[simgrid.git] / src / mc / api.hpp
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 #ifndef SIMGRID_MC_API_HPP
7 #define SIMGRID_MC_API_HPP
8
9 #include <memory>
10 #include <vector>
11
12 #include "simgrid/forward.h"
13 #include "src/mc/api/RemoteApp.hpp"
14 #include "src/mc/api/State.hpp"
15 #include "src/mc/mc_forward.hpp"
16 #include "src/mc/mc_record.hpp"
17 #include "xbt/automaton.hpp"
18 #include "xbt/base.h"
19
20 namespace simgrid::mc {
21
22 /*
23 ** This class aimes to implement FACADE APIs for simgrid. The FACADE layer sits between the CheckerSide
24 ** (Unfolding_Checker, DPOR, ...) layer and the
25 ** AppSide layer. The goal is to drill down into the entagled details in the CheckerSide layer and break down the
26 ** detailes in a way that the CheckerSide eventually
27 ** be capable to acquire the required information through the FACADE layer rather than the direct access to the AppSide.
28 */
29
30 class Api {
31 private:
32   Api() = default;
33
34   struct DerefAndCompareByActorsCountAndUsedHeap {
35     template <class X, class Y> bool operator()(X const& a, Y const& b) const
36     {
37       return std::make_pair(a->actor_count_, a->heap_bytes_used) < std::make_pair(b->actor_count_, b->heap_bytes_used);
38     }
39   };
40
41 public:
42   static Api& get()
43   {
44     static Api api;
45     return api;
46   }
47
48   // AUTOMATION APIs
49   inline DerefAndCompareByActorsCountAndUsedHeap compare_pair() const
50   {
51     return DerefAndCompareByActorsCountAndUsedHeap();
52   }
53 };
54
55 } // namespace simgrid::mc
56
57 #endif