- xbt_propositional_symbol_t ps = NULL;
- xbt_dynar_foreach(_mc_property_automaton->propositional_symbols, cursor, ps){
- f = (int_f_void_t)ps->function;
- res = (*f)();
- xbt_dynar_push_as(prop_ato, int, res);
- }
-
- cursor = 0;
- mc_pair_reached_t pair_test = NULL;
-
- //xbt_dict_t current_rdv_points = SIMIX_get_rdv_points();
-
- xbt_dynar_foreach(reached_pairs, cursor, pair_test){
- XBT_INFO("Pair reached #%d", pair_test->nb);
- if(automaton_state_compare(pair_test->automaton_state, st) == 0){
- if(propositional_symbols_compare_value(pair_test->prop_ato, prop_ato) == 0){
- //XBT_INFO("Rdv points size %d - %d", xbt_dict_length(pair_test->rdv_points), xbt_dict_length(current_rdv_points));
- //if(xbt_dict_length(pair_test->rdv_points) == xbt_dict_length(current_rdv_points)){
- //if(rdv_points_compare(pair_test->rdv_points, current_rdv_points) == 0){
- if(snapshot_compare(pair_test->system_state, sn) == 0){
-
- MC_free_snapshot(sn);
- xbt_dynar_reset(prop_ato);
- xbt_free(prop_ato);
- MC_UNSET_RAW_MEM;
- return 1;
- }
- /* }
- }else{
- XBT_INFO("Different size of rdv points (%d - %d)",xbt_dict_length(pair_test->rdv_points), xbt_dict_length(current_rdv_points) );
- }*/
- }else{
- XBT_INFO("Different values of propositional symbols");
- }
- }else{
- XBT_INFO("Different automaton state");
- }
- }
-
- MC_free_snapshot(sn);
- xbt_dynar_reset(prop_ato);
- xbt_free(prop_ato);
- MC_UNSET_RAW_MEM;
- return 0;
-
- }
-}
-
-int rdv_points_compare(xbt_dict_t d1, xbt_dict_t d2){ /* d1 = pair_test, d2 = current_pair */
-
- xbt_dict_cursor_t cursor_dict = NULL;
- char *key;
- char *data;
- smx_rdv_t rdv1, rdv2;
- xbt_fifo_item_t item1, item2;
- smx_action_t action1, action2;
- xbt_fifo_item_t item_req1, item_req2;
- smx_simcall_t req1, req2;
- int i=0;
- int j=0;
-
- xbt_dict_foreach(d1, cursor_dict, key, data){
- rdv1 = (smx_rdv_t)data;
- rdv2 = xbt_dict_get_or_null(d2, rdv1->name);
- if(rdv2 == NULL){
- XBT_INFO("Rdv point unknown");
- return 1;
- }else{
- if(xbt_fifo_size(rdv1->comm_fifo) != xbt_fifo_size(rdv2->comm_fifo)){
- XBT_INFO("Different total of actions in mailbox \"%s\" (%d - %d)", rdv1->name, xbt_fifo_size(rdv1->comm_fifo),xbt_fifo_size(rdv2->comm_fifo) );
- return 1;
- }else{
-
- XBT_INFO("Total of actions in mailbox \"%s\" : %d", rdv1->name, xbt_fifo_size(rdv1->comm_fifo));
-
- item1 = xbt_fifo_get_first_item(rdv1->comm_fifo);
- item2 = xbt_fifo_get_first_item(rdv2->comm_fifo);
-
- while(i<xbt_fifo_size(rdv1->comm_fifo)){
- action1 = (smx_action_t) xbt_fifo_get_item_content(item1);
- action2 = (smx_action_t) xbt_fifo_get_item_content(item2);
-
- if(action1->type != action2->type){
- XBT_INFO("Different type of action");
- return 1;
- }
-
- if(action1->state != action2->state){
- XBT_INFO("Different state of action");
- return 1;
- }
-
- if(xbt_fifo_size(action1->simcalls) != xbt_fifo_size(action2->simcalls)){
- XBT_INFO("Different size of simcall list (%d - %d", xbt_fifo_size(action1->simcalls), xbt_fifo_size(action2->simcalls));
- return 1;
- }else{
-
- item_req1 = xbt_fifo_get_first_item(action1->simcalls);
- item_req2 = xbt_fifo_get_first_item(action2->simcalls);
-
- while(j<xbt_fifo_size(action1->simcalls)){
-
- req1 = (smx_simcall_t) xbt_fifo_get_item_content(item_req1);
- req2 = (smx_simcall_t) xbt_fifo_get_item_content(item_req2);
-
- if(req1->call != req2->call){
- XBT_INFO("Different simcall call in simcalls of action (%d - %d)", (int)req1->call, (int)req2->call);
- return 1;
- }
- if(req1->issuer->pid != req2->issuer->pid){
- XBT_INFO("Different simcall issuer in simcalls of action (%lu- %lu)", req1->issuer->pid, req2->issuer->pid);
- return 1;
+ int previous_cursor = 0, next_cursor = 0;
+ int start = 0;
+ int end = xbt_dynar_length(acceptance_pairs) - 1;
+
+ mc_acceptance_pair_t pair_test = NULL;
+ size_t bytes_used_test;
+ int nb_processes_test;
+ int same_processes_and_bytes_not_found = 1;
+
+ while(start <= end && same_processes_and_bytes_not_found){
+ cursor = (start + end) / 2;
+ pair_test = (mc_acceptance_pair_t)xbt_dynar_get_as(acceptance_pairs, cursor, mc_acceptance_pair_t);
+ bytes_used_test = pair_test->heap_bytes_used;
+ nb_processes_test = pair_test->nb_processes;
+ if(nb_processes_test < current_nb_processes)
+ start = cursor + 1;
+ if(nb_processes_test > current_nb_processes)
+ end = cursor - 1;
+ if(nb_processes_test == current_nb_processes){
+ if(bytes_used_test < current_bytes_used)
+ start = cursor + 1;
+ if(bytes_used_test > current_bytes_used)
+ end = cursor - 1;
+ if(bytes_used_test == current_bytes_used){
+ same_processes_and_bytes_not_found = 0;
+ if(xbt_automaton_state_compare(pair_test->automaton_state, as) == 0){
+ if(xbt_automaton_propositional_symbols_compare_value(pair_test->prop_ato, new_pair->prop_ato) == 0){
+ if(snapshot_compare(new_pair->system_state, pair_test->system_state) == 0){
+ if(raw_mem_set)
+ MC_SET_RAW_MEM;
+ else
+ MC_UNSET_RAW_MEM;
+ return pair_test->num;