Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : DPOR (independant transitions) algorithm for liveness properties
[simgrid.git] / src / mc / private.h
index 359560e..fc931b6 100644 (file)
@@ -18,6 +18,8 @@
 #include "xbt/function_types.h"
 #include "xbt/mmalloc.h"
 #include "../simix/private.h"
+#include "xbt/automaton.h"
+#include "xbt/hash.h"
 
 /****************************** Snapshots ***********************************/
 
@@ -37,6 +39,7 @@ void MC_restore_snapshot(mc_snapshot_t);
 void MC_free_snapshot(mc_snapshot_t);
 
 /********************************* MC Global **********************************/
+extern double *mc_time;
 
 /* Bound of the MC depth-first search algorithm */
 #define MAX_DEPTH 1000
@@ -51,7 +54,7 @@ void MC_dump_stack(xbt_fifo_t stack);
 
 /********************************* Requests ***********************************/
 int MC_request_depend(smx_req_t req1, smx_req_t req2);
-char* MC_request_to_string(smx_req_t req);
+char* MC_request_to_string(smx_req_t req, int value);
 unsigned int MC_request_testany_fail(smx_req_t req);
 /*int MC_waitany_is_enabled_by_comm(smx_req_t req, unsigned int comm);*/
 int MC_request_is_visible(smx_req_t req);
@@ -110,9 +113,18 @@ typedef struct mc_stats {
   unsigned long executed_transitions;
 } s_mc_stats_t, *mc_stats_t;
 
+typedef struct mc_stats_pair {
+  //unsigned long pair_size;
+  unsigned long visited_pairs;
+  unsigned long expanded_pairs;
+  unsigned long executed_transitions;
+} s_mc_stats_pair_t, *mc_stats_pair_t;
+
 extern mc_stats_t mc_stats;
+extern mc_stats_pair_t mc_stats_pair;
 
 void MC_print_statistics(mc_stats_t);
+void MC_print_statistics_pairs(mc_stats_pair_t);
 
 /********************************** MEMORY ******************************/
 /* The possible memory modes for the modelchecker are standard and raw. */
@@ -121,7 +133,7 @@ void MC_print_statistics(mc_stats_t);
 
 extern void *std_heap;
 extern void *raw_heap;
-int raw_heap_fd;
+/* extern int raw_heap_fd; */ /* unused */
 #define STD_HEAP_SIZE   20480000        /* Maximum size of the system's heap */
 
 /* FIXME: Horrible hack! because the mmalloc library doesn't provide yet of */
@@ -168,4 +180,61 @@ typedef struct s_memory_map {
 memory_map_t get_memory_map(void);
 
 
+/********************************** DFS for liveness property**************************************/
+
+typedef struct s_mc_pair{
+  mc_snapshot_t system_state;
+  mc_state_t graph_state;
+  xbt_state_t automaton_state;
+  int num;
+}s_mc_pair_t, *mc_pair_t;
+
+extern xbt_fifo_t mc_snapshot_stack;
+
+int MC_automaton_evaluate_label(xbt_automaton_t a, xbt_exp_label_t l);
+mc_pair_t new_pair(mc_snapshot_t sn, mc_state_t sg, xbt_state_t st);
+
+int reached(mc_pair_t p);
+void set_pair_reached(mc_pair_t p);
+void MC_show_snapshot_stack(xbt_fifo_t stack);
+void MC_dump_snapshot_stack(xbt_fifo_t stack);
+void MC_pair_delete(mc_pair_t pair);
+void MC_exit_with_automaton(void);
+mc_state_t MC_state_pair_new(void);
+
+/* **** Double-DFS without visited state **** */
+
+void MC_ddfs_with_restore_snapshot_init(xbt_automaton_t a);
+void MC_ddfs_with_restore_snapshot(xbt_automaton_t a, int search_cycle, int restore);
+
+/* **** Double-DFS with visited state **** */
+
+typedef struct s_mc_visited_pair{
+  mc_pair_t pair;
+  int search_cycle;
+}s_mc_visited_pair_t, *mc_visited_pair_t;
+
+void MC_vddfs_with_restore_snapshot_init(xbt_automaton_t a);
+void MC_vddfs_with_restore_snapshot(xbt_automaton_t automaton, int search_cycle, int restore);
+void set_pair_visited(mc_pair_t p, int search_cycle);
+int visited(mc_pair_t p, int search_cycle);
+
+
+/* **** DPOR Cristian with restore snapshot **** */
+
+typedef struct s_mc_state_with_snapshot{
+  mc_snapshot_t system_state;
+  mc_state_t graph_state;
+}s_mc_state_ws_t, *mc_state_ws_t;
+
+mc_state_ws_t new_state_ws(mc_snapshot_t s, mc_state_t gs);
+void MC_dpor_with_restore_snapshot_init(void);
+void MC_dpor_with_restore_snapshot(void);
+
+/* **** DPOR 2 (invisible and independant transitions) **** */
+
+
+void MC_dpor2_init(xbt_automaton_t a);
+void MC_dpor2(xbt_automaton_t a, int search_cycle);
+
 #endif