From: Gabriel Corona Date: Thu, 9 Apr 2015 11:50:46 +0000 (+0200) Subject: [mc] Move comm determinism code in mc_comm_determinism.c X-Git-Tag: v3_12~732^2~66 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/40363ddc5d926c11f0ccc348c48ca155c33814ef [mc] Move comm determinism code in mc_comm_determinism.c --- diff --git a/src/mc/mc_comm_determinism.c b/src/mc/mc_comm_determinism.c index 1941949139..7854caedb3 100644 --- a/src/mc/mc_comm_determinism.c +++ b/src/mc/mc_comm_determinism.c @@ -11,6 +11,7 @@ #include "mc_private.h" #include "mc_record.h" #include "mc_smx.h" +#include "mc_client.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_comm_determinism, mc, "Logging specific to MC communication determinism detection"); @@ -272,7 +273,9 @@ void MC_complete_comm_pattern(xbt_dynar_t list, smx_synchro_t comm, unsigned int /************************ Main algorithm ************************/ -void MC_pre_modelcheck_comm_determinism(void) +static void MC_modelcheck_comm_determinism_main(void); + +static void MC_pre_modelcheck_comm_determinism(void) { MC_SET_MC_HEAP; @@ -319,7 +322,7 @@ void MC_pre_modelcheck_comm_determinism(void) } -void MC_modelcheck_comm_determinism(void) +static void MC_modelcheck_comm_determinism_main(void) { char *req_str = NULL; @@ -468,3 +471,36 @@ void MC_modelcheck_comm_determinism(void) return; } + +void MC_modelcheck_comm_determinism(void) +{ + MC_init(); + if (mc_mode == MC_MODE_CLIENT) { + // This will move somehwere else: + MC_client_handle_messages(); + } + + xbt_mheap_t heap = mmalloc_set_current_heap(mc_heap); + + /* Create exploration stack */ + mc_stack = xbt_fifo_new(); + + MC_SET_STD_HEAP; + + MC_pre_modelcheck_comm_determinism(); + + MC_SET_MC_HEAP; + initial_global_state = xbt_new0(s_mc_global_t, 1); + initial_global_state->snapshot = MC_take_snapshot(0); + initial_global_state->initial_communications_pattern_done = 0; + initial_global_state->recv_deterministic = 1; + initial_global_state->send_deterministic = 1; + initial_global_state->recv_diff = NULL; + initial_global_state->send_diff = NULL; + + MC_SET_STD_HEAP; + + MC_modelcheck_comm_determinism_main(); + + mmalloc_set_current_heap(heap); +} diff --git a/src/mc/mc_comm_pattern.h b/src/mc/mc_comm_pattern.h index a27ab20307..9c73038bb3 100644 --- a/src/mc/mc_comm_pattern.h +++ b/src/mc/mc_comm_pattern.h @@ -83,7 +83,6 @@ void MC_handle_comm_pattern(e_mc_call_type_t call_type, smx_simcall_t request, i void MC_comm_pattern_free_voidp(void *p); void MC_list_comm_pattern_free_voidp(void *p); void MC_complete_comm_pattern(xbt_dynar_t list, smx_synchro_t comm, unsigned int issuer, int backtracking); -void MC_pre_modelcheck_comm_determinism(void); void MC_modelcheck_comm_determinism(void); void MC_restore_communications_pattern(mc_state_t state); diff --git a/src/mc/mc_global.c b/src/mc/mc_global.c index 690ca5af4e..0901dae95f 100644 --- a/src/mc/mc_global.c +++ b/src/mc/mc_global.c @@ -211,39 +211,6 @@ void MC_init_pid(pid_t pid, int socket) /******************************* Core of MC *******************************/ /**************************************************************************/ -static void MC_modelcheck_comm_determinism_init(void) -{ - MC_init(); - if (mc_mode == MC_MODE_CLIENT) { - // This will move somehwere else: - MC_client_handle_messages(); - } - - xbt_mheap_t heap = mmalloc_set_current_heap(mc_heap); - - /* Create exploration stack */ - mc_stack = xbt_fifo_new(); - - MC_SET_STD_HEAP; - - MC_pre_modelcheck_comm_determinism(); - - MC_SET_MC_HEAP; - initial_global_state = xbt_new0(s_mc_global_t, 1); - initial_global_state->snapshot = MC_take_snapshot(0); - initial_global_state->initial_communications_pattern_done = 0; - initial_global_state->recv_deterministic = 1; - initial_global_state->send_deterministic = 1; - initial_global_state->recv_diff = NULL; - initial_global_state->send_diff = NULL; - - MC_SET_STD_HEAP; - - MC_modelcheck_comm_determinism(); - - mmalloc_set_current_heap(heap); -} - void MC_do_the_modelcheck_for_real() { MC_init_mode(); @@ -255,7 +222,7 @@ void MC_do_the_modelcheck_for_real() else { XBT_INFO("Check communication determinism"); mc_reduce_kind = e_mc_reduce_none; - MC_modelcheck_comm_determinism_init(); + MC_modelcheck_comm_determinism(); } }