Commit 557bca73 authored by sof's avatar sof

[project @ 2003-03-21 16:18:37 by sof]

Friday morning code-wibbling:
- made RetainerProfile.c:firstStack a 'static'
- added RetainerProfile.c:retainerStackBlocks()
parent d4c65d1e
/* -----------------------------------------------------------------------------
* $Id: RetainerProfile.c,v 1.7 2003/02/22 04:51:52 sof Exp $
* $Id: RetainerProfile.c,v 1.8 2003/03/21 16:18:37 sof Exp $
*
* (c) The GHC Team, 2001
* Author: Sungwoo Park
......@@ -158,7 +158,7 @@ typedef struct {
the topmost element on the previous block group so as to satisfy
the invariants described above.
*/
bdescr *firstStack = NULL;
static bdescr *firstStack = NULL;
static bdescr *currentStack;
static stackElement *stackBottom, *stackTop, *stackLimit;
......@@ -257,6 +257,21 @@ isEmptyRetainerStack( void )
return (firstStack == currentStack) && stackTop == stackLimit;
}
/* -----------------------------------------------------------------------------
* Returns size of stack
* -------------------------------------------------------------------------- */
lnat
retainerStackBlocks()
{
bdescr* bd;
lnat res = 0;
for (bd = firstStack; bd != NULL; bd = bd->link)
res += bd->blocks;
return res;
}
/* -----------------------------------------------------------------------------
* Returns rtsTrue if stackTop is at the stack boundary of the current stack,
* i.e., if the current stack chunk is empty.
......
/* -----------------------------------------------------------------------------
* $Id: RetainerProfile.h,v 1.2 2001/11/26 16:54:21 simonmar Exp $
* $Id: RetainerProfile.h,v 1.3 2003/03/21 16:18:38 sof Exp $
*
* (c) The GHC Team, 2001
* Author: Sungwoo Park
......@@ -38,9 +38,9 @@ retainerSetOf( StgClosure *c )
return (RetainerSet *)((StgWord)RSET(c) ^ flip);
}
// firstStack is exported because memInventory() in Schedule.c uses it.
// Used by Storage.c:memInventory()
#ifdef DEBUG
extern bdescr *firstStack;
extern lnat retainerStackBlocks ( void );
#endif
#endif /* PROFILING */
......
/* -----------------------------------------------------------------------------
* $Id: Storage.c,v 1.76 2003/02/01 09:10:17 mthomas Exp $
* $Id: Storage.c,v 1.77 2003/03/21 16:18:38 sof Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -832,8 +832,7 @@ memInventory(void)
#ifdef PROFILING
if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_RETAINER) {
for (bd = firstStack; bd != NULL; bd = bd->link)
total_blocks += bd->blocks;
total_blocks += retainerStackBlocks();
}
#endif
......
/* -----------------------------------------------------------------------------
* $Id: Storage.h,v 1.47 2002/12/13 14:43:06 simonmar Exp $
* $Id: Storage.h,v 1.48 2003/03/21 16:18:39 sof Exp $
*
* (c) The GHC Team, 1998-2002
*
......@@ -53,7 +53,7 @@ extern void exitStorage(void);
lnat allocated_bytes(void) Returns the number of bytes allocated
via allocate() since the last GC.
Used in the reoprting of statistics.
Used in the reporting of statistics.
SMP: allocate and doYouWantToGC can be used from STG code, they are
surrounded by a mutex.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment