1 /* -----------------------------------------------------------------------------
3 * (c) The GHC Team, 1998-1999
5 * Datatypes that holds the command-line flag settings.
7 * ---------------------------------------------------------------------------*/
14 /* For defaults, see the @initRtsFlagsDefaults@ routine. */
20 #define COLLECT_GC_STATS 1
21 #define ONELINE_GC_STATS 2
22 #define SUMMARY_GC_STATS 3
23 #define VERBOSE_GC_STATS 4
25 nat maxStkSize; /* in *words* */
26 nat initialStkSize; /* in *words* */
28 nat maxHeapSize; /* in *blocks* */
29 nat minAllocAreaSize; /* in *blocks* */
30 nat minOldGenSize; /* in *blocks* */
31 nat heapSizeSuggestion; /* in *blocks* */
37 rtsBool squeezeUpdFrames;
39 rtsBool compact; /* True <=> "compact all the time" */
40 double compactThreshold;
42 rtsBool sweep; /* use "mostly mark-sweep" instead of copying
43 * for the oldest generation */
47 int idleGCDelayTime; /* in milliseconds */
49 StgWord heapBase; /* address to ask the OS for memory */
53 /* flags to control debugging output & extra checking in various subsystems */
54 rtsBool scheduler; /* 's' */
55 rtsBool interpreter; /* 'i' */
56 rtsBool weak; /* 'w' */
57 rtsBool gccafs; /* 'G' */
59 rtsBool block_alloc; /* 'b' */
60 rtsBool sanity; /* 'S' warning: might be expensive! */
61 rtsBool stable; /* 't' */
62 rtsBool prof; /* 'p' */
63 rtsBool gran; /* 'r' */
64 rtsBool par; /* 'P' */
65 rtsBool linker; /* 'l' the object linker */
66 rtsBool apply; /* 'a' */
67 rtsBool stm; /* 'm' */
68 rtsBool squeeze; /* 'z' stack squeezing & lazy blackholing */
69 rtsBool hpc; /* 'c' coverage */
72 struct COST_CENTRE_FLAGS {
73 unsigned int doCostCentres;
74 # define COST_CENTRES_SUMMARY 1
75 # define COST_CENTRES_VERBOSE 2 /* incl. serial time profile */
76 # define COST_CENTRES_ALL 3
77 # define COST_CENTRES_XML 4
79 int profilerTicks; /* derived */
80 int msecsPerTick; /* derived */
83 struct PROFILING_FLAGS {
84 unsigned int doHeapProfile;
85 # define NO_HEAP_PROFILING 0 /* N.B. Used as indexes into arrays */
86 # define HEAP_BY_CCS 1
87 # define HEAP_BY_MOD 2
88 # define HEAP_BY_DESCR 4
89 # define HEAP_BY_TYPE 5
90 # define HEAP_BY_RETAINER 6
91 # define HEAP_BY_LDV 7
93 # define HEAP_BY_CLOSURE_TYPE 8
95 nat profileInterval; /* delta between samples (in ms) */
96 nat profileIntervalTicks; /* delta between samples (in 'ticks') */
100 rtsBool showCCSOnException;
102 nat maxRetainerSetSize;
111 char* retainerSelector;
116 struct CONCURRENT_FLAGS {
117 int ctxtSwitchTime; /* in milliseconds */
118 int ctxtSwitchTicks; /* derived */
122 int tickInterval; /* in milliseconds */
123 rtsBool install_signal_handlers;
124 StgWord linkerMemBase; /* address to ask the OS for memory
125 * for the linker, NULL ==> off */
129 /* currently the same as GRAN_STATS_FLAGS */
130 struct PAR_STATS_FLAGS {
131 rtsBool Full; /* Full .gr profile (rtsTrue) or only END events? */
132 rtsBool Suppressed; /* No .gr profile at all */
133 rtsBool Binary; /* Binary profile? (not yet implemented) */
134 rtsBool Sparks; /* Info on sparks in profile? */
135 rtsBool Heap; /* Info on heap allocs in profile? */
136 rtsBool NewLogfile; /* Use new log-file format? (not yet implemented) */
137 rtsBool Global; /* Global statistics? (printed on shutdown; no log file) */
140 struct PAR_DEBUG_FLAGS {
141 /* flags to control debugging output in various subsystems */
142 rtsBool verbose : 1; /* 1 */
143 rtsBool bq : 1; /* 2 */
144 rtsBool schedule : 1; /* 4 */
145 rtsBool free : 1; /* 8 */
146 rtsBool resume : 1; /* 16 */
147 rtsBool weight : 1; /* 32 */
148 rtsBool fetch : 1; /* 64 */
149 rtsBool fish : 1; /* 128 */
150 rtsBool tables : 1; /* 256 */
151 rtsBool packet : 1; /* 512 */
152 rtsBool pack : 1; /* 1024 */
153 rtsBool paranoia : 1; /* 2048 */
156 #define MAX_PAR_DEBUG_OPTION 11
157 #define PAR_DEBUG_MASK(n) ((nat)(ldexp(1,n)))
158 #define MAX_PAR_DEBUG_MASK ((nat)(ldexp(1,(MAX_PAR_DEBUG_OPTION+1))-1))
161 struct PAR_STATS_FLAGS ParStats; /* profile and stats output */
162 struct PAR_DEBUG_FLAGS Debug; /* debugging options */
163 rtsBool outputDisabled; /* Disable output for performance purposes */
164 rtsBool doFairScheduling; /* Fair-ish scheduling (round robin; no time-slices) */
166 nat thunksToPack; /* number of thunks in packet + 1 */
167 nat globalising; /* globalisation scheme */
168 nat maxLocalSparks; /* spark pool size */
169 nat maxThreads; /* thread pool size */
170 nat maxFishes; /* max number of active fishes */
171 rtsTime fishDelay; /* delay before sending a new fish */
178 nat nNodes; /* number of threads to run simultaneously */
179 rtsBool migrate; /* migrate threads between capabilities */
180 rtsBool wakeupMigrate; /* migrate a thread on wakeup */
181 unsigned int maxLocalSparks;
182 rtsBool parGcEnabled; /* enable parallel GC */
183 rtsBool parGcGen; /* do parallel GC in this generation
186 #endif /* THREADED_RTS */
189 struct GRAN_STATS_FLAGS {
190 rtsBool Full; /* Full .gr profile (rtsTrue) or only END events? */
191 rtsBool Suppressed; /* No .gr profile at all */
192 rtsBool Binary; /* Binary profile? (not yet implemented) */
193 rtsBool Sparks; /* Info on sparks in profile? */
194 rtsBool Heap; /* Info on heap allocs in profile? */
195 rtsBool NewLogfile; /* Use new log-file format? (not yet implemented) */
196 rtsBool Global; /* Global statistics? (printed on shutdown; no log file) */
199 struct GRAN_COST_FLAGS {
200 /* Communication Cost Variables -- set in main program */
201 nat latency; /* Latency for single packet */
202 nat additional_latency; /* Latency for additional packets */
204 nat lunblocktime; /* Time for local unblock */
205 nat gunblocktime; /* Time for global unblock */
206 nat mpacktime; /* Cost of creating a packet */
207 nat munpacktime; /* Cost of receiving a packet */
208 nat mtidytime; /* Cost of cleaning up after send */
210 nat threadcreatetime; /* Thread creation costs */
211 nat threadqueuetime; /* Cost of adding a thread to the running/runnable queue */
212 nat threaddescheduletime; /* Cost of descheduling a thread */
213 nat threadscheduletime; /* Cost of scheduling a thread */
214 nat threadcontextswitchtime; /* Cost of context switch */
216 /* Instruction Costs */
217 nat arith_cost; /* arithmetic instructions (+,i,< etc) */
218 nat branch_cost; /* branch instructions */
219 nat load_cost; /* load into register */
220 nat store_cost; /* store into memory */
221 nat float_cost; /* floating point operations */
223 nat heapalloc_cost; /* heap allocation costs */
225 /* Overhead for granularity control mechanisms */
226 /* overhead per elem of spark queue */
227 nat pri_spark_overhead;
228 /* overhead per elem of thread queue */
229 nat pri_sched_overhead;
232 struct GRAN_DEBUG_FLAGS {
233 /* flags to control debugging output in various subsystems */
234 rtsBool event_trace : 1; /* 1 */
235 rtsBool event_stats : 1; /* 2 */
236 rtsBool bq : 1; /* 4 */
237 rtsBool pack : 1; /* 8 */
238 rtsBool checkSparkQ : 1; /* 16 */
239 rtsBool thunkStealing : 1; /* 32 */
240 rtsBool randomSteal : 1; /* 64 */
241 rtsBool findWork : 1; /* 128 */
242 rtsBool unused : 1; /* 256 */
243 rtsBool pri : 1; /* 512 */
244 rtsBool checkLight : 1; /* 1024 */
245 rtsBool sortedQ : 1; /* 2048 */
246 rtsBool blockOnFetch : 1; /* 4096 */
247 rtsBool packBuffer : 1; /* 8192 */
248 rtsBool blockOnFetch_sanity : 1; /* 16384 */
251 #define MAX_GRAN_DEBUG_OPTION 14
252 #define GRAN_DEBUG_MASK(n) ((nat)(ldexp(1,n)))
253 #define MAX_GRAN_DEBUG_MASK ((nat)(ldexp(1,(MAX_GRAN_DEBUG_OPTION+1))-1))
256 struct GRAN_STATS_FLAGS GranSimStats; /* profile and stats output */
257 struct GRAN_COST_FLAGS Costs; /* cost metric for simulation */
258 struct GRAN_DEBUG_FLAGS Debug; /* debugging options */
260 nat maxThreads; /* ToDo: share with THREADED_RTS and GUM */
261 /* rtsBool labelling; */
263 nat packBufferSize_internal;
265 PEs proc; /* number of processors */
266 rtsBool Fishing; /* Simulate GUM style fishing mechanism? */
267 nat maxFishes; /* max number of spark or thread steals */
268 rtsTime time_slice; /* max time slice of one reduction thread */
270 /* GrAnSim-Light: This version puts no bound on the number of
271 processors but in exchange doesn't model communication costs
272 (all communication is 0 cost). Mainly intended to show maximal
273 degree of parallelism in the program (*not* to simulate the
274 execution on a real machine). */
278 rtsBool DoFairSchedule ; /* fair scheduling alg? default: unfair */
279 rtsBool DoAsyncFetch; /* async. communication? */
280 rtsBool DoStealThreadsFirst; /* prefer threads over sparks when stealing */
281 rtsBool DoAlwaysCreateThreads; /* eager thread creation */
282 rtsBool DoBulkFetching; /* bulk fetching */
283 rtsBool DoThreadMigration; /* allow to move threads */
284 nat FetchStrategy; /* what to do when waiting for data */
285 rtsBool PreferSparksOfLocalNodes; /* prefer local over global sparks */
286 rtsBool DoPrioritySparking; /* sparks sorted by priorities */
287 rtsBool DoPriorityScheduling; /* threads sorted by priorities */
288 nat SparkPriority; /* threshold for cut-off mechanism */
290 rtsBool RandomPriorities;
291 rtsBool InversePriorities;
292 rtsBool IgnorePriorities;
293 nat ThunksToPack; /* number of thunks in packet + 1 */
294 rtsBool RandomSteal; /* steal spark/thread from random proc */
295 rtsBool NoForward; /* no forwarding of fetch messages */
297 /* unsigned int debug; */
298 /* rtsBool event_trace; */
299 /* rtsBool event_trace_all; */
304 rtsBool showTickyStats;
309 rtsBool sched; /* trace scheduler events for profiling */
310 rtsBool gc; /* trace GC events */
311 rtsBool timestamp; /* add timestamps to traces */
315 #define MAX_PAPI_USER_EVENTS 8
318 nat eventType; /* The type of events to count */
320 char * userEvents[MAX_PAPI_USER_EVENTS];
323 #define PAPI_FLAG_CACHE_L1 1
324 #define PAPI_FLAG_CACHE_L2 2
325 #define PAPI_FLAG_BRANCH 3
326 #define PAPI_FLAG_STALLS 4
327 #define PAPI_FLAG_CB_EVENTS 5
328 #define PAPI_USER_EVENTS 6
332 /* Put them together: */
334 typedef struct _RTS_FLAGS {
335 /* The first portion of RTS_FLAGS is invariant. */
336 struct GC_FLAGS GcFlags;
337 struct CONCURRENT_FLAGS ConcFlags;
338 struct MISC_FLAGS MiscFlags;
339 struct DEBUG_FLAGS DebugFlags;
340 struct COST_CENTRE_FLAGS CcFlags;
341 struct PROFILING_FLAGS ProfFlags;
342 struct TICKY_FLAGS TickyFlags;
343 struct TRACE_FLAGS TraceFlags;
345 #if defined(THREADED_RTS) || defined(PAR)
346 struct PAR_FLAGS ParFlags;
349 struct GRAN_FLAGS GranFlags;
352 struct PAPI_FLAGS PapiFlags;
356 #ifdef COMPILING_RTS_MAIN
357 extern DLLIMPORT RTS_FLAGS RtsFlags;
359 /* Hack because the C code generator can't generate '&label'. */
360 extern RTS_FLAGS RtsFlags[];
362 extern RTS_FLAGS RtsFlags;
365 /* Routines that operate-on/to-do-with RTS flags: */
367 extern void initRtsFlagsDefaults(void);
368 extern void setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[]);
369 extern void setProgName(char *argv[]);
373 * The printf formats are here, so we are less likely to make
374 * overly-long filenames (with disastrous results). No more than 128
378 #define STATS_FILENAME_MAXLEN 128
380 #define GR_FILENAME_FMT "%0.124s.gr"
381 #define GR_FILENAME_FMT_GUM "%0.120s.%03d.%s"
382 #define HP_FILENAME_FMT "%0.124s.hp"
383 #define LIFE_FILENAME_FMT "%0.122s.life"
384 #define PROF_FILENAME_FMT "%0.122s.prof"
385 #define PROF_FILENAME_FMT_GUM "%0.118s.%03d.prof"
386 #define QP_FILENAME_FMT "%0.124s.qp"
387 #define STAT_FILENAME_FMT "%0.122s.stat"
388 #define TICKY_FILENAME_FMT "%0.121s.ticky"
389 #define TIME_FILENAME_FMT "%0.122s.time"
390 #define TIME_FILENAME_FMT_GUM "%0.118s.%03d.time"
392 /* an "int" so as to match normal "argc" */
393 /* Now defined in Stg.h (lib/std/cbits need these too.)
394 extern int prog_argc;
395 extern char **prog_argv;
397 extern int rts_argc; /* ditto */
398 extern char *rts_argv[];
400 #endif /* RTSFLAGS_H */