1 /* Copyright (c) 2008-2014. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
14 #include "simgrid/sg_config.h"
15 #include "../surf/surf_private.h"
16 #include "../simix/smx_private.h"
17 #include "../xbt/mmalloc/mmprivate.h"
19 #include "mc_private.h"
20 #include "xbt/automaton.h"
23 XBT_LOG_NEW_CATEGORY(mc, "All MC categories");
24 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_global, mc,
25 "Logging specific to MC (global)");
27 /* Configuration support */
28 e_mc_reduce_t mc_reduce_kind = e_mc_reduce_unset;
30 int _sg_do_model_check = 0;
31 int _sg_mc_checkpoint = 0;
32 char *_sg_mc_property_file = NULL;
33 int _sg_mc_timeout = 0;
35 int _sg_mc_max_depth = 1000;
36 int _sg_mc_visited = 0;
37 char *_sg_mc_dot_output_file = NULL;
38 int _sg_mc_comms_determinism = 0;
39 int _sg_mc_send_determinism = 0;
40 int _sg_mc_safety = 0;
41 int _sg_mc_liveness = 0;
43 int user_max_depth_reached = 0;
45 void _mc_cfg_cb_reduce(const char *name, int pos)
47 if (_sg_cfg_init_status && !_sg_do_model_check) {
49 ("You are specifying a reduction strategy 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.");
51 char *val = xbt_cfg_get_string(_sg_cfg_set, name);
52 if (!strcasecmp(val, "none")) {
53 mc_reduce_kind = e_mc_reduce_none;
54 } else if (!strcasecmp(val, "dpor")) {
55 mc_reduce_kind = e_mc_reduce_dpor;
57 xbt_die("configuration option %s can only take 'none' or 'dpor' as a value",
62 void _mc_cfg_cb_checkpoint(const char *name, int pos)
64 if (_sg_cfg_init_status && !_sg_do_model_check) {
66 ("You are specifying a checkpointing value 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.");
68 _sg_mc_checkpoint = xbt_cfg_get_int(_sg_cfg_set, name);
71 void _mc_cfg_cb_property(const char *name, int pos)
73 if (_sg_cfg_init_status && !_sg_do_model_check) {
75 ("You are specifying a property 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.");
77 _sg_mc_property_file = xbt_cfg_get_string(_sg_cfg_set, name);
80 void _mc_cfg_cb_timeout(const char *name, int pos)
82 if (_sg_cfg_init_status && !_sg_do_model_check) {
84 ("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.");
86 _sg_mc_timeout = xbt_cfg_get_boolean(_sg_cfg_set, name);
89 void _mc_cfg_cb_hash(const char *name, int pos)
91 if (_sg_cfg_init_status && !_sg_do_model_check) {
93 ("You are specifying a value to enable/disable the use of global hash to speedup state comparaison, but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry.");
95 _sg_mc_hash = xbt_cfg_get_boolean(_sg_cfg_set, name);
98 void _mc_cfg_cb_max_depth(const char *name, int pos)
100 if (_sg_cfg_init_status && !_sg_do_model_check) {
102 ("You are specifying a max depth value 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.");
104 _sg_mc_max_depth = xbt_cfg_get_int(_sg_cfg_set, name);
107 void _mc_cfg_cb_visited(const char *name, int pos)
109 if (_sg_cfg_init_status && !_sg_do_model_check) {
111 ("You are specifying a number of stored visited states 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.");
113 _sg_mc_visited = xbt_cfg_get_int(_sg_cfg_set, name);
116 void _mc_cfg_cb_dot_output(const char *name, int pos)
118 if (_sg_cfg_init_status && !_sg_do_model_check) {
120 ("You are specifying a file name for a dot output of graph state 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.");
122 _sg_mc_dot_output_file = xbt_cfg_get_string(_sg_cfg_set, name);
125 void _mc_cfg_cb_comms_determinism(const char *name, int pos)
127 if (_sg_cfg_init_status && !_sg_do_model_check) {
129 ("You are specifying a value to enable/disable the detection of determinism in the communications schemes 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.");
131 _sg_mc_comms_determinism = xbt_cfg_get_boolean(_sg_cfg_set, name);
134 void _mc_cfg_cb_send_determinism(const char *name, int pos)
136 if (_sg_cfg_init_status && !_sg_do_model_check) {
138 ("You are specifying a value to enable/disable the detection of send-determinism in the communications schemes 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.");
140 _sg_mc_send_determinism = xbt_cfg_get_boolean(_sg_cfg_set, name);
143 /* MC global data structures */
144 mc_state_t mc_current_state = NULL;
145 char mc_replay_mode = FALSE;
146 double *mc_time = NULL;
147 __thread mc_comparison_times_t mc_comp_times = NULL;
148 __thread double mc_snapshot_comparison_time;
149 mc_stats_t mc_stats = NULL;
150 mc_global_t initial_global_state = NULL;
151 xbt_fifo_t mc_stack = NULL;
154 xbt_automaton_t _mc_property_automaton = NULL;
157 mc_object_info_t mc_libsimgrid_info = NULL;
158 mc_object_info_t mc_binary_info = NULL;
160 mc_object_info_t mc_object_infos[2] = { NULL, NULL };
162 size_t mc_object_infos_size = 2;
165 FILE *dot_output = NULL;
166 const char *colors[13];
169 /******************************* Initialisation of MC *******************************/
170 /*********************************************************************************/
172 static void MC_init_dot_output()
173 { /* FIXME : more colors */
177 colors[2] = "green3";
178 colors[3] = "goldenrod";
180 colors[5] = "purple";
181 colors[6] = "magenta";
182 colors[7] = "turquoise4";
183 colors[8] = "gray25";
184 colors[9] = "forestgreen";
185 colors[10] = "hotpink";
186 colors[11] = "lightblue";
189 dot_output = fopen(_sg_mc_dot_output_file, "w");
191 if (dot_output == NULL) {
192 perror("Error open dot output file");
197 "digraph graphname{\n fixedsize=true; rankdir=TB; ranksep=.25; edge [fontsize=12]; node [fontsize=10, shape=circle,width=.5 ]; graph [resolution=20, fontsize=10];\n");
201 static void MC_init_debug_info(void)
203 XBT_INFO("Get debug information ...");
205 memory_map_t maps = MC_get_memory_map();
207 /* Get local variables for state equality detection */
208 mc_binary_info = MC_find_object_info(maps, xbt_binary_name, 1);
209 mc_object_infos[0] = mc_binary_info;
211 mc_libsimgrid_info = MC_find_object_info(maps, libsimgrid_path, 0);
212 mc_object_infos[1] = mc_libsimgrid_info;
214 // Use information of the other objects:
215 MC_post_process_object_info(mc_binary_info);
216 MC_post_process_object_info(mc_libsimgrid_info);
218 MC_free_memory_map(maps);
219 XBT_INFO("Get debug information done !");
226 int raw_mem_set = (mmalloc_get_current_heap() == mc_heap);
228 mc_time = xbt_new0(double, simix_process_maxpid);
230 /* Initialize the data structures that must be persistent across every
231 iteration of the model-checker (in RAW memory) */
235 mc_comp_times = xbt_new0(s_mc_comparison_times_t, 1);
237 /* Initialize statistics */
238 mc_stats = xbt_new0(s_mc_stats_t, 1);
239 mc_stats->state_size = 1;
241 MC_init_memory_map_info();
242 MC_init_debug_info(); /* FIXME : get debug information only if liveness verification or visited state reduction */
244 if ((_sg_mc_dot_output_file != NULL) && (_sg_mc_dot_output_file[0] != '\0'))
245 MC_init_dot_output();
248 //parmap = xbt_parmap_mc_new(xbt_os_get_numcores(), XBT_PARMAP_DEFAULT);
252 if (_sg_mc_visited > 0 || _sg_mc_liveness) {
253 /* Ignore some variables from xbt/ex.h used by exception e for stacks comparison */
254 MC_ignore_local_variable("e", "*");
255 MC_ignore_local_variable("__ex_cleanup", "*");
256 MC_ignore_local_variable("__ex_mctx_en", "*");
257 MC_ignore_local_variable("__ex_mctx_me", "*");
258 MC_ignore_local_variable("__xbt_ex_ctx_ptr", "*");
259 MC_ignore_local_variable("_log_ev", "*");
260 MC_ignore_local_variable("_throw_ctx", "*");
261 MC_ignore_local_variable("ctx", "*");
263 MC_ignore_local_variable("self", "simcall_BODY_mc_snapshot");
264 MC_ignore_local_variable("next_context", "smx_ctx_sysv_suspend_serial");
265 MC_ignore_local_variable("i", "smx_ctx_sysv_suspend_serial");
267 /* Ignore local variable about time used for tracing */
268 MC_ignore_local_variable("start_time", "*");
270 MC_ignore_global_variable("compared_pointers");
271 MC_ignore_global_variable("mc_comp_times");
272 MC_ignore_global_variable("mc_snapshot_comparison_time");
273 MC_ignore_global_variable("mc_time");
274 MC_ignore_global_variable("smpi_current_rank");
275 MC_ignore_global_variable("counter"); /* Static variable used for tracing */
276 MC_ignore_global_variable("maestro_stack_start");
277 MC_ignore_global_variable("maestro_stack_end");
278 MC_ignore_global_variable("smx_total_comms");
280 MC_ignore_heap(mc_time, simix_process_maxpid * sizeof(double));
282 smx_process_t process;
283 xbt_swag_foreach(process, simix_global->process_list) {
284 MC_ignore_heap(&(process->process_hookup),
285 sizeof(process->process_hookup));
294 /******************************* Core of MC *******************************/
295 /**************************************************************************/
297 static void MC_modelcheck_comm_determinism_init(void)
300 int mc_mem_set = (mmalloc_get_current_heap() == mc_heap);
307 /* Create exploration stack */
308 mc_stack = xbt_fifo_new();
312 MC_pre_modelcheck_comm_determinism();
315 initial_global_state = xbt_new0(s_mc_global_t, 1);
316 initial_global_state->snapshot = MC_take_snapshot(0);
317 initial_global_state->initial_communications_pattern_done = 0;
318 initial_global_state->comm_deterministic = 1;
319 initial_global_state->send_deterministic = 1;
322 MC_modelcheck_comm_determinism();
329 static void MC_modelcheck_safety_init(void)
331 int mc_mem_set = (mmalloc_get_current_heap() == mc_heap);
340 /* Create exploration stack */
341 mc_stack = xbt_fifo_new();
345 MC_pre_modelcheck_safety();
348 /* Save the initial state */
349 initial_global_state = xbt_new0(s_mc_global_t, 1);
350 initial_global_state->snapshot = MC_take_snapshot(0);
353 MC_modelcheck_safety();
362 static void MC_modelcheck_liveness_init()
365 int mc_mem_set = (mmalloc_get_current_heap() == mc_heap);
374 /* Create exploration stack */
375 mc_stack = xbt_fifo_new();
377 /* Create the initial state */
378 initial_global_state = xbt_new0(s_mc_global_t, 1);
382 MC_pre_modelcheck_liveness();
385 MC_print_statistics(mc_stats);
393 void MC_do_the_modelcheck_for_real()
396 if (_sg_mc_comms_determinism || _sg_mc_send_determinism) {
397 XBT_INFO("Check communication determinism");
398 MC_modelcheck_comm_determinism_init();
399 } else if (!_sg_mc_property_file || _sg_mc_property_file[0] == '\0') {
400 if (mc_reduce_kind == e_mc_reduce_unset)
401 mc_reduce_kind = e_mc_reduce_dpor;
402 XBT_INFO("Check a safety property");
403 MC_modelcheck_safety_init();
405 if (mc_reduce_kind == e_mc_reduce_unset)
406 mc_reduce_kind = e_mc_reduce_none;
407 XBT_INFO("Check the liveness property %s", _sg_mc_property_file);
408 MC_automaton_load(_sg_mc_property_file);
409 MC_modelcheck_liveness_init();
422 int SIMIX_pre_mc_random(smx_simcall_t simcall, int min, int max)
425 return simcall->mc_value;
429 int MC_random(int min, int max)
431 /*FIXME: return mc_current_state->executed_transition->random.value; */
432 return simcall_mc_random(min, max);
436 * \brief Schedules all the process that are ready to run
438 void MC_wait_for_requests(void)
440 smx_process_t process;
444 while (!xbt_dynar_is_empty(simix_global->process_to_run)) {
445 SIMIX_process_runall();
446 xbt_dynar_foreach(simix_global->process_that_ran, iter, process) {
447 req = &process->simcall;
448 if (req->call != SIMCALL_NONE && !MC_request_is_visible(req))
449 SIMIX_simcall_pre(req, 0);
454 int MC_deadlock_check()
456 int deadlock = FALSE;
457 smx_process_t process;
458 if (xbt_swag_size(simix_global->process_list)) {
460 xbt_swag_foreach(process, simix_global->process_list) {
461 if (process->simcall.call != SIMCALL_NONE
462 && MC_request_is_enabled(&process->simcall)) {
472 * \brief Re-executes from the state at position start all the transitions indicated by
473 * a given model-checker stack.
474 * \param stack The stack with the transitions to execute.
475 * \param start Start index to begin the re-execution.
477 void MC_replay(xbt_fifo_t stack, int start)
479 int raw_mem = (mmalloc_get_current_heap() == mc_heap);
481 int value, i = 1, count = 1;
483 smx_simcall_t req = NULL, saved_req = NULL;
484 xbt_fifo_item_t item, start_item;
486 smx_process_t process = NULL;
487 int comm_pattern = 0;
488 smx_action_t current_comm;
490 XBT_DEBUG("**** Begin Replay ****");
493 /* Restore the initial state */
494 MC_restore_snapshot(initial_global_state->snapshot);
495 /* At the moment of taking the snapshot the raw heap was set, so restoring
496 * it will set it back again, we have to unset it to continue */
500 start_item = xbt_fifo_get_last_item(stack);
503 start_item = xbt_fifo_get_prev_item(start_item);
510 if ((mc_reduce_kind == e_mc_reduce_dpor) && !_sg_mc_comms_determinism && !_sg_mc_send_determinism) {
511 xbt_dict_reset(first_enabled_state);
512 xbt_swag_foreach(process, simix_global->process_list) {
513 if (MC_process_is_enabled(process)) {
514 char *key = bprintf("%lu", process->pid);
515 char *data = bprintf("%d", count);
516 xbt_dict_set(first_enabled_state, key, data, NULL);
522 if (_sg_mc_comms_determinism || _sg_mc_send_determinism) {
523 xbt_dynar_reset(communications_pattern);
524 xbt_dynar_reset(incomplete_communications_pattern);
530 /* Traverse the stack from the state at position start and re-execute the transitions */
531 for (item = start_item;
532 item != xbt_fifo_get_first_item(stack);
533 item = xbt_fifo_get_prev_item(item)) {
535 state = (mc_state_t) xbt_fifo_get_item_content(item);
536 saved_req = MC_state_get_executed_request(state, &value);
538 if ((mc_reduce_kind == e_mc_reduce_dpor) && !_sg_mc_comms_determinism && !_sg_mc_send_determinism) {
540 char *key = bprintf("%lu", saved_req->issuer->pid);
541 xbt_dict_remove(first_enabled_state, key);
547 /* because we got a copy of the executed request, we have to fetch the
548 real one, pointed by the request field of the issuer process */
549 req = &saved_req->issuer->simcall;
551 /* Debug information */
552 if (XBT_LOG_ISENABLED(mc_global, xbt_log_priority_debug)) {
553 req_str = MC_request_to_string(req, value);
554 XBT_DEBUG("Replay: %s (%p)", req_str, state);
558 /* TODO : handle test and testany simcalls */
559 if (_sg_mc_comms_determinism || _sg_mc_send_determinism) {
560 if (req->call == SIMCALL_COMM_ISEND)
562 else if (req->call == SIMCALL_COMM_IRECV)
564 else if (req->call == SIMCALL_COMM_WAIT)
566 else if (req->call == SIMCALL_COMM_WAITANY)
570 SIMIX_simcall_pre(req, value);
572 if (_sg_mc_comms_determinism || _sg_mc_send_determinism) {
574 if (comm_pattern == 1 || comm_pattern == 2) {
575 get_comm_pattern(communications_pattern, req, comm_pattern);
576 } else if (comm_pattern == 3 /* || comm_pattern == 4 */ ) {
577 current_comm = simcall_comm_wait__get__comm(req);
578 if (current_comm->comm.refcount == 1) { /* First wait only must be considered */
579 complete_comm_pattern(communications_pattern, current_comm);
581 } else if (comm_pattern == 4 /* || comm_pattern == 4 */ ) {
583 xbt_dynar_get_as(simcall_comm_waitany__get__comms(req), value,
585 if (current_comm->comm.refcount == 1) { /* First wait only must be considered */
586 complete_comm_pattern(communications_pattern, current_comm);
594 MC_wait_for_requests();
598 if ((mc_reduce_kind == e_mc_reduce_dpor) && !_sg_mc_comms_determinism && !_sg_mc_send_determinism) {
600 /* Insert in dict all enabled processes */
601 xbt_swag_foreach(process, simix_global->process_list) {
602 if (MC_process_is_enabled(process) ) {
603 char *key = bprintf("%lu", process->pid);
604 if (xbt_dict_get_or_null(first_enabled_state, key) == NULL) {
605 char *data = bprintf("%d", count);
606 xbt_dict_set(first_enabled_state, key, data, NULL);
615 /* Update statistics */
616 mc_stats->visited_states++;
617 mc_stats->executed_transitions++;
621 XBT_DEBUG("**** End Replay ****");
631 void MC_replay_liveness(xbt_fifo_t stack, int all_stack)
634 initial_global_state->raw_mem_set = (mmalloc_get_current_heap() == mc_heap);
638 smx_simcall_t req = NULL, saved_req = NULL;
639 xbt_fifo_item_t item;
644 XBT_DEBUG("**** Begin Replay ****");
646 /* Restore the initial state */
647 MC_restore_snapshot(initial_global_state->snapshot);
649 /* At the moment of taking the snapshot the raw heap was set, so restoring
650 * it will set it back again, we have to unset it to continue */
651 if (!initial_global_state->raw_mem_set)
656 item = xbt_fifo_get_last_item(stack);
658 while (depth <= xbt_fifo_size(stack)) {
660 pair = (mc_pair_t) xbt_fifo_get_item_content(item);
661 state = (mc_state_t) pair->graph_state;
663 if (pair->requests > 0) {
665 saved_req = MC_state_get_executed_request(state, &value);
666 //XBT_DEBUG("SavedReq->call %u", saved_req->call);
668 if (saved_req != NULL) {
669 /* because we got a copy of the executed request, we have to fetch the
670 real one, pointed by the request field of the issuer process */
671 req = &saved_req->issuer->simcall;
672 //XBT_DEBUG("Req->call %u", req->call);
674 /* Debug information */
675 if (XBT_LOG_ISENABLED(mc_global, xbt_log_priority_debug)) {
676 req_str = MC_request_to_string(req, value);
677 XBT_DEBUG("Replay (depth = %d) : %s (%p)", depth, req_str, state);
683 SIMIX_simcall_pre(req, value);
684 MC_wait_for_requests();
689 /* Update statistics */
690 mc_stats->visited_pairs++;
691 mc_stats->executed_transitions++;
693 item = xbt_fifo_get_prev_item(item);
698 /* Traverse the stack from the initial state and re-execute the transitions */
699 for (item = xbt_fifo_get_last_item(stack);
700 item != xbt_fifo_get_first_item(stack);
701 item = xbt_fifo_get_prev_item(item)) {
703 pair = (mc_pair_t) xbt_fifo_get_item_content(item);
704 state = (mc_state_t) pair->graph_state;
706 if (pair->requests > 0) {
708 saved_req = MC_state_get_executed_request(state, &value);
709 //XBT_DEBUG("SavedReq->call %u", saved_req->call);
711 if (saved_req != NULL) {
712 /* because we got a copy of the executed request, we have to fetch the
713 real one, pointed by the request field of the issuer process */
714 req = &saved_req->issuer->simcall;
715 //XBT_DEBUG("Req->call %u", req->call);
717 /* Debug information */
718 if (XBT_LOG_ISENABLED(mc_global, xbt_log_priority_debug)) {
719 req_str = MC_request_to_string(req, value);
720 XBT_DEBUG("Replay (depth = %d) : %s (%p)", depth, req_str, state);
726 SIMIX_simcall_pre(req, value);
727 MC_wait_for_requests();
732 /* Update statistics */
733 mc_stats->visited_pairs++;
734 mc_stats->executed_transitions++;
738 XBT_DEBUG("**** End Replay ****");
740 if (initial_global_state->raw_mem_set)
748 * \brief Dumps the contents of a model-checker's stack and shows the actual
750 * \param stack The stack to dump
752 void MC_dump_stack_safety(xbt_fifo_t stack)
755 int raw_mem_set = (mmalloc_get_current_heap() == mc_heap);
757 MC_show_stack_safety(stack);
759 if (!_sg_mc_checkpoint) {
764 while ((state = (mc_state_t) xbt_fifo_pop(stack)) != NULL)
765 MC_state_delete(state);
778 void MC_show_stack_safety(xbt_fifo_t stack)
781 int raw_mem_set = (mmalloc_get_current_heap() == mc_heap);
787 xbt_fifo_item_t item;
789 char *req_str = NULL;
791 for (item = xbt_fifo_get_last_item(stack);
792 (item ? (state = (mc_state_t) (xbt_fifo_get_item_content(item)))
793 : (NULL)); item = xbt_fifo_get_prev_item(item)) {
794 req = MC_state_get_executed_request(state, &value);
796 req_str = MC_request_to_string(req, value);
797 XBT_INFO("%s", req_str);
806 void MC_show_deadlock(smx_simcall_t req)
808 /*char *req_str = NULL; */
809 XBT_INFO("**************************");
810 XBT_INFO("*** DEAD-LOCK DETECTED ***");
811 XBT_INFO("**************************");
812 XBT_INFO("Locked request:");
813 /*req_str = MC_request_to_string(req);
814 XBT_INFO("%s", req_str);
815 xbt_free(req_str); */
816 XBT_INFO("Counter-example execution trace:");
817 MC_dump_stack_safety(mc_stack);
818 MC_print_statistics(mc_stats);
822 void MC_show_stack_liveness(xbt_fifo_t stack)
826 xbt_fifo_item_t item;
828 char *req_str = NULL;
830 for (item = xbt_fifo_get_last_item(stack);
831 (item ? (pair = (mc_pair_t) (xbt_fifo_get_item_content(item)))
832 : (NULL)); item = xbt_fifo_get_prev_item(item)) {
833 req = MC_state_get_executed_request(pair->graph_state, &value);
835 if (pair->requests > 0) {
836 req_str = MC_request_to_string(req, value);
837 XBT_INFO("%s", req_str);
840 XBT_INFO("End of system requests but evolution in Büchi automaton");
846 void MC_dump_stack_liveness(xbt_fifo_t stack)
849 int raw_mem_set = (mmalloc_get_current_heap() == mc_heap);
854 while ((pair = (mc_pair_t) xbt_fifo_pop(stack)) != NULL)
855 MC_pair_delete(pair);
864 void MC_print_statistics(mc_stats_t stats)
866 if (stats->expanded_pairs == 0) {
867 XBT_INFO("Expanded states = %lu", stats->expanded_states);
868 XBT_INFO("Visited states = %lu", stats->visited_states);
870 XBT_INFO("Expanded pairs = %lu", stats->expanded_pairs);
871 XBT_INFO("Visited pairs = %lu", stats->visited_pairs);
873 XBT_INFO("Executed transitions = %lu", stats->executed_transitions);
875 if ((_sg_mc_dot_output_file != NULL) && (_sg_mc_dot_output_file[0] != '\0')) {
876 fprintf(dot_output, "}\n");
879 if (initial_global_state != NULL) {
880 if (_sg_mc_comms_determinism)
881 XBT_INFO("Communication-deterministic : %s",
882 !initial_global_state->comm_deterministic ? "No" : "Yes");
883 if (_sg_mc_send_determinism)
884 XBT_INFO("Send-deterministic : %s",
885 !initial_global_state->send_deterministic ? "No" : "Yes");
890 void MC_assert(int prop)
892 if (MC_is_active() && !prop) {
893 XBT_INFO("**************************");
894 XBT_INFO("*** PROPERTY NOT VALID ***");
895 XBT_INFO("**************************");
896 XBT_INFO("Counter-example execution trace:");
897 MC_dump_stack_safety(mc_stack);
898 MC_print_statistics(mc_stats);
905 user_max_depth_reached = 1;
908 void MC_process_clock_add(smx_process_t process, double amount)
910 mc_time[process->pid] += amount;
913 double MC_process_clock_get(smx_process_t process)
917 return mc_time[process->pid];
925 void MC_automaton_load(const char *file)
928 int raw_mem_set = (mmalloc_get_current_heap() == mc_heap);
932 if (_mc_property_automaton == NULL)
933 _mc_property_automaton = xbt_automaton_new();
935 xbt_automaton_load(_mc_property_automaton, file);
944 void MC_automaton_new_propositional_symbol(const char *id, void *fct)
947 int raw_mem_set = (mmalloc_get_current_heap() == mc_heap);
951 if (_mc_property_automaton == NULL)
952 _mc_property_automaton = xbt_automaton_new();
954 xbt_automaton_propositional_symbol_new(_mc_property_automaton, id, fct);