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;
45 int idleGCDelayTime; /* in milliseconds */
49 /* flags to control debugging output & extra checking in various subsystems */
50 rtsBool scheduler; /* 's' */
51 rtsBool interpreter; /* 'i' */
52 rtsBool weak; /* 'w' */
53 rtsBool gccafs; /* 'G' */
55 rtsBool block_alloc; /* 'b' */
56 rtsBool sanity; /* 'S' warning: might be expensive! */
57 rtsBool stable; /* 't' */
58 rtsBool prof; /* 'p' */
59 rtsBool gran; /* 'r' */
60 rtsBool par; /* 'P' */
61 rtsBool linker; /* 'l' the object linker */
62 rtsBool apply; /* 'a' */
63 rtsBool stm; /* 'm' */
64 rtsBool squeeze; /* 'z' stack squeezing & lazy blackholing */
67 struct COST_CENTRE_FLAGS {
68 unsigned int doCostCentres;
69 # define COST_CENTRES_SUMMARY 1
70 # define COST_CENTRES_VERBOSE 2 /* incl. serial time profile */
71 # define COST_CENTRES_ALL 3
72 # define COST_CENTRES_XML 4
74 int profilerTicks; /* derived */
75 int msecsPerTick; /* derived */
78 struct PROFILING_FLAGS {
79 unsigned int doHeapProfile;
80 # define NO_HEAP_PROFILING 0 /* N.B. Used as indexes into arrays */
81 # define HEAP_BY_CCS 1
82 # define HEAP_BY_MOD 2
83 # define HEAP_BY_DESCR 4
84 # define HEAP_BY_TYPE 5
85 # define HEAP_BY_RETAINER 6
86 # define HEAP_BY_LDV 7
88 # define HEAP_BY_INFOPTR 1 /* DEBUG only */
89 # define HEAP_BY_CLOSURE_TYPE 2 /* DEBUG only */
91 nat profileInterval; /* delta between samples (in ms) */
92 nat profileIntervalTicks; /* delta between samples (in 'ticks') */
96 rtsBool showCCSOnException;
98 nat maxRetainerSetSize;
107 char* retainerSelector;
112 struct CONCURRENT_FLAGS {
113 int ctxtSwitchTime; /* in milliseconds */
114 int ctxtSwitchTicks; /* derived */
118 int tickInterval; /* in milliseconds */
122 /* currently the same as GRAN_STATS_FLAGS */
123 struct PAR_STATS_FLAGS {
124 rtsBool Full; /* Full .gr profile (rtsTrue) or only END events? */
125 rtsBool Suppressed; /* No .gr profile at all */
126 rtsBool Binary; /* Binary profile? (not yet implemented) */
127 rtsBool Sparks; /* Info on sparks in profile? */
128 rtsBool Heap; /* Info on heap allocs in profile? */
129 rtsBool NewLogfile; /* Use new log-file format? (not yet implemented) */
130 rtsBool Global; /* Global statistics? (printed on shutdown; no log file) */
133 struct PAR_DEBUG_FLAGS {
134 /* flags to control debugging output in various subsystems */
135 rtsBool verbose : 1; /* 1 */
136 rtsBool bq : 1; /* 2 */
137 rtsBool schedule : 1; /* 4 */
138 rtsBool free : 1; /* 8 */
139 rtsBool resume : 1; /* 16 */
140 rtsBool weight : 1; /* 32 */
141 rtsBool fetch : 1; /* 64 */
142 rtsBool fish : 1; /* 128 */
143 rtsBool tables : 1; /* 256 */
144 rtsBool packet : 1; /* 512 */
145 rtsBool pack : 1; /* 1024 */
146 rtsBool paranoia : 1; /* 2048 */
149 #define MAX_PAR_DEBUG_OPTION 11
150 #define PAR_DEBUG_MASK(n) ((nat)(ldexp(1,n)))
151 #define MAX_PAR_DEBUG_MASK ((nat)(ldexp(1,(MAX_PAR_DEBUG_OPTION+1))-1))
154 struct PAR_STATS_FLAGS ParStats; /* profile and stats output */
155 struct PAR_DEBUG_FLAGS Debug; /* debugging options */
156 rtsBool outputDisabled; /* Disable output for performance purposes */
157 rtsBool doFairScheduling; /* Fair-ish scheduling (round robin; no time-slices) */
159 nat thunksToPack; /* number of thunks in packet + 1 */
160 nat globalising; /* globalisation scheme */
161 nat maxLocalSparks; /* spark pool size */
162 nat maxThreads; /* thread pool size */
163 nat maxFishes; /* max number of active fishes */
164 rtsTime fishDelay; /* delay before sending a new fish */
171 nat nNodes; /* number of threads to run simultaneously */
172 rtsBool migrate; /* migrate threads between capabilities */
173 rtsBool wakeupMigrate; /* migrate a thread on wakeup */
174 unsigned int maxLocalSparks;
176 #endif /* THREADED_RTS */
179 struct GRAN_STATS_FLAGS {
180 rtsBool Full; /* Full .gr profile (rtsTrue) or only END events? */
181 rtsBool Suppressed; /* No .gr profile at all */
182 rtsBool Binary; /* Binary profile? (not yet implemented) */
183 rtsBool Sparks; /* Info on sparks in profile? */
184 rtsBool Heap; /* Info on heap allocs in profile? */
185 rtsBool NewLogfile; /* Use new log-file format? (not yet implemented) */
186 rtsBool Global; /* Global statistics? (printed on shutdown; no log file) */
189 struct GRAN_COST_FLAGS {
190 /* Communication Cost Variables -- set in main program */
191 nat latency; /* Latency for single packet */
192 nat additional_latency; /* Latency for additional packets */
194 nat lunblocktime; /* Time for local unblock */
195 nat gunblocktime; /* Time for global unblock */
196 nat mpacktime; /* Cost of creating a packet */
197 nat munpacktime; /* Cost of receiving a packet */
198 nat mtidytime; /* Cost of cleaning up after send */
200 nat threadcreatetime; /* Thread creation costs */
201 nat threadqueuetime; /* Cost of adding a thread to the running/runnable queue */
202 nat threaddescheduletime; /* Cost of descheduling a thread */
203 nat threadscheduletime; /* Cost of scheduling a thread */
204 nat threadcontextswitchtime; /* Cost of context switch */
206 /* Instruction Costs */
207 nat arith_cost; /* arithmetic instructions (+,i,< etc) */
208 nat branch_cost; /* branch instructions */
209 nat load_cost; /* load into register */
210 nat store_cost; /* store into memory */
211 nat float_cost; /* floating point operations */
213 nat heapalloc_cost; /* heap allocation costs */
215 /* Overhead for granularity control mechanisms */
216 /* overhead per elem of spark queue */
217 nat pri_spark_overhead;
218 /* overhead per elem of thread queue */
219 nat pri_sched_overhead;
222 struct GRAN_DEBUG_FLAGS {
223 /* flags to control debugging output in various subsystems */
224 rtsBool event_trace : 1; /* 1 */
225 rtsBool event_stats : 1; /* 2 */
226 rtsBool bq : 1; /* 4 */
227 rtsBool pack : 1; /* 8 */
228 rtsBool checkSparkQ : 1; /* 16 */
229 rtsBool thunkStealing : 1; /* 32 */
230 rtsBool randomSteal : 1; /* 64 */
231 rtsBool findWork : 1; /* 128 */
232 rtsBool unused : 1; /* 256 */
233 rtsBool pri : 1; /* 512 */
234 rtsBool checkLight : 1; /* 1024 */
235 rtsBool sortedQ : 1; /* 2048 */
236 rtsBool blockOnFetch : 1; /* 4096 */
237 rtsBool packBuffer : 1; /* 8192 */
238 rtsBool blockOnFetch_sanity : 1; /* 16384 */
241 #define MAX_GRAN_DEBUG_OPTION 14
242 #define GRAN_DEBUG_MASK(n) ((nat)(ldexp(1,n)))
243 #define MAX_GRAN_DEBUG_MASK ((nat)(ldexp(1,(MAX_GRAN_DEBUG_OPTION+1))-1))
246 struct GRAN_STATS_FLAGS GranSimStats; /* profile and stats output */
247 struct GRAN_COST_FLAGS Costs; /* cost metric for simulation */
248 struct GRAN_DEBUG_FLAGS Debug; /* debugging options */
250 nat maxThreads; /* ToDo: share with THREADED_RTS and GUM */
251 /* rtsBool labelling; */
253 nat packBufferSize_internal;
255 PEs proc; /* number of processors */
256 rtsBool Fishing; /* Simulate GUM style fishing mechanism? */
257 nat maxFishes; /* max number of spark or thread steals */
258 rtsTime time_slice; /* max time slice of one reduction thread */
260 /* GrAnSim-Light: This version puts no bound on the number of
261 processors but in exchange doesn't model communication costs
262 (all communication is 0 cost). Mainly intended to show maximal
263 degree of parallelism in the program (*not* to simulate the
264 execution on a real machine). */
268 rtsBool DoFairSchedule ; /* fair scheduling alg? default: unfair */
269 rtsBool DoAsyncFetch; /* async. communication? */
270 rtsBool DoStealThreadsFirst; /* prefer threads over sparks when stealing */
271 rtsBool DoAlwaysCreateThreads; /* eager thread creation */
272 rtsBool DoBulkFetching; /* bulk fetching */
273 rtsBool DoThreadMigration; /* allow to move threads */
274 nat FetchStrategy; /* what to do when waiting for data */
275 rtsBool PreferSparksOfLocalNodes; /* prefer local over global sparks */
276 rtsBool DoPrioritySparking; /* sparks sorted by priorities */
277 rtsBool DoPriorityScheduling; /* threads sorted by priorities */
278 nat SparkPriority; /* threshold for cut-off mechanism */
280 rtsBool RandomPriorities;
281 rtsBool InversePriorities;
282 rtsBool IgnorePriorities;
283 nat ThunksToPack; /* number of thunks in packet + 1 */
284 rtsBool RandomSteal; /* steal spark/thread from random proc */
285 rtsBool NoForward; /* no forwarding of fetch messages */
287 /* unsigned int debug; */
288 /* rtsBool event_trace; */
289 /* rtsBool event_trace_all; */
294 rtsBool showTickyStats;
299 rtsBool sched; /* trace scheduler events for profiling */
300 rtsBool timestamp; /* add timestamps to traces */
303 /* Put them together: */
307 nat eventType; /* The type of events to count */
310 #define PAPI_FLAG_CACHE_L1 1
311 #define PAPI_FLAG_CACHE_L2 2
312 #define PAPI_FLAG_BRANCH 3
313 #define PAPI_FLAG_STALLS 4
317 typedef struct _RTS_FLAGS {
318 /* The first portion of RTS_FLAGS is invariant. */
319 struct GC_FLAGS GcFlags;
320 struct CONCURRENT_FLAGS ConcFlags;
321 struct MISC_FLAGS MiscFlags;
322 struct DEBUG_FLAGS DebugFlags;
323 struct COST_CENTRE_FLAGS CcFlags;
324 struct PROFILING_FLAGS ProfFlags;
325 struct TICKY_FLAGS TickyFlags;
326 struct TRACE_FLAGS TraceFlags;
328 #if defined(THREADED_RTS) || defined(PAR)
329 struct PAR_FLAGS ParFlags;
332 struct GRAN_FLAGS GranFlags;
335 struct PAPI_FLAGS PapiFlags;
339 #ifdef COMPILING_RTS_MAIN
340 extern DLLIMPORT RTS_FLAGS RtsFlags;
342 /* Hack because the C code generator can't generate '&label'. */
343 extern RTS_FLAGS RtsFlags[];
345 extern RTS_FLAGS RtsFlags;
348 /* Routines that operate-on/to-do-with RTS flags: */
350 extern void initRtsFlagsDefaults(void);
351 extern void setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[]);
352 extern void setProgName(char *argv[]);
356 * The printf formats are here, so we are less likely to make
357 * overly-long filenames (with disastrous results). No more than 128
361 #define STATS_FILENAME_MAXLEN 128
363 #define GR_FILENAME_FMT "%0.124s.gr"
364 #define GR_FILENAME_FMT_GUM "%0.120s.%03d.%s"
365 #define HP_FILENAME_FMT "%0.124s.hp"
366 #define LIFE_FILENAME_FMT "%0.122s.life"
367 #define PROF_FILENAME_FMT "%0.122s.prof"
368 #define PROF_FILENAME_FMT_GUM "%0.118s.%03d.prof"
369 #define QP_FILENAME_FMT "%0.124s.qp"
370 #define STAT_FILENAME_FMT "%0.122s.stat"
371 #define TICKY_FILENAME_FMT "%0.121s.ticky"
372 #define TIME_FILENAME_FMT "%0.122s.time"
373 #define TIME_FILENAME_FMT_GUM "%0.118s.%03d.time"
375 /* an "int" so as to match normal "argc" */
376 /* Now defined in Stg.h (lib/std/cbits need these too.)
377 extern int prog_argc;
378 extern char **prog_argv;
380 extern int rts_argc; /* ditto */
381 extern char *rts_argv[];
383 #endif /* RTSFLAGS_H */