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
253 || (_sg_mc_property_file && _sg_mc_property_file[0] != '\0')) {
254 /* Ignore some variables from xbt/ex.h used by exception e for stacks comparison */
255 MC_ignore_local_variable("e", "*");
256 MC_ignore_local_variable("__ex_cleanup", "*");
257 MC_ignore_local_variable("__ex_mctx_en", "*");
258 MC_ignore_local_variable("__ex_mctx_me", "*");
259 MC_ignore_local_variable("__xbt_ex_ctx_ptr", "*");
260 MC_ignore_local_variable("_log_ev", "*");
261 MC_ignore_local_variable("_throw_ctx", "*");
262 MC_ignore_local_variable("ctx", "*");
264 MC_ignore_local_variable("self", "simcall_BODY_mc_snapshot");
265 MC_ignore_local_variable("next_context", "smx_ctx_sysv_suspend_serial");
266 MC_ignore_local_variable("i", "smx_ctx_sysv_suspend_serial");
268 /* Ignore local variable about time used for tracing */
269 MC_ignore_local_variable("start_time", "*");
271 MC_ignore_global_variable("compared_pointers");
272 MC_ignore_global_variable("mc_comp_times");
273 MC_ignore_global_variable("mc_snapshot_comparison_time");
274 MC_ignore_global_variable("mc_time");
275 MC_ignore_global_variable("smpi_current_rank");
276 MC_ignore_global_variable("counter"); /* Static variable used for tracing */
277 MC_ignore_global_variable("maestro_stack_start");
278 MC_ignore_global_variable("maestro_stack_end");
279 MC_ignore_global_variable("smx_total_comms");
281 MC_ignore_heap(&(simix_global->process_to_run),
282 sizeof(simix_global->process_to_run));
283 MC_ignore_heap(&(simix_global->process_that_ran),
284 sizeof(simix_global->process_that_ran));
285 MC_ignore_heap(simix_global->process_to_run,
286 sizeof(*(simix_global->process_to_run)));
287 MC_ignore_heap(simix_global->process_that_ran,
288 sizeof(*(simix_global->process_that_ran)));
289 MC_ignore_heap(mc_time, simix_process_maxpid * sizeof(double));
291 smx_process_t process;
292 xbt_swag_foreach(process, simix_global->process_list) {
293 MC_ignore_heap(&(process->process_hookup),
294 sizeof(process->process_hookup));
303 /******************************* Core of MC *******************************/
304 /**************************************************************************/
306 static void MC_modelcheck_comm_determinism_init(void)
309 int mc_mem_set = (mmalloc_get_current_heap() == mc_heap);
316 /* Create exploration stack */
317 mc_stack = xbt_fifo_new();
319 initial_global_state = xbt_new0(s_mc_global_t, 1);
320 initial_global_state->snapshot = MC_take_snapshot(0);
321 initial_global_state->initial_communications_pattern_done = 0;
322 initial_global_state->comm_deterministic = 1;
323 initial_global_state->send_deterministic = 1;
328 MC_pre_modelcheck_comm_determinism();
332 static void MC_modelcheck_safety_init(void)
334 int mc_mem_set = (mmalloc_get_current_heap() == mc_heap);
343 /* Create exploration stack */
344 mc_stack = xbt_fifo_new();
348 MC_pre_modelcheck_safety();
351 /* Save the initial state */
352 initial_global_state = xbt_new0(s_mc_global_t, 1);
353 initial_global_state->snapshot = MC_take_snapshot(0);
356 MC_modelcheck_safety();
365 static void MC_modelcheck_liveness_init()
368 int mc_mem_set = (mmalloc_get_current_heap() == mc_heap);
377 /* Create exploration stack */
378 mc_stack = xbt_fifo_new();
380 /* Create the initial state */
381 initial_global_state = xbt_new0(s_mc_global_t, 1);
385 MC_pre_modelcheck_liveness();
388 MC_print_statistics(mc_stats);
396 void MC_do_the_modelcheck_for_real()
399 if (_sg_mc_comms_determinism || _sg_mc_send_determinism) {
400 XBT_INFO("Check communication determinism");
401 MC_modelcheck_comm_determinism_init();
402 } else if (!_sg_mc_property_file || _sg_mc_property_file[0] == '\0') {
403 if (mc_reduce_kind == e_mc_reduce_unset)
404 mc_reduce_kind = e_mc_reduce_dpor;
405 XBT_INFO("Check a safety property");
406 MC_modelcheck_safety_init();
408 if (mc_reduce_kind == e_mc_reduce_unset)
409 mc_reduce_kind = e_mc_reduce_none;
410 XBT_INFO("Check the liveness property %s", _sg_mc_property_file);
411 MC_automaton_load(_sg_mc_property_file);
412 MC_modelcheck_liveness_init();
425 int SIMIX_pre_mc_random(smx_simcall_t simcall, int min, int max)
428 return simcall->mc_value;
432 int MC_random(int min, int max)
434 /*FIXME: return mc_current_state->executed_transition->random.value; */
435 return simcall_mc_random(min, max);
439 * \brief Schedules all the process that are ready to run
441 void MC_wait_for_requests(void)
443 smx_process_t process;
447 while (!xbt_dynar_is_empty(simix_global->process_to_run)) {
448 SIMIX_process_runall();
449 xbt_dynar_foreach(simix_global->process_that_ran, iter, process) {
450 req = &process->simcall;
451 if (req->call != SIMCALL_NONE && !MC_request_is_visible(req))
452 SIMIX_simcall_pre(req, 0);
457 int MC_deadlock_check()
459 int deadlock = FALSE;
460 smx_process_t process;
461 if (xbt_swag_size(simix_global->process_list)) {
463 xbt_swag_foreach(process, simix_global->process_list) {
464 if (process->simcall.call != SIMCALL_NONE
465 && MC_request_is_enabled(&process->simcall)) {
475 * \brief Re-executes from the state at position start all the transitions indicated by
476 * a given model-checker stack.
477 * \param stack The stack with the transitions to execute.
478 * \param start Start index to begin the re-execution.
480 void MC_replay(xbt_fifo_t stack, int start)
482 int raw_mem = (mmalloc_get_current_heap() == mc_heap);
484 int value, i = 1, count = 1;
486 smx_simcall_t req = NULL, saved_req = NULL;
487 xbt_fifo_item_t item, start_item;
489 smx_process_t process = NULL;
490 int comm_pattern = 0;
491 smx_action_t current_comm;
493 XBT_DEBUG("**** Begin Replay ****");
496 /* Restore the initial state */
497 MC_restore_snapshot(initial_global_state->snapshot);
498 /* At the moment of taking the snapshot the raw heap was set, so restoring
499 * it will set it back again, we have to unset it to continue */
503 start_item = xbt_fifo_get_last_item(stack);
506 start_item = xbt_fifo_get_prev_item(start_item);
513 if (mc_reduce_kind == e_mc_reduce_dpor) {
514 xbt_dict_reset(first_enabled_state);
515 xbt_swag_foreach(process, simix_global->process_list) {
516 if (MC_process_is_enabled(process)) {
517 char *key = bprintf("%lu", process->pid);
518 char *data = bprintf("%d", count);
519 xbt_dict_set(first_enabled_state, key, data, NULL);
525 if (_sg_mc_comms_determinism || _sg_mc_send_determinism) {
526 xbt_dynar_reset(communications_pattern);
527 xbt_dynar_reset(incomplete_communications_pattern);
533 /* Traverse the stack from the state at position start and re-execute the transitions */
534 for (item = start_item;
535 item != xbt_fifo_get_first_item(stack);
536 item = xbt_fifo_get_prev_item(item)) {
538 state = (mc_state_t) xbt_fifo_get_item_content(item);
539 saved_req = MC_state_get_executed_request(state, &value);
541 if (mc_reduce_kind == e_mc_reduce_dpor) {
543 char *key = bprintf("%lu", saved_req->issuer->pid);
544 xbt_dict_remove(first_enabled_state, key);
550 /* because we got a copy of the executed request, we have to fetch the
551 real one, pointed by the request field of the issuer process */
552 req = &saved_req->issuer->simcall;
554 /* Debug information */
555 if (XBT_LOG_ISENABLED(mc_global, xbt_log_priority_debug)) {
556 req_str = MC_request_to_string(req, value);
557 XBT_DEBUG("Replay: %s (%p)", req_str, state);
561 /* TODO : handle test and testany simcalls */
562 if (_sg_mc_comms_determinism || _sg_mc_send_determinism) {
563 if (req->call == SIMCALL_COMM_ISEND)
565 else if (req->call == SIMCALL_COMM_IRECV)
567 else if (req->call == SIMCALL_COMM_WAIT)
569 else if (req->call == SIMCALL_COMM_WAITANY)
573 SIMIX_simcall_pre(req, value);
575 if (_sg_mc_comms_determinism || _sg_mc_send_determinism) {
577 if (comm_pattern == 1 || comm_pattern == 2) {
578 get_comm_pattern(communications_pattern, req, comm_pattern);
579 } else if (comm_pattern == 3 /* || comm_pattern == 4 */ ) {
580 current_comm = simcall_comm_wait__get__comm(req);
581 if (current_comm->comm.refcount == 1) { /* First wait only must be considered */
582 complete_comm_pattern(communications_pattern, current_comm);
584 } else if (comm_pattern == 4 /* || comm_pattern == 4 */ ) {
586 xbt_dynar_get_as(simcall_comm_waitany__get__comms(req), value,
588 if (current_comm->comm.refcount == 1) { /* First wait only must be considered */
589 complete_comm_pattern(communications_pattern, current_comm);
597 MC_wait_for_requests();
601 if (mc_reduce_kind == e_mc_reduce_dpor) {
603 /* Insert in dict all enabled processes */
604 xbt_swag_foreach(process, simix_global->process_list) {
605 if (MC_process_is_enabled(process)
606 /*&& !MC_state_process_is_done(state, process) */ ) {
607 char *key = bprintf("%lu", process->pid);
608 if (xbt_dict_get_or_null(first_enabled_state, key) == NULL) {
609 char *data = bprintf("%d", count);
610 xbt_dict_set(first_enabled_state, key, data, NULL);
619 /* Update statistics */
620 mc_stats->visited_states++;
621 mc_stats->executed_transitions++;
625 XBT_DEBUG("**** End Replay ****");
635 void MC_replay_liveness(xbt_fifo_t stack, int all_stack)
638 initial_global_state->raw_mem_set = (mmalloc_get_current_heap() == mc_heap);
642 smx_simcall_t req = NULL, saved_req = NULL;
643 xbt_fifo_item_t item;
648 XBT_DEBUG("**** Begin Replay ****");
650 /* Restore the initial state */
651 MC_restore_snapshot(initial_global_state->snapshot);
653 /* At the moment of taking the snapshot the raw heap was set, so restoring
654 * it will set it back again, we have to unset it to continue */
655 if (!initial_global_state->raw_mem_set)
660 item = xbt_fifo_get_last_item(stack);
662 while (depth <= xbt_fifo_size(stack)) {
664 pair = (mc_pair_t) xbt_fifo_get_item_content(item);
665 state = (mc_state_t) pair->graph_state;
667 if (pair->requests > 0) {
669 saved_req = MC_state_get_executed_request(state, &value);
670 //XBT_DEBUG("SavedReq->call %u", saved_req->call);
672 if (saved_req != NULL) {
673 /* because we got a copy of the executed request, we have to fetch the
674 real one, pointed by the request field of the issuer process */
675 req = &saved_req->issuer->simcall;
676 //XBT_DEBUG("Req->call %u", req->call);
678 /* Debug information */
679 if (XBT_LOG_ISENABLED(mc_global, xbt_log_priority_debug)) {
680 req_str = MC_request_to_string(req, value);
681 XBT_DEBUG("Replay (depth = %d) : %s (%p)", depth, req_str, state);
687 SIMIX_simcall_pre(req, value);
688 MC_wait_for_requests();
693 /* Update statistics */
694 mc_stats->visited_pairs++;
695 mc_stats->executed_transitions++;
697 item = xbt_fifo_get_prev_item(item);
702 /* Traverse the stack from the initial state and re-execute the transitions */
703 for (item = xbt_fifo_get_last_item(stack);
704 item != xbt_fifo_get_first_item(stack);
705 item = xbt_fifo_get_prev_item(item)) {
707 pair = (mc_pair_t) xbt_fifo_get_item_content(item);
708 state = (mc_state_t) pair->graph_state;
710 if (pair->requests > 0) {
712 saved_req = MC_state_get_executed_request(state, &value);
713 //XBT_DEBUG("SavedReq->call %u", saved_req->call);
715 if (saved_req != NULL) {
716 /* because we got a copy of the executed request, we have to fetch the
717 real one, pointed by the request field of the issuer process */
718 req = &saved_req->issuer->simcall;
719 //XBT_DEBUG("Req->call %u", req->call);
721 /* Debug information */
722 if (XBT_LOG_ISENABLED(mc_global, xbt_log_priority_debug)) {
723 req_str = MC_request_to_string(req, value);
724 XBT_DEBUG("Replay (depth = %d) : %s (%p)", depth, req_str, state);
730 SIMIX_simcall_pre(req, value);
731 MC_wait_for_requests();
736 /* Update statistics */
737 mc_stats->visited_pairs++;
738 mc_stats->executed_transitions++;
742 XBT_DEBUG("**** End Replay ****");
744 if (initial_global_state->raw_mem_set)
752 * \brief Dumps the contents of a model-checker's stack and shows the actual
754 * \param stack The stack to dump
756 void MC_dump_stack_safety(xbt_fifo_t stack)
759 int raw_mem_set = (mmalloc_get_current_heap() == mc_heap);
761 MC_show_stack_safety(stack);
763 if (!_sg_mc_checkpoint) {
768 while ((state = (mc_state_t) xbt_fifo_pop(stack)) != NULL)
769 MC_state_delete(state);
782 void MC_show_stack_safety(xbt_fifo_t stack)
785 int raw_mem_set = (mmalloc_get_current_heap() == mc_heap);
791 xbt_fifo_item_t item;
793 char *req_str = NULL;
795 for (item = xbt_fifo_get_last_item(stack);
796 (item ? (state = (mc_state_t) (xbt_fifo_get_item_content(item)))
797 : (NULL)); item = xbt_fifo_get_prev_item(item)) {
798 req = MC_state_get_executed_request(state, &value);
800 req_str = MC_request_to_string(req, value);
801 XBT_INFO("%s", req_str);
810 void MC_show_deadlock(smx_simcall_t req)
812 /*char *req_str = NULL; */
813 XBT_INFO("**************************");
814 XBT_INFO("*** DEAD-LOCK DETECTED ***");
815 XBT_INFO("**************************");
816 XBT_INFO("Locked request:");
817 /*req_str = MC_request_to_string(req);
818 XBT_INFO("%s", req_str);
819 xbt_free(req_str); */
820 XBT_INFO("Counter-example execution trace:");
821 MC_dump_stack_safety(mc_stack);
822 MC_print_statistics(mc_stats);
826 void MC_show_stack_liveness(xbt_fifo_t stack)
830 xbt_fifo_item_t item;
832 char *req_str = NULL;
834 for (item = xbt_fifo_get_last_item(stack);
835 (item ? (pair = (mc_pair_t) (xbt_fifo_get_item_content(item)))
836 : (NULL)); item = xbt_fifo_get_prev_item(item)) {
837 req = MC_state_get_executed_request(pair->graph_state, &value);
839 if (pair->requests > 0) {
840 req_str = MC_request_to_string(req, value);
841 XBT_INFO("%s", req_str);
844 XBT_INFO("End of system requests but evolution in Büchi automaton");
850 void MC_dump_stack_liveness(xbt_fifo_t stack)
853 int raw_mem_set = (mmalloc_get_current_heap() == mc_heap);
858 while ((pair = (mc_pair_t) xbt_fifo_pop(stack)) != NULL)
859 MC_pair_delete(pair);
868 void MC_print_statistics(mc_stats_t stats)
870 if (stats->expanded_pairs == 0) {
871 XBT_INFO("Expanded states = %lu", stats->expanded_states);
872 XBT_INFO("Visited states = %lu", stats->visited_states);
874 XBT_INFO("Expanded pairs = %lu", stats->expanded_pairs);
875 XBT_INFO("Visited pairs = %lu", stats->visited_pairs);
877 XBT_INFO("Executed transitions = %lu", stats->executed_transitions);
879 if ((_sg_mc_dot_output_file != NULL) && (_sg_mc_dot_output_file[0] != '\0')) {
880 fprintf(dot_output, "}\n");
883 if (initial_global_state != NULL) {
884 if (_sg_mc_comms_determinism)
885 XBT_INFO("Communication-deterministic : %s",
886 !initial_global_state->comm_deterministic ? "No" : "Yes");
887 if (_sg_mc_send_determinism)
888 XBT_INFO("Send-deterministic : %s",
889 !initial_global_state->send_deterministic ? "No" : "Yes");
894 void MC_assert(int prop)
896 if (MC_is_active() && !prop) {
897 XBT_INFO("**************************");
898 XBT_INFO("*** PROPERTY NOT VALID ***");
899 XBT_INFO("**************************");
900 XBT_INFO("Counter-example execution trace:");
901 MC_dump_stack_safety(mc_stack);
902 MC_print_statistics(mc_stats);
909 user_max_depth_reached = 1;
912 void MC_process_clock_add(smx_process_t process, double amount)
914 mc_time[process->pid] += amount;
917 double MC_process_clock_get(smx_process_t process)
921 return mc_time[process->pid];
929 void MC_automaton_load(const char *file)
932 int raw_mem_set = (mmalloc_get_current_heap() == mc_heap);
936 if (_mc_property_automaton == NULL)
937 _mc_property_automaton = xbt_automaton_new();
939 xbt_automaton_load(_mc_property_automaton, file);
948 void MC_automaton_new_propositional_symbol(const char *id, void *fct)
951 int raw_mem_set = (mmalloc_get_current_heap() == mc_heap);
955 if (_mc_property_automaton == NULL)
956 _mc_property_automaton = xbt_automaton_new();
958 xbt_automaton_propositional_symbol_new(_mc_property_automaton, id, fct);