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 * (c) The GHC Team, 2001
* Author: Sungwoo Park * Author: Sungwoo Park
...@@ -158,7 +158,7 @@ typedef struct { ...@@ -158,7 +158,7 @@ typedef struct {
the topmost element on the previous block group so as to satisfy the topmost element on the previous block group so as to satisfy
the invariants described above. the invariants described above.
*/ */
bdescr *firstStack = NULL; static bdescr *firstStack = NULL;
static bdescr *currentStack; static bdescr *currentStack;
static stackElement *stackBottom, *stackTop, *stackLimit; static stackElement *stackBottom, *stackTop, *stackLimit;
...@@ -257,6 +257,21 @@ isEmptyRetainerStack( void ) ...@@ -257,6 +257,21 @@ isEmptyRetainerStack( void )
return (firstStack == currentStack) && stackTop == stackLimit; 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, * Returns rtsTrue if stackTop is at the stack boundary of the current stack,
* i.e., if the current stack chunk is empty. * 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 * (c) The GHC Team, 2001
* Author: Sungwoo Park * Author: Sungwoo Park
...@@ -38,9 +38,9 @@ retainerSetOf( StgClosure *c ) ...@@ -38,9 +38,9 @@ retainerSetOf( StgClosure *c )
return (RetainerSet *)((StgWord)RSET(c) ^ flip); return (RetainerSet *)((StgWord)RSET(c) ^ flip);
} }
// firstStack is exported because memInventory() in Schedule.c uses it. // Used by Storage.c:memInventory()
#ifdef DEBUG #ifdef DEBUG
extern bdescr *firstStack; extern lnat retainerStackBlocks ( void );
#endif #endif
#endif /* PROFILING */ #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 * (c) The GHC Team, 1998-1999
* *
...@@ -832,8 +832,7 @@ memInventory(void) ...@@ -832,8 +832,7 @@ memInventory(void)
#ifdef PROFILING #ifdef PROFILING
if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_RETAINER) { if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_RETAINER) {
for (bd = firstStack; bd != NULL; bd = bd->link) total_blocks += retainerStackBlocks();
total_blocks += bd->blocks;
} }
#endif #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 * (c) The GHC Team, 1998-2002
* *
...@@ -53,7 +53,7 @@ extern void exitStorage(void); ...@@ -53,7 +53,7 @@ extern void exitStorage(void);
lnat allocated_bytes(void) Returns the number of bytes allocated lnat allocated_bytes(void) Returns the number of bytes allocated
via allocate() since the last GC. 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 SMP: allocate and doYouWantToGC can be used from STG code, they are
surrounded by a mutex. 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