1 /* Copyright (c) 2007-2015. The SimGrid Team.
2 * All rights reserved. */
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. */
7 #ifndef SIMGRID_MC_PRIVATE_H
8 #define SIMGRID_MC_PRIVATE_H
10 #include "simgrid_config.h"
12 #include <sys/types.h>
19 #include <elfutils/libdw.h>
21 #include <simgrid/msg.h>
23 #include <xbt/config.h>
25 #include <xbt/automaton.h>
28 #include "mc/datatypes.h"
29 #include "src/mc/mc_base.h"
31 #include "src/simix/smx_private.h"
32 #include "src/xbt/mmalloc/mmprivate.h"
35 #include "src/mc/mc_forward.hpp"
36 #include "src/xbt/memory_map.hpp"
39 #include "src/mc/mc_protocol.h"
45 struct DerefAndCompareByNbProcessesAndUsedHeap {
46 template<class X, class Y>
47 bool operator()(X const& a, Y const& b)
49 return std::make_pair(a->nb_processes, a->heap_bytes_used) <
50 std::make_pair(b->nb_processes, b->heap_bytes_used);
60 /********************************* MC Global **********************************/
62 XBT_PRIVATE void MC_init_dot_output();
64 XBT_PRIVATE extern FILE *dot_output;
66 XBT_PRIVATE extern int user_max_depth_reached;
68 XBT_PRIVATE void MC_replay(xbt_fifo_t stack);
69 XBT_PRIVATE void MC_show_deadlock(void);
71 /** Stack (of `simgrid::mc::State*`) representing the current position of the
72 * the MC in the exploration graph
74 * It is managed by its head (`xbt_fifo_shift` and `xbt_fifo_unshift`).
76 XBT_PRIVATE extern xbt_fifo_t mc_stack;
78 /****************************** Statistics ************************************/
80 typedef struct mc_stats {
81 unsigned long state_size;
82 unsigned long visited_states;
83 unsigned long visited_pairs;
84 unsigned long expanded_states;
85 unsigned long expanded_pairs;
86 unsigned long executed_transitions;
87 } s_mc_stats_t, *mc_stats_t;
89 XBT_PRIVATE extern mc_stats_t mc_stats;
91 XBT_PRIVATE void MC_print_statistics(mc_stats_t stats);
93 /********************************** Snapshot comparison **********************************/
98 /********************************** Miscellaneous **********************************/
100 XBT_PRIVATE void MC_report_assertion_error(void);
101 XBT_PRIVATE void MC_report_crash(int status);
110 XBT_PRIVATE void find_object_address(
111 std::vector<simgrid::xbt::VmMap> const& maps, simgrid::mc::ObjectInformation* result);
114 int snapshot_compare(int num1, simgrid::mc::Snapshot* s1, int num2, simgrid::mc::Snapshot* s2);
116 // Move is somewhere else (in the LivenessChecker class, in the Session class?):
117 extern XBT_PRIVATE xbt_automaton_t property_automaton;