Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : new command line flag (model-check/timeout) to enable/disable timeout...
authorMarion Guthmuller <marion.guthmuller@loria.fr>
Thu, 8 Nov 2012 16:00:53 +0000 (17:00 +0100)
committerMarion Guthmuller <marion.guthmuller@loria.fr>
Thu, 8 Nov 2012 16:00:53 +0000 (17:00 +0100)
src/include/mc/mc.h
src/mc/mc_global.c
src/mc/mc_private.h
src/surf/surf_config.c
src/xbt/xbt_main.c

index b03df52..95b4aa7 100644 (file)
@@ -29,6 +29,7 @@ extern xbt_dynar_t stacks_areas;
 void _mc_cfg_cb_reduce(const char *name, int pos);
 void _mc_cfg_cb_checkpoint(const char *name, int pos);
 void _mc_cfg_cb_property(const char *name, int pos);
 void _mc_cfg_cb_reduce(const char *name, int pos);
 void _mc_cfg_cb_checkpoint(const char *name, int pos);
 void _mc_cfg_cb_property(const char *name, int pos);
+void _mc_cfg_cb_timeout(const char *name, int pos);
 
 XBT_PUBLIC(void) MC_do_the_modelcheck_for_real(void);
 
 
 XBT_PUBLIC(void) MC_do_the_modelcheck_for_real(void);
 
index e7a8de6..05d7108 100644 (file)
@@ -55,6 +55,14 @@ void _mc_cfg_cb_property(const char *name, int pos) {
   xbt_cfg_set_int(_surf_cfg_set,"model-check",1);
 }
 
   xbt_cfg_set_int(_surf_cfg_set,"model-check",1);
 }
 
+void _mc_cfg_cb_timeout(const char *name, int pos) {
+  if (_surf_init_status && !_surf_do_model_check) {
+    xbt_die("You are specifying a value to enable/disable timeout for wait requests after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry.");
+  }
+  _surf_mc_timeout= xbt_cfg_get_int(_surf_cfg_set, name);
+  xbt_cfg_set_int(_surf_cfg_set,"model-check",1);
+}
+
 
 /* MC global data structures */
 
 
 /* MC global data structures */
 
index c16fec2..dc8c0cf 100644 (file)
@@ -274,6 +274,7 @@ extern xbt_fifo_t mc_stack_safety;
 
 extern int _surf_mc_checkpoint;
 extern char* _surf_mc_property_file;
 
 extern int _surf_mc_checkpoint;
 extern char* _surf_mc_property_file;
+extern int _surf_mc_timeout;
 
 /****** Core dump ******/
 
 
 /****** Core dump ******/
 
index ebc30f7..196377d 100644 (file)
@@ -517,6 +517,13 @@ void surf_config_init(int *argc, char **argv)
                      "Specify the kind of exploration reduction (either none or DPOR)",
                      xbt_cfgelm_string, &default_value, 0, 1,
                      _mc_cfg_cb_reduce, NULL);
                      "Specify the kind of exploration reduction (either none or DPOR)",
                      xbt_cfgelm_string, &default_value, 0, 1,
                      _mc_cfg_cb_reduce, NULL);
+
+    /* Enable/disable timeout for wait requests with model-checking */
+    default_value_int = 1;
+    xbt_cfg_register(&_surf_cfg_set, "model-check/timeout",
+                     "Enable/Disable timeout for wait requests",
+                     xbt_cfgelm_int, &default_value, 0, 1,
+                     _mc_cfg_cb_timeout, NULL);
 #endif
 
     /* do verbose-exit */
 #endif
 
     /* do verbose-exit */
index 1dae308..a5b6605 100644 (file)
@@ -32,6 +32,7 @@ int xbt_initialized = 0;
 int _surf_do_model_check = 0;
 int _surf_mc_checkpoint=0;
 char* _surf_mc_property_file=NULL;
 int _surf_do_model_check = 0;
 int _surf_mc_checkpoint=0;
 char* _surf_mc_property_file=NULL;
+int _surf_mc_timeout=0;
 
 /* Declare xbt_preinit and xbt_postexit as constructor/destructor of the library.
  * This is crude and rather compiler-specific, unfortunately.
 
 /* Declare xbt_preinit and xbt_postexit as constructor/destructor of the library.
  * This is crude and rather compiler-specific, unfortunately.