7d6f9ff409a190ea398f0f2cf730b7cadf949bc1
[ghc.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://ghc.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 #else
35
36 #define LDV_RECORD_CREATE(c) \
37 LDVW((c)) = ((StgWord)RTS_DEREF(era) << LDV_SHIFT) | LDV_STATE_CREATE
38
39 #endif
40
41 #else /* !PROFILING */
42
43 #define LDV_RECORD_CREATE(c) /* nothing */
44
45 #endif /* PROFILING */
46
47 #endif /* STGLDVPROF_H */