From: simonmar@microsoft.com Date: Fri, 14 Dec 2007 13:59:09 +0000 (+0000) Subject: findSlop: useful function for tracking down excessive slop in gdb X-Git-Tag: Before_cabalised-GHC~269 X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=de6a898b43cacc69cd9bc4c6675d3e8771047f17 findSlop: useful function for tracking down excessive slop in gdb --- diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index ecd9b54..2305996 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -1118,6 +1118,21 @@ void freeExec (void *addr) #ifdef DEBUG +// Useful for finding partially full blocks in gdb +void findSlop(bdescr *bd); +void findSlop(bdescr *bd) +{ + lnat slop; + + for (; bd != NULL; bd = bd->link) { + slop = (bd->blocks * BLOCK_SIZE_W) - (bd->free - bd->start); + if (slop > (1024/sizeof(W_))) { + debugBelch("block at %p (bdescr %p) has %ldKB slop\n", + bd->start, bd, slop / (1024/sizeof(W_))); + } + } +} + nat countBlocks(bdescr *bd) {