#include "mc/datatypes.h"
#include "simix/datatypes.h"
+#ifdef HAVE_MC
+extern int _surf_do_model_check;
+#define MC_IS_ENABLED _surf_do_model_check
+#else
+#define MC_IS_ENABLED 0
+#endif
+
SG_BEGIN_DECL()
/********************************* Global *************************************/
XBT_PUBLIC(void) MC_memory_init(void); /* Initialize the memory subsystem */
XBT_PUBLIC(void) MC_memory_exit(void);
-/*
- * Boolean indicating whether we want to activate the model-checker
- */
-extern int _surf_do_model_check;
-
-
SG_END_DECL()
+
#endif /* _MC_MC_H */
/************************* Assertion Checking *********************************/
void MC_assert(int prop)
{
- if (_surf_do_model_check && !prop) {
+ if (MC_IS_ENABLED && !prop) {
INFO0("**************************");
INFO0("*** PROPERTY NOT VALID ***");
INFO0("**************************");
fflush(stdout);
fflush(stderr);
-#ifdef HAVE_MC
- if (_surf_do_model_check){
+ if (MC_IS_ENABLED) {
MC_modelcheck();
- }else
-#endif
- {
+ }
+ else {
SIMIX_run();
}
return MSG_OK;
#include "smurf_private.h"
#include "synchro_private.h"
-extern int _surf_do_model_check;
-
/********************************** Simix Global ******************************/
typedef struct s_smx_context_factory *smx_context_factory_t;
#include "xbt/sysdep.h"
#include "xbt/log.h"
#include "xbt/dict.h"
+#include "mc/mc.h"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_host, simix,
"Logging specific to SIMIX (hosts)");
action->category = NULL;
#endif
-#ifdef HAVE_MC
/* set surf's action */
- if (!_surf_do_model_check)
-#endif
- {
- action->execution.surf_exec =
- surf_workstation_model->extension.workstation.execute(host->host,
- computation_amount);
- surf_workstation_model->action_data_set(action->execution.surf_exec, action);
+ if (!MC_IS_ENABLED) {
+ action->execution.surf_exec =
+ surf_workstation_model->extension.workstation.execute(host->host,
+ computation_amount);
+ surf_workstation_model->action_data_set(action->execution.surf_exec, action);
}
#ifdef HAVE_TRACING
for (i = 0; i < host_nb; i++)
workstation_list[i] = host_list[i]->host;
-#ifdef HAVE_MC
/* set surf's action */
- if (!_surf_do_model_check)
-#endif
- {
+ if (!MC_IS_ENABLED) {
action->execution.surf_exec =
surf_workstation_model->extension.workstation.
execute_parallel_task(host_nb, workstation_list, computation_amount,
communication_amount, amount, rate);
- surf_workstation_model->action_data_set(action->execution.surf_exec, action);
+ surf_workstation_model->action_data_set(action->execution.surf_exec, action);
}
DEBUG1("Create parallel execute action %p", action);
{
DEBUG1("Cancel action %p", action);
- if (action->execution.surf_exec)
+ if (action->execution.surf_exec)
surf_workstation_model->action_cancel(action->execution.surf_exec);
}
xbt_fifo_push(action->request_list, req);
req->issuer->waiting_action = action;
-#ifdef HAVE_MC
/* set surf's action */
- if (_surf_do_model_check){
+ if (MC_IS_ENABLED){
action->state = SIMIX_DONE;
SIMIX_execution_finish(action);
}
-#endif
/* If the action is already finished then perform the error handling */
if (action->state != SIMIX_RUNNING)
action->comm.src_buff = src_buff;
action->comm.src_buff_size = src_buff_size;
action->comm.data = data;
-#ifdef HAVE_MC
- if (_surf_do_model_check){
+
+ if (MC_IS_ENABLED) {
action->state = SIMIX_RUNNING;
return action;
}
-#endif
+
SIMIX_comm_start(action);
return action;
}
action->comm.dst_buff = dst_buff;
action->comm.dst_buff_size = dst_buff_size;
-#ifdef HAVE_MC
- if (_surf_do_model_check){
+ if (MC_IS_ENABLED) {
action->state = SIMIX_RUNNING;
return action;
}
-#endif
SIMIX_comm_start(action);
return action;
xbt_fifo_push(action->request_list, req);
req->issuer->waiting_action = action;
-#ifdef HAVE_MC
- if (_surf_do_model_check){
+ if (MC_IS_ENABLED){
action->state = SIMIX_DONE;
SIMIX_comm_finish(action);
}
-#endif
/* If the action has already finish perform the error handling, */
/* otherwise set up a waiting timeout on the right side */
#include "xbt/log.h"
#include "xbt/dict.h"
#include "msg/mailbox.h"
+#include "mc/mc.h"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_process, simix,
"Logging specific to SIMIX (process)");
void SIMIX_pre_process_sleep(smx_req_t req)
{
-#ifdef HAVE_MC
- if(_surf_do_model_check){
+ if (MC_IS_ENABLED) {
req->process_sleep.result = SIMIX_DONE;
SIMIX_request_answer(req);
}
-#endif
smx_action_t action = SIMIX_process_sleep(req->issuer, req->process_sleep.duration);
xbt_fifo_push(action->request_list, req);
req->issuer->waiting_action = action;
fflush(stdout);
fflush(stderr);
-#ifdef HAVE_MC
- if (_surf_do_model_check)
+ if (MC_IS_ENABLED)
MC_modelcheck();
else
-#endif
SIMIX_run();
if (xbt_cfg_get_int(_surf_cfg_set, "smpi/display_timing"))
history = tmgr_history_new();
surf_config_init(argc, argv);
-#ifdef HAVE_MC
- if (_surf_do_model_check)
+ if (MC_IS_ENABLED)
MC_memory_init();
-#endif
}
#ifdef _XBT_WIN32
#include "xbt/mallocator.h"
#include "xbt/asserts.h"
#include "xbt/sysdep.h"
+#include "mc/mc.h" /* kill mallocators when model-checking is enabled */
#include "mallocator_private.h"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_mallocator, xbt, "Mallocators");
-extern int _surf_do_model_check; /* kill mallocators when this is true */
/**
* \brief Constructor
* The mallocator will give standard memory when we are using raw memory (so these blocks are killed on restore)
* and the contrary (so these blocks will leak accross restores)
*/
- if (_surf_do_model_check)
+ if (MC_IS_ENABLED)
size = 0;
m = xbt_new0(s_xbt_mallocator_t, 1);
if (XBT_LOG_ISENABLED(xbt_mallocator, xbt_log_priority_verbose))
xbt_backtrace_display_current();
- m->objects = xbt_new0(void *, _surf_do_model_check ? 1 : size);
+ m->objects = xbt_new0(void *, MC_IS_ENABLED ? 1 : size);
m->max_size = size;
m->current_size = 0;
m->new_f = new_f;
xbt_os_sleep(sec);
}
-/* This horribly badly placed. I just need to get that symbol with that value into libgras so that the mallocators are happy.
- * EPR will save us all. One day.
- */
-int _surf_do_model_check = 0;