X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/71425c727bb809221d8c50de3fd491bd75faa381..0c13871d73e933c1847faf8debea7b7745a3ff44:/src/xbt/heap.c diff --git a/src/xbt/heap.c b/src/xbt/heap.c index e124aab386..c795b76f8f 100644 --- a/src/xbt/heap.c +++ b/src/xbt/heap.c @@ -11,6 +11,7 @@ #include "heap_private.h" #include +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_heap, xbt, "Heap"); static void xbt_heap_max_heapify(xbt_heap_t H); static void xbt_heap_increase_key(xbt_heap_t H, int i); @@ -103,6 +104,7 @@ void xbt_heap_push(xbt_heap_t H, void *content, double key) item->key = key; item->content = content; xbt_heap_increase_key(H, count - 1); + XBT_DEBUG("Heap has now %d elements and max elem is %g",xbt_heap_size(H),xbt_heap_maxkey(H)); return; } @@ -121,6 +123,8 @@ void *xbt_heap_pop(xbt_heap_t H) int size = H->size; void *max; + XBT_DEBUG("Heap has %d elements before extraction and max elem was %g",xbt_heap_size(H),xbt_heap_maxkey(H)); + if (H->count == 0) return NULL; @@ -152,6 +156,8 @@ void *xbt_heap_pop(xbt_heap_t H) */ void *xbt_heap_remove(xbt_heap_t H, int i) { + XBT_DEBUG("Heap has %d elements: extracting element %d",xbt_heap_size(H),i); + if ((i < 0) || (i > H->count - 1)) return NULL; /* put element i at head */