summaryrefslogtreecommitdiff
path: root/includes/rts/prof/LDV.h
blob: 77d873cceb0923c7df0f65664bc1ab81c4eb01e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* -----------------------------------------------------------------------------
 *
 * (c) The University of Glasgow, 2009
 *
 * Lag/Drag/Void profiling.
 *
 * Do not #include this file directly: #include "Rts.h" instead.
 *
 * To understand the structure of the RTS headers, see the wiki:
 *   http://hackage.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes
 *
 * ---------------------------------------------------------------------------*/

#ifndef RTS_PROF_LDV_H
#define RTS_PROF_LDV_H

#ifdef PROFILING

/* retrieves the LDV word from closure c */
#define LDVW(c)                 (((StgClosure *)(c))->header.prof.hp.ldvw)

/*
 * Stores the creation time for closure c. 
 * This macro is called at the very moment of closure creation.
 *
 * NOTE: this initializes LDVW(c) to zero, which ensures that there
 * is no conflict between retainer profiling and LDV profiling,
 * because retainer profiling also expects LDVW(c) to be initialised
 * to zero.
 */

#ifdef CMINUSMINUS

#define LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC(c) \
  foreign "C" LDV_recordDead_FILL_SLOP_DYNAMIC(c "ptr")

#else

#define LDV_RECORD_CREATE(c)   \
  LDVW((c)) = ((StgWord)RTS_DEREF(era) << LDV_SHIFT) | LDV_STATE_CREATE

void LDV_recordDead_FILL_SLOP_DYNAMIC( StgClosure *p );

#define LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC(c) \
  LDV_recordDead_FILL_SLOP_DYNAMIC(c)

#endif

#else  /* !PROFILING */

#define LDV_RECORD_CREATE(c)   /* nothing */
#define LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC(c)  /* nothing */

#endif /* PROFILING */

#endif /* STGLDVPROF_H */