1 /* -----------------------------------------------------------------------------
3 * (c) The GHC Team, 2001
6 * Retainer profiling interface.
8 * ---------------------------------------------------------------------------*/
10 #ifndef RETAINERPROFILE_H
11 #define RETAINERPROFILE_H
15 #include "RetainerSet.h"
17 extern void initRetainerProfiling ( void );
18 extern void endRetainerProfiling ( void );
19 extern void printRetainer ( FILE *, retainer );
20 extern void retainerProfile ( void );
21 extern void resetStaticObjectForRetainerProfiling ( void );
23 extern StgWord RTS_VAR(flip);
25 // extract the retainer set field from c
26 #define RSET(c) ((c)->header.prof.hp.rs)
28 #define isRetainerSetFieldValid(c) \
29 ((((StgWord)(c)->header.prof.hp.rs & 1) ^ flip) == 0)
31 static inline RetainerSet *
32 retainerSetOf( StgClosure *c )
34 ASSERT( isRetainerSetFieldValid(c) );
35 // StgWord has the same size as pointers, so the following type
37 return (RetainerSet *)((StgWord)RSET(c) ^ flip);
40 // Used by Storage.c:memInventory()
42 extern lnat retainerStackBlocks ( void );
45 #endif /* PROFILING */
47 #endif /* RETAINERPROFILE_H */