rts: Kill PAPI support
[ghc.git] / includes / rts / Flags.h
1 /* -----------------------------------------------------------------------------
2 *
3 * (c) The GHC Team, 1998-2009
4 *
5 * Datatypes that holds the command-line flag settings.
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_FLAGS_H
15 #define RTS_FLAGS_H
16
17 #include <stdio.h>
18
19 /* For defaults, see the @initRtsFlagsDefaults@ routine. */
20
21 /* Note [Synchronization of flags and base APIs]
22 *
23 * We provide accessors to RTS flags in base. (GHC.RTS module)
24 * The API should be updated whenever RTS flags are modified.
25 */
26
27 /* See Note [Synchronization of flags and base APIs] */
28 typedef struct _GC_FLAGS {
29 FILE *statsFile;
30 nat giveStats;
31 #define NO_GC_STATS 0
32 #define COLLECT_GC_STATS 1
33 #define ONELINE_GC_STATS 2
34 #define SUMMARY_GC_STATS 3
35 #define VERBOSE_GC_STATS 4
36
37 nat maxStkSize; /* in *words* */
38 nat initialStkSize; /* in *words* */
39 nat stkChunkSize; /* in *words* */
40 nat stkChunkBufferSize; /* in *words* */
41
42 nat maxHeapSize; /* in *blocks* */
43 nat minAllocAreaSize; /* in *blocks* */
44 nat nurseryChunkSize; /* in *blocks* */
45 nat minOldGenSize; /* in *blocks* */
46 nat heapSizeSuggestion; /* in *blocks* */
47 rtsBool heapSizeSuggestionAuto;
48 double oldGenFactor;
49 double pcFreeHeap;
50
51 nat generations;
52 nat steps;
53 rtsBool squeezeUpdFrames;
54
55 rtsBool compact; /* True <=> "compact all the time" */
56 double compactThreshold;
57
58 rtsBool sweep; /* use "mostly mark-sweep" instead of copying
59 * for the oldest generation */
60 rtsBool ringBell;
61 rtsBool frontpanel;
62
63 Time idleGCDelayTime; /* units: TIME_RESOLUTION */
64 rtsBool doIdleGC;
65
66 StgWord heapBase; /* address to ask the OS for memory */
67
68 StgWord allocLimitGrace; /* units: *blocks*
69 * After an AllocationLimitExceeded
70 * exception has been raised, how much
71 * extra space is given to the thread
72 * to handle the exception before we
73 * raise it again.
74 */
75 } GC_FLAGS;
76
77 /* See Note [Synchronization of flags and base APIs] */
78 typedef struct _DEBUG_FLAGS {
79 /* flags to control debugging output & extra checking in various subsystems */
80 rtsBool scheduler; /* 's' */
81 rtsBool interpreter; /* 'i' */
82 rtsBool weak; /* 'w' */
83 rtsBool gccafs; /* 'G' */
84 rtsBool gc; /* 'g' */
85 rtsBool block_alloc; /* 'b' */
86 rtsBool sanity; /* 'S' warning: might be expensive! */
87 rtsBool stable; /* 't' */
88 rtsBool prof; /* 'p' */
89 rtsBool linker; /* 'l' the object linker */
90 rtsBool apply; /* 'a' */
91 rtsBool stm; /* 'm' */
92 rtsBool squeeze; /* 'z' stack squeezing & lazy blackholing */
93 rtsBool hpc; /* 'c' coverage */
94 rtsBool sparks; /* 'r' */
95 } DEBUG_FLAGS;
96
97 /* See Note [Synchronization of flags and base APIs] */
98 typedef struct _COST_CENTRE_FLAGS {
99 nat doCostCentres;
100 # define COST_CENTRES_NONE 0
101 # define COST_CENTRES_SUMMARY 1
102 # define COST_CENTRES_VERBOSE 2 /* incl. serial time profile */
103 # define COST_CENTRES_ALL 3
104 # define COST_CENTRES_XML 4
105
106 int profilerTicks; /* derived */
107 int msecsPerTick; /* derived */
108 } COST_CENTRE_FLAGS;
109
110 /* See Note [Synchronization of flags and base APIs] */
111 typedef struct _PROFILING_FLAGS {
112 nat doHeapProfile;
113 # define NO_HEAP_PROFILING 0 /* N.B. Used as indexes into arrays */
114 # define HEAP_BY_CCS 1
115 # define HEAP_BY_MOD 2
116 # define HEAP_BY_DESCR 4
117 # define HEAP_BY_TYPE 5
118 # define HEAP_BY_RETAINER 6
119 # define HEAP_BY_LDV 7
120
121 # define HEAP_BY_CLOSURE_TYPE 8
122
123 Time heapProfileInterval; /* time between samples */
124 nat heapProfileIntervalTicks; /* ticks between samples (derived) */
125 rtsBool includeTSOs;
126
127
128 rtsBool showCCSOnException;
129
130 nat maxRetainerSetSize;
131
132 nat ccsLength;
133
134 char* modSelector;
135 char* descrSelector;
136 char* typeSelector;
137 char* ccSelector;
138 char* ccsSelector;
139 char* retainerSelector;
140 char* bioSelector;
141
142 } PROFILING_FLAGS;
143
144 #define TRACE_NONE 0
145 #define TRACE_EVENTLOG 1
146 #define TRACE_STDERR 2
147
148 /* See Note [Synchronization of flags and base APIs] */
149 typedef struct _TRACE_FLAGS {
150 int tracing;
151 rtsBool timestamp; /* show timestamp in stderr output */
152 rtsBool scheduler; /* trace scheduler events */
153 rtsBool gc; /* trace GC events */
154 rtsBool sparks_sampled; /* trace spark events by a sampled method */
155 rtsBool sparks_full; /* trace spark events 100% accurately */
156 rtsBool user; /* trace user events (emitted from Haskell code) */
157 } TRACE_FLAGS;
158
159 /* See Note [Synchronization of flags and base APIs] */
160 typedef struct _CONCURRENT_FLAGS {
161 Time ctxtSwitchTime; /* units: TIME_RESOLUTION */
162 int ctxtSwitchTicks; /* derived */
163 } CONCURRENT_FLAGS;
164
165 /*
166 * The tickInterval is the time interval between "ticks", ie.
167 * timer signals (see Timer.{c,h}). It is the frequency at
168 * which we sample CCCS for profiling.
169 *
170 * It is changed by the +RTS -V<secs> flag.
171 */
172 #define DEFAULT_TICK_INTERVAL USToTime(10000)
173
174 /* See Note [Synchronization of flags and base APIs] */
175 typedef struct _MISC_FLAGS {
176 Time tickInterval; /* units: TIME_RESOLUTION */
177 rtsBool install_signal_handlers;
178 rtsBool machineReadable;
179 StgWord linkerMemBase; /* address to ask the OS for memory
180 * for the linker, NULL ==> off */
181 } MISC_FLAGS;
182
183 #ifdef THREADED_RTS
184 /* See Note [Synchronization of flags and base APIs] */
185 typedef struct _PAR_FLAGS {
186 nat nNodes; /* number of threads to run simultaneously */
187 rtsBool migrate; /* migrate threads between capabilities */
188 nat maxLocalSparks;
189 rtsBool parGcEnabled; /* enable parallel GC */
190 nat parGcGen; /* do parallel GC in this generation
191 * and higher only */
192 rtsBool parGcLoadBalancingEnabled;
193 /* enable load-balancing in the
194 * parallel GC */
195 nat parGcLoadBalancingGen;
196 /* do load-balancing in this
197 * generation and higher only */
198
199 nat parGcNoSyncWithIdle;
200 /* if a Capability has been idle for
201 * this many GCs, do not try to wake
202 * it up when doing a
203 * non-load-balancing parallel GC.
204 * (zero disables) */
205
206 rtsBool setAffinity; /* force thread affinity with CPUs */
207 } PAR_FLAGS;
208 #endif /* THREADED_RTS */
209
210 /* See Note [Synchronization of flags and base APIs] */
211 typedef struct _TICKY_FLAGS {
212 rtsBool showTickyStats;
213 FILE *tickyFile;
214 } TICKY_FLAGS;
215
216 /* Put them together: */
217
218 /* See Note [Synchronization of flags and base APIs] */
219 typedef struct _RTS_FLAGS {
220 /* The first portion of RTS_FLAGS is invariant. */
221 GC_FLAGS GcFlags;
222 CONCURRENT_FLAGS ConcFlags;
223 MISC_FLAGS MiscFlags;
224 DEBUG_FLAGS DebugFlags;
225 COST_CENTRE_FLAGS CcFlags;
226 PROFILING_FLAGS ProfFlags;
227 TRACE_FLAGS TraceFlags;
228 TICKY_FLAGS TickyFlags;
229
230 #if defined(THREADED_RTS)
231 PAR_FLAGS ParFlags;
232 #endif
233 } RTS_FLAGS;
234
235 #ifdef COMPILING_RTS_MAIN
236 extern DLLIMPORT RTS_FLAGS RtsFlags;
237 #elif IN_STG_CODE
238 /* Hack because the C code generator can't generate '&label'. */
239 extern RTS_FLAGS RtsFlags[];
240 #else
241 extern RTS_FLAGS RtsFlags;
242 #endif
243
244 /*
245 * The printf formats are here, so we are less likely to make
246 * overly-long filenames (with disastrous results). No more than 128
247 * chars, please!
248 */
249
250 #define STATS_FILENAME_MAXLEN 128
251
252 #define GR_FILENAME_FMT "%0.124s.gr"
253 #define GR_FILENAME_FMT_GUM "%0.120s.%03d.%s"
254 #define HP_FILENAME_FMT "%0.124s.hp"
255 #define LIFE_FILENAME_FMT "%0.122s.life"
256 #define PROF_FILENAME_FMT "%0.122s.prof"
257 #define PROF_FILENAME_FMT_GUM "%0.118s.%03d.prof"
258 #define QP_FILENAME_FMT "%0.124s.qp"
259 #define STAT_FILENAME_FMT "%0.122s.stat"
260 #define TICKY_FILENAME_FMT "%0.121s.ticky"
261 #define TIME_FILENAME_FMT "%0.122s.time"
262 #define TIME_FILENAME_FMT_GUM "%0.118s.%03d.time"
263
264 /* an "int" so as to match normal "argc" */
265 /* Now defined in Stg.h (lib/std/cbits need these too.)
266 extern int prog_argc;
267 extern char **prog_argv;
268 */
269 extern int rts_argc; /* ditto */
270 extern char **rts_argv;
271
272 #endif /* RTS_FLAGS_H */