- /* Compare size of stacks */
- unsigned int cursor = 0;
- void *addr_stack1, *addr_stack2;
- void *sp1, *sp2;
- size_t size_used1, size_used2;
- int is_diff = 0;
- while(cursor < xbt_dynar_length(stacks_areas)){
- addr_stack1 = (char *)s1->regions[heap_index]->data + ((char *)((stack_region_t)xbt_dynar_get_as(stacks_areas, cursor, stack_region_t))->address - (char *)std_heap);
- addr_stack2 = (char *)s2->regions[heap_index]->data + ((char *)((stack_region_t)xbt_dynar_get_as(stacks_areas, cursor, stack_region_t))->address - (char *)std_heap);
- sp1 = ((mc_snapshot_stack_t)xbt_dynar_get_as(s1->stacks, cursor, mc_snapshot_stack_t))->stack_pointer;
- sp2 = ((mc_snapshot_stack_t)xbt_dynar_get_as(s2->stacks, cursor, mc_snapshot_stack_t))->stack_pointer;
- size_used1 = ((stack_region_t)xbt_dynar_get_as(stacks_areas, cursor, stack_region_t))->size - ((char*)sp1 - (char*)addr_stack1);
- size_used2 = ((stack_region_t)xbt_dynar_get_as(stacks_areas, cursor, stack_region_t))->size - ((char*)sp2 - (char*)addr_stack2);
- if(size_used1 != size_used2){
- if(XBT_LOG_ISENABLED(mc_compare, xbt_log_priority_debug)){
+ #ifdef MC_DEBUG
+ if(is_diff == 0)
+ xbt_os_walltimer_stop(timer);
+ xbt_os_walltimer_start(timer);
+ #endif
+
+ /* Compare hash of global variables */
+ if(s1->hash_global != NULL && s2->hash_global != NULL){
+ if(strcmp(s1->hash_global, s2->hash_global) != 0){
+ #ifdef MC_DEBUG
+ xbt_os_walltimer_stop(timer);
+ mc_comp_times->hash_global_variables_comparison_time = xbt_os_timer_elapsed(timer);
+ XBT_DEBUG("Different hash of global variables : %s - %s", s1->hash_global, s2->hash_global);
+ errors++;
+ #else
+ #ifdef MC_VERBOSE
+ XBT_VERB("Different hash of global variables : %s - %s", s1->hash_global, s2->hash_global);
+ #endif
+
+ xbt_os_walltimer_stop(timer);
+ xbt_os_timer_free(timer);
+ xbt_os_walltimer_stop(global_timer);
+ mc_snapshot_comparison_time = xbt_os_timer_elapsed(global_timer);
+ xbt_os_timer_free(global_timer);
+
+ return 1;
+ #endif
+ }
+ }
+
+ #ifdef MC_DEBUG
+ xbt_os_walltimer_start(timer);
+ #endif
+
+ /* Compare hash of local variables */
+ if(s1->hash_local != NULL && s2->hash_local != NULL){
+ if(strcmp(s1->hash_local, s2->hash_local) != 0){
+ #ifdef MC_DEBUG
+ xbt_os_walltimer_stop(timer);
+ mc_comp_times->hash_local_variables_comparison_time = xbt_os_timer_elapsed(timer);
+ XBT_DEBUG("Different hash of local variables : %s - %s", s1->hash_local, s2->hash_local);
+ errors++;
+ #else
+ #ifdef MC_VERBOSE
+ XBT_VERB("Different hash of local variables : %s - %s", s1->hash_local, s2->hash_local);
+ #endif
+
+ xbt_os_walltimer_stop(timer);
+ xbt_os_timer_free(timer);
+ xbt_os_walltimer_stop(global_timer);
+ mc_snapshot_comparison_time = xbt_os_timer_elapsed(global_timer);
+ xbt_os_timer_free(global_timer);
+
+ return 1;
+ #endif
+ }
+ }
+
+ #ifdef MC_DEBUG
+ xbt_os_walltimer_start(timer);
+ #endif
+
+ /* Init heap information used in heap comparison algorithm */
+ res_init = init_heap_information((xbt_mheap_t)s1->regions[0]->data, (xbt_mheap_t)s2->regions[0]->data, s1->to_ignore, s2->to_ignore);
+ if(res_init == -1){
+ #ifdef MC_DEBUG
+ XBT_DEBUG("(%d - %d) Different heap information", ((mc_pair_t)p1)->num, ((mc_pair_t)p2)->num);
+ errors++;
+ #else
+ #ifdef MC_VERBOSE
+ XBT_VERB("(%d - %d) Different heap information", ((mc_pair_t)p1)->num, ((mc_pair_t)p2)->num);
+ #endif
+
+ xbt_os_walltimer_stop(global_timer);
+ mc_snapshot_comparison_time = xbt_os_timer_elapsed(global_timer);
+ xbt_os_timer_free(global_timer);
+
+ return 1;
+ #endif
+ }
+
+ #ifdef MC_DEBUG
+ xbt_os_walltimer_start(timer);
+ #endif
+
+ /* Stacks comparison */
+ unsigned int cursor = 0;
+ int diff_local = 0;
+ is_diff = 0;
+ mc_snapshot_stack_t stack1, stack2;
+
+ while(cursor < xbt_dynar_length(s1->stacks)){
+ stack1 = (mc_snapshot_stack_t)xbt_dynar_get_as(s1->stacks, cursor, mc_snapshot_stack_t);
+ stack2 = (mc_snapshot_stack_t)xbt_dynar_get_as(s2->stacks, cursor, mc_snapshot_stack_t);
+ diff_local = compare_local_variables(stack1, stack2, s1->regions[0]->data, s2->regions[0]->data);
+ if(diff_local > 0){
+ #ifdef MC_DEBUG