}
if(different_process==0){
MC_UNSET_RAW_MEM;
- XBT_DEBUG("Pair (graph=%p, automaton=%p, interleave=%d) already reached (graph=%p)!", gs, as, MC_state_interleave_size(gs), rp->graph_state);
+ XBT_DEBUG("Pair (graph=%p, automaton=%p(%s)) already reached (graph=%p)!", gs, as, as->id, rp->graph_state);
return 1;
}
/* XBT_DEBUG("Pair (graph=%p, automaton=%p(%s)) already reached !", gs, as, as->id); */
void set_pair_reached(mc_state_t gs, xbt_state_t as){
//XBT_DEBUG("Set pair (graph=%p, automaton=%p) reached ", gs, as);
- if(reached(gs, as) == 0){
+ //if(reached(gs, as) == 0){
MC_SET_RAW_MEM;
mc_reached_pairs_t p = NULL;
p = xbt_new0(s_mc_reached_pairs_t, 1);
xbt_dynar_push(reached_pairs, &p);
XBT_DEBUG("New reached pair : graph=%p, automaton=%p(%s)", gs, as, as->id);
MC_UNSET_RAW_MEM;
- }
+ //}
}
init_snapshot = xbt_new0(s_mc_snapshot_t, 1);
- initial_graph_state = MC_state_new();
+ initial_graph_state = MC_state_pair_new();
xbt_swag_foreach(process, simix_global->process_list){
if(MC_process_is_enabled(process)){
MC_state_interleave_process(initial_graph_state, process);
//sleep(1);
+ mc_stats_pair->visited_pairs++;
+
int value;
mc_state_t next_graph_state = NULL;
smx_req_t req = NULL;
}
MC_state_set_executed_request(current_pair->graph_state, req, value);
- //mc_stats->executed_transitions++;
/* Answer the request */
SIMIX_request_pre(req, value);
/* Create the new expanded graph_state */
MC_SET_RAW_MEM;
- next_graph_state = MC_state_new();
+ next_graph_state = MC_state_pair_new();
/* Get enabled process and insert it in the interleave set of the next graph_state */
xbt_swag_foreach(process, simix_global->process_list){
if((res == 1) || (res == 2)){ // enabled transition in automaton
xbt_dynar_push(successors, &next_pair);
+ mc_stats_pair->expanded_pairs++;
}
MC_UNSET_RAW_MEM;
MC_SET_RAW_MEM;
next_pair = new_pair(next_snapshot, next_graph_state, current_pair->automaton_state);
xbt_dynar_push(successors, &next_pair);
+ mc_stats_pair->expanded_pairs++;
MC_UNSET_RAW_MEM;
}
XBT_INFO("Counter-example that violates formula :");
MC_show_snapshot_stack(mc_snapshot_stack);
MC_dump_snapshot_stack(mc_snapshot_stack);
+ MC_print_statistics_pairs(mc_stats_pair);
exit(0);
}
if(visited(pair_succ->graph_state, pair_succ->automaton_state, search_cycle) == 0){
//XBT_DEBUG("Unvisited pair !");
+
+ mc_stats_pair->executed_transitions++;
MC_SET_RAW_MEM;
xbt_fifo_unshift(mc_snapshot_stack, pair_succ);
mc_snapshot_t initial_snapshot = NULL;
xbt_fifo_t mc_stack = NULL;
mc_stats_t mc_stats = NULL;
+mc_stats_pair_t mc_stats_pair = NULL;
mc_state_t mc_current_state = NULL;
char mc_replay_mode = FALSE;
double *mc_time = NULL;
MC_SET_RAW_MEM;
/* Initialize statistics */
- mc_stats = xbt_new0(s_mc_stats_t, 1);
- mc_stats->state_size = 1;
+ mc_stats_pair = xbt_new0(s_mc_stats_pair_t, 1);
+ //mc_stats_pair->pair_size = 1;
XBT_DEBUG("Creating snapshot_stack");
void MC_modelcheck_with_automaton(xbt_automaton_t a){
MC_init_with_automaton(a);
- MC_exit();
+ MC_exit_with_automaton();
+}
+
+void MC_exit_with_automaton(void)
+{
+ MC_print_statistics_pairs(mc_stats_pair);
+ xbt_free(mc_time);
+ MC_memory_exit();
}
void MC_exit(void)
(double)stats->expanded_states / stats->state_size); */
}
+void MC_print_statistics_pairs(mc_stats_pair_t stats)
+{
+ XBT_INFO("Expanded pairs = %lu", stats->expanded_pairs);
+ XBT_INFO("Visited pairs = %lu", stats->visited_pairs);
+ XBT_INFO("Executed transitions = %lu", stats->executed_transitions);
+ XBT_INFO("Expanded / Visited = %lf",
+ (double) stats->visited_pairs / stats->expanded_pairs);
+ /*XBT_INFO("Exploration coverage = %lf",
+ (double)stats->expanded_states / stats->state_size); */
+}
+
void MC_assert(int prop)
{
if (MC_IS_ENABLED && !prop) {
unsigned long executed_transitions;
} s_mc_stats_t, *mc_stats_t;
+typedef struct mc_stats_pair {
+ //unsigned long pair_size;
+ unsigned long visited_pairs;
+ unsigned long expanded_pairs;
+ unsigned long executed_transitions;
+} s_mc_stats_pair_t, *mc_stats_pair_t;
+
extern mc_stats_t mc_stats;
+extern mc_stats_pair_t mc_stats_pair;
void MC_print_statistics(mc_stats_t);
+void MC_print_statistics_pairs(mc_stats_pair_t);
/********************************** MEMORY ******************************/
/* The possible memory modes for the modelchecker are standard and raw. */
void MC_show_snapshot_stack(xbt_fifo_t stack);
void MC_dump_snapshot_stack(xbt_fifo_t stack);
void MC_pair_delete(mc_pairs_t pair);
+void MC_exit_with_automaton(void);
+mc_state_t MC_state_pair_new(void);
#endif