/* -----------------------------------------------------------------------------
- * $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
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;
}
/* -----------------------------------------------------------------------------
+ * 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
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
*
#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
*
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.