Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] C++ style SimixProcessInformation
[simgrid.git] / src / mc / mc_smx.h
1 /* Copyright (c) 2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef SIMGRID_MC_SMX_H
8 #define SIMGRID_MC_SMX_H
9
10 #include <stddef.h>
11
12 #include <xbt/base.h>
13 #include <xbt/dynar.h>
14 #include <xbt/dynar.hpp>
15 #include <xbt/log.h>
16
17 #include <simgrid/simix.h>
18
19 #include "src/smpi/private.h"
20
21 #include "src/mc/Process.hpp"
22 #include "src/mc/mc_protocol.h"
23
24 /** @file
25  *  @brief (Cross-process, MCer/MCed) Access to SMX structures
26  *
27  *  We copy some C data structure from the MCed process in the MCer process.
28  *  This is implemented by:
29  *
30  *   - `model_checker->process.smx_process_infos`
31  *      (copy of `simix_global->process_list`);
32  *
33  *   - `model_checker->process.smx_old_process_infos`
34  *      (copy of `simix_global->process_to_destroy`);
35  *
36  *   - `model_checker->hostnames`.
37  *
38  * The process lists are currently refreshed each time MCed code is executed.
39  * We don't try to give a persistent MCer address for a given MCed process.
40  * For this reason, a MCer simgrid::mc::Process* is currently not reusable after
41  * MCed code.
42  */
43
44 SG_BEGIN_DECL()
45
46 typedef s_mc_smx_process_info s_mc_smx_process_info_t, *mc_smx_process_info_t;
47
48 XBT_PRIVATE xbt_dynar_t MC_smx_process_info_list_new(void);
49
50 XBT_PRIVATE void MC_process_smx_refresh(simgrid::mc::Process* process);
51
52 /** Get the issuer of  a simcall (`req->issuer`)
53  *
54  *  In split-process mode, it does the black magic necessary to get an address
55  *  of a (shallow) copy of the data structure the issuer SIMIX process in the local
56  *  address space.
57  *
58  *  @param process the MCed process
59  *  @param req     the simcall (copied in the local process)
60  */
61 XBT_PRIVATE smx_process_t MC_smx_simcall_get_issuer(smx_simcall_t req);
62
63 XBT_PRIVATE const char* MC_smx_process_get_name(smx_process_t p);
64 XBT_PRIVATE const char* MC_smx_process_get_host_name(smx_process_t p);
65
66 XBT_PRIVATE int MC_smpi_process_count(void);
67
68
69 /* ***** Resolve (local/MCer structure from remote/MCed addresses) ***** */
70
71 /** Get a local copy of the process from the process remote address */
72 XBT_PRIVATE smx_process_t MC_smx_resolve_process(smx_process_t process_remote_address);
73
74 /** Get the process info structure from the process remote address */
75 XBT_PRIVATE mc_smx_process_info_t MC_smx_resolve_process_info(smx_process_t process_remote_address);
76
77 XBT_PRIVATE unsigned long MC_smx_get_maxpid(void);
78
79 SG_END_DECL()
80
81 #endif