1 /* -----------------------------------------------------------------------------
2 * $Id: LdvProfile.h,v 1.1 2001/11/22 14:25:12 simonmar Exp $
4 * (c) The GHC Team, 2001
7 * Lag/Drag/Void profiling.
9 * ---------------------------------------------------------------------------*/
18 void LDV_recordDead_FILL_SLOP_DYNAMIC( StgClosure *p );
20 // Precesses a closure 'c' being destroyed whose size is 'size'.
21 // Make sure that LDV_recordDead() is not invoked on 'inherently used' closures
22 // such as TSO; they should not be involved in computing dragNew or voidNew.
24 // Note: ldvTime is 0 if LDV profiling is turned off.
25 // ldvTime is > 0 if LDV profiling is turned on.
26 // size does not include StgProfHeader.
28 // Even though ldvTime is checked in both LdvCensusForDead() and
29 // LdvCensusKillAll(), we still need to make sure that ldvTime is > 0 because
30 // LDV_recordDead() may be called from elsewhere in the runtime system. E.g.,
31 // when a thunk is replaced by an indirection object.
34 LDV_recordDead( StgClosure *c, nat size )
36 if (ldvTime > 0 && closureSatisfiesConstraints(c)) {
38 size -= sizeofW(StgProfHeader);
39 if ((LDVW((c)) & LDV_STATE_MASK) == LDV_STATE_CREATE) {
40 t = (LDVW((c)) & LDV_CREATE_MASK) >> LDV_SHIFT;
42 gi[t].voidNew += (int)size;
43 gi[ldvTime].voidNew -= (int)size;
46 t = LDVW((c)) & LDV_LAST_MASK;
47 if (t + 1 < ldvTime) {
48 gi[t + 1].dragNew += size;
49 gi[ldvTime].dragNew -= size;
55 extern void initLdvProfiling ( void );
56 extern void endLdvProfiling ( void );
57 extern void LdvCensus ( void );
58 extern void LdvCensusForDead ( nat );
59 extern void LdvCensusKillAll ( void );
61 #endif /* PROFILING */
63 #endif /* LDVPROFILE_H */