From 3bb8fa4450ae1fcb7bbad80b92f907e831469711 Mon Sep 17 00:00:00 2001 From: Marion Guthmuller Date: Thu, 8 Nov 2012 17:00:53 +0100 Subject: [PATCH] model-checker : new command line flag (model-check/timeout) to enable/disable timeout for wait requests with model-checking --- src/include/mc/mc.h | 1 + src/mc/mc_global.c | 8 ++++++++ src/mc/mc_private.h | 1 + src/surf/surf_config.c | 7 +++++++ src/xbt/xbt_main.c | 1 + 5 files changed, 18 insertions(+) diff --git a/src/include/mc/mc.h b/src/include/mc/mc.h index b03df527c1..95b4aa7651 100644 --- a/src/include/mc/mc.h +++ b/src/include/mc/mc.h @@ -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_timeout(const char *name, int pos); XBT_PUBLIC(void) MC_do_the_modelcheck_for_real(void); diff --git a/src/mc/mc_global.c b/src/mc/mc_global.c index e7a8de6b3f..05d71089aa 100644 --- a/src/mc/mc_global.c +++ b/src/mc/mc_global.c @@ -55,6 +55,14 @@ void _mc_cfg_cb_property(const char *name, int pos) { 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 */ diff --git a/src/mc/mc_private.h b/src/mc/mc_private.h index c16fec2ac9..dc8c0cf2be 100644 --- a/src/mc/mc_private.h +++ b/src/mc/mc_private.h @@ -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_timeout; /****** Core dump ******/ diff --git a/src/surf/surf_config.c b/src/surf/surf_config.c index ebc30f74f9..196377d952 100644 --- a/src/surf/surf_config.c +++ b/src/surf/surf_config.c @@ -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); + + /* 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 */ diff --git a/src/xbt/xbt_main.c b/src/xbt/xbt_main.c index 1dae308773..a5b66056de 100644 --- a/src/xbt/xbt_main.c +++ b/src/xbt/xbt_main.c @@ -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_mc_timeout=0; /* Declare xbt_preinit and xbt_postexit as constructor/destructor of the library. * This is crude and rather compiler-specific, unfortunately. -- 2.20.1