1 /* -----------------------------------------------------------------------------
3 * (c) The GHC Team, 1998-2009
5 * Datatypes that holds the command-line flag settings.
7 * Do not #include this file directly: #include "Rts.h" instead.
9 * To understand the structure of the RTS headers, see the wiki:
10 * http://hackage.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes
12 * ---------------------------------------------------------------------------*/
19 /* For defaults, see the @initRtsFlagsDefaults@ routine. */
25 #define COLLECT_GC_STATS 1
26 #define ONELINE_GC_STATS 2
27 #define SUMMARY_GC_STATS 3
28 #define VERBOSE_GC_STATS 4
30 nat maxStkSize; /* in *words* */
31 nat initialStkSize; /* in *words* */
32 nat stkChunkSize; /* in *words* */
33 nat stkChunkBufferSize; /* in *words* */
35 nat maxHeapSize; /* in *blocks* */
36 nat minAllocAreaSize; /* in *blocks* */
37 nat minOldGenSize; /* in *blocks* */
38 nat heapSizeSuggestion; /* in *blocks* */
39 rtsBool heapSizeSuggestionAuto;
45 rtsBool squeezeUpdFrames;
47 rtsBool compact; /* True <=> "compact all the time" */
48 double compactThreshold;
50 rtsBool sweep; /* use "mostly mark-sweep" instead of copying
51 * for the oldest generation */
55 int idleGCDelayTime; /* in milliseconds */
57 StgWord heapBase; /* address to ask the OS for memory */
61 /* flags to control debugging output & extra checking in various subsystems */
62 rtsBool scheduler; /* 's' */
63 rtsBool interpreter; /* 'i' */
64 rtsBool weak; /* 'w' */
65 rtsBool gccafs; /* 'G' */
67 rtsBool block_alloc; /* 'b' */
68 rtsBool sanity; /* 'S' warning: might be expensive! */
69 rtsBool stable; /* 't' */
70 rtsBool prof; /* 'p' */
71 rtsBool linker; /* 'l' the object linker */
72 rtsBool apply; /* 'a' */
73 rtsBool stm; /* 'm' */
74 rtsBool squeeze; /* 'z' stack squeezing & lazy blackholing */
75 rtsBool hpc; /* 'c' coverage */
76 rtsBool sparks; /* 'r' */
79 struct COST_CENTRE_FLAGS {
80 unsigned int doCostCentres;
81 # define COST_CENTRES_SUMMARY 1
82 # define COST_CENTRES_VERBOSE 2 /* incl. serial time profile */
83 # define COST_CENTRES_ALL 3
84 # define COST_CENTRES_XML 4
86 int profilerTicks; /* derived */
87 int msecsPerTick; /* derived */
90 struct PROFILING_FLAGS {
91 unsigned int doHeapProfile;
92 # define NO_HEAP_PROFILING 0 /* N.B. Used as indexes into arrays */
93 # define HEAP_BY_CCS 1
94 # define HEAP_BY_MOD 2
95 # define HEAP_BY_DESCR 4
96 # define HEAP_BY_TYPE 5
97 # define HEAP_BY_RETAINER 6
98 # define HEAP_BY_LDV 7
100 # define HEAP_BY_CLOSURE_TYPE 8
102 nat profileInterval; /* delta between samples (in ms) */
103 nat profileIntervalTicks; /* delta between samples (in 'ticks') */
107 rtsBool showCCSOnException;
109 nat maxRetainerSetSize;
118 char* retainerSelector;
124 #define TRACE_EVENTLOG 1
125 #define TRACE_STDERR 2
129 rtsBool timestamp; /* show timestamp in stderr output */
131 rtsBool scheduler; /* trace scheduler events */
134 struct CONCURRENT_FLAGS {
135 int ctxtSwitchTime; /* in milliseconds */
136 int ctxtSwitchTicks; /* derived */
140 int tickInterval; /* in milliseconds */
141 rtsBool install_signal_handlers;
142 rtsBool machineReadable;
143 StgWord linkerMemBase; /* address to ask the OS for memory
144 * for the linker, NULL ==> off */
149 nat nNodes; /* number of threads to run simultaneously */
150 rtsBool migrate; /* migrate threads between capabilities */
151 unsigned int maxLocalSparks;
152 rtsBool parGcEnabled; /* enable parallel GC */
153 unsigned int parGcGen; /* do parallel GC in this generation
155 rtsBool parGcLoadBalancingEnabled;
156 /* enable load-balancing in the
158 unsigned int parGcLoadBalancingGen;
159 /* do load-balancing in this
160 * generation and higher only */
161 rtsBool setAffinity; /* force thread affinity with CPUs */
163 #endif /* THREADED_RTS */
166 rtsBool showTickyStats;
171 #define MAX_PAPI_USER_EVENTS 8
174 nat eventType; /* The type of events to count */
176 char * userEvents[MAX_PAPI_USER_EVENTS];
177 /* Allow user to enter either PAPI preset or native events */
178 nat userEventsKind[MAX_PAPI_USER_EVENTS];
181 #define PAPI_FLAG_CACHE_L1 1
182 #define PAPI_FLAG_CACHE_L2 2
183 #define PAPI_FLAG_BRANCH 3
184 #define PAPI_FLAG_STALLS 4
185 #define PAPI_FLAG_CB_EVENTS 5
186 #define PAPI_USER_EVENTS 6
187 #define PAPI_PRESET_EVENT_KIND 0
188 #define PAPI_NATIVE_EVENT_KIND 1
192 /* Put them together: */
194 typedef struct _RTS_FLAGS {
195 /* The first portion of RTS_FLAGS is invariant. */
196 struct GC_FLAGS GcFlags;
197 struct CONCURRENT_FLAGS ConcFlags;
198 struct MISC_FLAGS MiscFlags;
199 struct DEBUG_FLAGS DebugFlags;
200 struct COST_CENTRE_FLAGS CcFlags;
201 struct PROFILING_FLAGS ProfFlags;
202 struct TRACE_FLAGS TraceFlags;
203 struct TICKY_FLAGS TickyFlags;
205 #if defined(THREADED_RTS)
206 struct PAR_FLAGS ParFlags;
209 struct PAPI_FLAGS PapiFlags;
213 #ifdef COMPILING_RTS_MAIN
214 extern DLLIMPORT RTS_FLAGS RtsFlags;
216 /* Hack because the C code generator can't generate '&label'. */
217 extern RTS_FLAGS RtsFlags[];
219 extern RTS_FLAGS RtsFlags;
223 * The printf formats are here, so we are less likely to make
224 * overly-long filenames (with disastrous results). No more than 128
228 #define STATS_FILENAME_MAXLEN 128
230 #define GR_FILENAME_FMT "%0.124s.gr"
231 #define GR_FILENAME_FMT_GUM "%0.120s.%03d.%s"
232 #define HP_FILENAME_FMT "%0.124s.hp"
233 #define LIFE_FILENAME_FMT "%0.122s.life"
234 #define PROF_FILENAME_FMT "%0.122s.prof"
235 #define PROF_FILENAME_FMT_GUM "%0.118s.%03d.prof"
236 #define QP_FILENAME_FMT "%0.124s.qp"
237 #define STAT_FILENAME_FMT "%0.122s.stat"
238 #define TICKY_FILENAME_FMT "%0.121s.ticky"
239 #define TIME_FILENAME_FMT "%0.122s.time"
240 #define TIME_FILENAME_FMT_GUM "%0.118s.%03d.time"
242 /* an "int" so as to match normal "argc" */
243 /* Now defined in Stg.h (lib/std/cbits need these too.)
244 extern int prog_argc;
245 extern char **prog_argv;
247 extern int rts_argc; /* ditto */
248 extern char *rts_argv[];
250 #endif /* RTS_FLAGS_H */