Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : remove unused argument in functions for heap comparison algorithm
[simgrid.git] / src / xbt / mmalloc / mm_diff.c
index c7e56c1..498622f 100644 (file)
@@ -112,20 +112,20 @@ void mmalloc_backtrace_fragment_display(xbt_mheap_t mdp, size_t block, size_t fr
   }
 }
 
-int mmalloc_compare_heap(xbt_mheap_t mdp1, xbt_mheap_t mdp2, void* s_heap, void* r_heap){
+int mmalloc_compare_heap(xbt_mheap_t mdp1, xbt_mheap_t mdp2, void* s_heap){
 
   if(mdp1 == NULL && mdp2 == NULL){
     fprintf(stderr, "Malloc descriptors null\n");
     return 0;
   }
 
-  int errors = mmalloc_compare_mdesc(mdp1, mdp2, s_heap, r_heap);
+  int errors = mmalloc_compare_mdesc(mdp1, mdp2, s_heap);
 
   return (errors > 0);
 
 }
 
-int mmalloc_compare_mdesc(struct mdesc *mdp1, struct mdesc *mdp2, void* s_heap, void* r_heap){
+int mmalloc_compare_mdesc(struct mdesc *mdp1, struct mdesc *mdp2, void* s_heap){
 
   int errors = 0;
 
@@ -209,6 +209,7 @@ int mmalloc_compare_mdesc(struct mdesc *mdp1, struct mdesc *mdp2, void* s_heap,
 
   int k;
   int distance = 0;
+  int total_distance = 0;
 
   void *end_heap = get_end_addr_heap(s_heap);
 
@@ -334,6 +335,7 @@ int mmalloc_compare_mdesc(struct mdesc *mdp1, struct mdesc *mdp2, void* s_heap,
        mmalloc_backtrace_block_display(mdp1, i);
        mmalloc_backtrace_block_display(mdp2, i);
        errors++; 
+       total_distance += distance;
       }
     
       
@@ -450,6 +452,7 @@ int mmalloc_compare_mdesc(struct mdesc *mdp1, struct mdesc *mdp2, void* s_heap,
              mmalloc_backtrace_fragment_display(mdp1, i, j);
              mmalloc_backtrace_fragment_display(mdp2, i, j);
              errors++;
+             total_distance += distance;
              
            }
 
@@ -473,6 +476,8 @@ int mmalloc_compare_mdesc(struct mdesc *mdp1, struct mdesc *mdp2, void* s_heap,
   //free(pointed_address1);
   //free(pointed_address2);
 
+  fprintf(stderr, "Hamming distance between heap regions : %d\n", total_distance);
+
   return (errors);
 }