Tidy up file headers and copyrights; point to the wiki for docs
[ghc-hetmet.git] / includes / rts / prof / LDV.h
1 /* -----------------------------------------------------------------------------
2  *
3  * (c) The University of Glasgow, 2009
4  *
5  * Lag/Drag/Void profiling.
6  *
7  * Do not #include this file directly: #include "Rts.h" instead.
8  *
9  * To understand the structure of the RTS headers, see the wiki:
10  *   http://hackage.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes
11  *
12  * ---------------------------------------------------------------------------*/
13
14 #ifndef RTS_PROF_LDV_H
15 #define RTS_PROF_LDV_H
16
17 #ifdef PROFILING
18
19 /* retrieves the LDV word from closure c */
20 #define LDVW(c)                 (((StgClosure *)(c))->header.prof.hp.ldvw)
21
22 /*
23  * Stores the creation time for closure c. 
24  * This macro is called at the very moment of closure creation.
25  *
26  * NOTE: this initializes LDVW(c) to zero, which ensures that there
27  * is no conflict between retainer profiling and LDV profiling,
28  * because retainer profiling also expects LDVW(c) to be initialised
29  * to zero.
30  */
31
32 #ifdef CMINUSMINUS
33
34 #define LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC(c) \
35   foreign "C" LDV_recordDead_FILL_SLOP_DYNAMIC(c "ptr")
36
37 #else
38
39 #define LDV_RECORD_CREATE(c)   \
40   LDVW((c)) = ((StgWord)RTS_DEREF(era) << LDV_SHIFT) | LDV_STATE_CREATE
41
42 void LDV_recordDead_FILL_SLOP_DYNAMIC( StgClosure *p );
43
44 #define LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC(c) \
45   LDV_recordDead_FILL_SLOP_DYNAMIC(c)
46
47 #endif
48
49 #else  /* !PROFILING */
50
51 #define LDV_RECORD_CREATE(c)   /* nothing */
52 #define LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC(c)  /* nothing */
53
54 #endif /* PROFILING */
55
56 #endif /* STGLDVPROF_H */