Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
[simgrid.git] / src / include / mc / mc.h
1 /* Copyright (c) 2008-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 _MC_MC_H
8 #define _MC_MC_H
9
10 #include <simgrid_config.h>
11 #include <xbt/base.h>
12 #include <xbt/misc.h>
13 #include <simgrid/simix.h>
14 #include <simgrid/modelchecker.h> /* our public interface (and definition of HAVE_MC) */
15
16 #ifdef _XBT_WIN32
17 #  include <xbt/win32_ucontext.h>     /* context relative declarations */
18 #else
19 #  include <ucontext.h>           /* context relative declarations */
20 #endif
21
22 /* Maximum size of the application heap.
23  *
24  * The model-checker heap is placed at this offset from the beginning of the application heap.
25  *
26  * In the current implementation, if the application uses more than this for the application heap the application heap
27  * will smash the beginning of the model-checker heap and bad things will happen.
28  *
29  * For 64 bits systems, we have a lot of virtual memory available so we wan use a much bigger value in order to avoid
30  * bad things from happening.
31  * */
32
33 #define STD_HEAP_SIZE   (sizeof(void*)<=4 ? (100*1024*1024) : (1ll*1024*1024*1024*1024))
34
35 SG_BEGIN_DECL()
36
37 /********************************** Configuration of MC **************************************/  
38 extern XBT_PUBLIC(int) _sg_do_model_check;
39 extern XBT_PRIVATE int _sg_do_model_check_record;
40 extern XBT_PRIVATE int _sg_mc_checkpoint;
41 extern XBT_PUBLIC(int) _sg_mc_sparse_checkpoint;
42 extern XBT_PUBLIC(int) _sg_mc_ksm;
43 extern XBT_PUBLIC(int) _sg_mc_soft_dirty;
44 extern XBT_PUBLIC(char*) _sg_mc_property_file;
45 extern XBT_PRIVATE int _sg_mc_timeout;
46 extern XBT_PRIVATE int _sg_mc_hash;
47 extern XBT_PRIVATE int _sg_mc_max_depth;
48 extern XBT_PUBLIC(int) _sg_mc_visited;
49 extern XBT_PRIVATE char* _sg_mc_dot_output_file;
50 extern XBT_PUBLIC(int) _sg_mc_comms_determinism;
51 extern XBT_PUBLIC(int) _sg_mc_send_determinism;
52 extern XBT_PRIVATE int _sg_mc_safety;
53 extern XBT_PRIVATE int _sg_mc_liveness;
54 extern XBT_PRIVATE int _sg_mc_snapshot_fds;
55 extern XBT_PRIVATE int _sg_mc_termination;
56
57 /********************************* Global *************************************/
58 XBT_PRIVATE void _mc_cfg_cb_reduce(const char *name, int pos);
59 XBT_PRIVATE void _mc_cfg_cb_checkpoint(const char *name, int pos);
60 XBT_PRIVATE void _mc_cfg_cb_sparse_checkpoint(const char *name, int pos);
61 XBT_PRIVATE void _mc_cfg_cb_ksm(const char *name, int pos);
62 XBT_PRIVATE void _mc_cfg_cb_soft_dirty(const char *name, int pos);
63 XBT_PRIVATE void _mc_cfg_cb_property(const char *name, int pos);
64 XBT_PRIVATE void _mc_cfg_cb_timeout(const char *name, int pos);
65 XBT_PRIVATE void _mc_cfg_cb_snapshot_fds(const char *name, int pos);
66 XBT_PRIVATE void _mc_cfg_cb_hash(const char *name, int pos);
67 XBT_PRIVATE void _mc_cfg_cb_max_depth(const char *name, int pos);
68 XBT_PRIVATE void _mc_cfg_cb_visited(const char *name, int pos);
69 XBT_PRIVATE void _mc_cfg_cb_dot_output(const char *name, int pos);
70 XBT_PRIVATE void _mc_cfg_cb_comms_determinism(const char *name, int pos);
71 XBT_PRIVATE void _mc_cfg_cb_send_determinism(const char *name, int pos);
72 XBT_PRIVATE void _mc_cfg_cb_termination(const char *name, int pos);
73
74 XBT_PUBLIC(void) MC_run(void);
75 XBT_PUBLIC(void) MC_init(void);
76 XBT_PUBLIC(void) MC_exit(void);
77 XBT_PUBLIC(void) MC_process_clock_add(smx_process_t, double);
78 XBT_PUBLIC(double) MC_process_clock_get(smx_process_t);
79 XBT_PRIVATE void MC_automaton_load(const char *file);
80
81 /****************************** MC ignore **********************************/
82 XBT_PUBLIC(void) MC_ignore_heap(void *address, size_t size);
83 XBT_PUBLIC(void) MC_remove_ignore_heap(void *address, size_t size);
84 XBT_PUBLIC(void) MC_ignore_local_variable(const char *var_name, const char *frame);
85 XBT_PUBLIC(void) MC_ignore_global_variable(const char *var_name);
86 XBT_PUBLIC(void) MC_register_stack_area(void *stack, smx_process_t process, ucontext_t* context, size_t size);
87
88 /********************************* Memory *************************************/
89 XBT_PUBLIC(void) MC_memory_init(void);  /* Initialize the memory subsystem */
90 XBT_PUBLIC(void) MC_memory_exit(void);
91 XBT_PUBLIC(void) MC_memory_init_server(void);
92
93 SG_END_DECL()
94
95 #endif                          /* _MC_MC_H */