From 1f506aa6b83d5053316adbc9fc8f4c7bfc483442 Mon Sep 17 00:00:00 2001 From: Marion Guthmuller Date: Wed, 30 Nov 2011 19:06:29 +0100 Subject: [PATCH] model-checker : all heapstats except total size of the heap added in the comparison of the heap between two snapshots --- src/xbt/mmalloc/mm_legacy.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/src/xbt/mmalloc/mm_legacy.c b/src/xbt/mmalloc/mm_legacy.c index a1b497d965..0242f2a45e 100644 --- a/src/xbt/mmalloc/mm_legacy.c +++ b/src/xbt/mmalloc/mm_legacy.c @@ -174,13 +174,38 @@ int mmalloc_compare_heap(void *h1, void *h2){ XBT_DEBUG("Malloc descriptors null"); return 0; } - + + /* Heapstats */ + + struct mstats ms1 = mmstats(h1); + struct mstats ms2 = mmstats(h2); + + if(ms1.chunks_used != ms2.chunks_used){ + XBT_DEBUG("Different chunks allocated by the user : %Zu - %Zu", ms1.chunks_used, ms2.chunks_used); + return 1; + } + + if(ms1.bytes_used != ms2.bytes_used){ + XBT_DEBUG("Different byte total of user-allocated chunks : %Zu - %Zu", ms1.bytes_used, ms2.bytes_used); + return 1; + } + + if(ms1.bytes_free != ms2.bytes_free){ + XBT_DEBUG("Different byte total of chunks in the free list : %Zu - %Zu", ms1.bytes_free, ms2.bytes_free); + return 1; + } + + if(ms1.chunks_free != ms2.chunks_free){ + XBT_DEBUG("Different chunks in the free list : %Zu - %Zu", ms1.chunks_free, ms2.chunks_free); + return 1; + } + struct mdesc *mdp1, *mdp2; mdp1 = MD_TO_MDP(h1); mdp2 = MD_TO_MDP(h2); - - return mmalloc_compare_mdesc(mdp1, mdp2)) - + + return mmalloc_compare_mdesc(mdp1, mdp2); + } int mmalloc_compare_mdesc(struct mdesc *mdp1, struct mdesc *mdp2){ -- 2.20.1