Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
ab5a52f15f190b8e6356d7bf1471b33bfe7a1ad9
[simgrid.git] / src / simix / smx_global.cpp
1 /* Copyright (c) 2007-2021. 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 "mc/mc.h"
7 #include "simgrid/s4u/Engine.hpp"
8 #include "src/kernel/EngineImpl.hpp"
9
10 XBT_LOG_NEW_CATEGORY(simix, "All SIMIX categories");
11 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_kernel, simix, "Logging specific to SIMIX (kernel)");
12
13 namespace simgrid {
14 namespace simix {
15
16 xbt_dynar_t simix_global_get_actors_addr()
17 {
18 #if SIMGRID_HAVE_MC
19   return kernel::EngineImpl::get_instance()->get_actors_vector();
20 #else
21   xbt_die("This function is intended to be used when compiling with MC");
22 #endif
23 }
24 xbt_dynar_t simix_global_get_dead_actors_addr()
25 {
26 #if SIMGRID_HAVE_MC
27   return kernel::EngineImpl::get_instance()->get_dead_actors_vector();
28 #else
29   xbt_die("This function is intended to be used when compiling with MC");
30 #endif
31 }
32
33 } // namespace simix
34 } // namespace simgrid
35
36 /**
37  * @ingroup SIMIX_API
38  * @brief A clock (in second).
39  *
40  * @return Return the clock.
41  */
42 double SIMIX_get_clock() // XBT_ATTRIB_DEPRECATED_v332
43 {
44   return simgrid::s4u::Engine::get_clock();
45 }
46
47 void SIMIX_run() // XBT_ATTRIB_DEPRECATED_v332
48 {
49   simgrid::kernel::EngineImpl::get_instance()->run();
50 }
51
52 int SIMIX_is_maestro()
53 {
54   const simgrid::kernel::actor::ActorImpl* self = SIMIX_process_self();
55   return self == nullptr || simgrid::kernel::EngineImpl::get_instance()->is_maestro(self);
56 }