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 idleGCDelayTicks; /* in milliseconds */
49 /* flags to control debugging output & extra checking in various subsystems */
50 rtsBool scheduler; /* 's' */
51 rtsBool interpreter; /* 'i' */
52 rtsBool codegen; /* 'c' */
53 rtsBool weak; /* 'w' */
54 rtsBool gccafs; /* 'G' */
56 rtsBool block_alloc; /* 'b' */
57 rtsBool sanity; /* 'S' warning: might be expensive! */
58 rtsBool stable; /* 't' */
59 rtsBool prof; /* 'p' */
60 rtsBool gran; /* 'r' */
61 rtsBool par; /* 'P' */
62 rtsBool linker; /* 'l' the object linker */
63 rtsBool apply; /* 'a' */
64 rtsBool stm; /* 'm' */
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;
105 char* retainerSelector;
110 struct CONCURRENT_FLAGS {
111 int ctxtSwitchTime; /* in milliseconds */
112 int ctxtSwitchTicks; /* derived */
116 /* currently the same as GRAN_STATS_FLAGS */
117 struct PAR_STATS_FLAGS {
118 rtsBool Full; /* Full .gr profile (rtsTrue) or only END events? */
119 rtsBool Suppressed; /* No .gr profile at all */
120 rtsBool Binary; /* Binary profile? (not yet implemented) */
121 rtsBool Sparks; /* Info on sparks in profile? */
122 rtsBool Heap; /* Info on heap allocs in profile? */
123 rtsBool NewLogfile; /* Use new log-file format? (not yet implemented) */
124 rtsBool Global; /* Global statistics? (printed on shutdown; no log file) */
127 struct PAR_DEBUG_FLAGS {
128 /* flags to control debugging output in various subsystems */
129 rtsBool verbose : 1; /* 1 */
130 rtsBool bq : 1; /* 2 */
131 rtsBool schedule : 1; /* 4 */
132 rtsBool free : 1; /* 8 */
133 rtsBool resume : 1; /* 16 */
134 rtsBool weight : 1; /* 32 */
135 rtsBool fetch : 1; /* 64 */
136 rtsBool fish : 1; /* 128 */
137 rtsBool tables : 1; /* 256 */
138 rtsBool packet : 1; /* 512 */
139 rtsBool pack : 1; /* 1024 */
140 rtsBool paranoia : 1; /* 2048 */
143 #define MAX_PAR_DEBUG_OPTION 11
144 #define PAR_DEBUG_MASK(n) ((nat)(ldexp(1,n)))
145 #define MAX_PAR_DEBUG_MASK ((nat)(ldexp(1,(MAX_PAR_DEBUG_OPTION+1))-1))
148 struct PAR_STATS_FLAGS ParStats; /* profile and stats output */
149 struct PAR_DEBUG_FLAGS Debug; /* debugging options */
150 rtsBool outputDisabled; /* Disable output for performance purposes */
151 rtsBool doFairScheduling; /* Fair-ish scheduling (round robin; no time-slices) */
153 nat thunksToPack; /* number of thunks in packet + 1 */
154 nat globalising; /* globalisation scheme */
155 nat maxLocalSparks; /* spark pool size */
156 nat maxThreads; /* thread pool size */
157 nat maxFishes; /* max number of active fishes */
158 rtsTime fishDelay; /* delay before sending a new fish */
165 nat nNodes; /* number of threads to run simultaneously */
166 unsigned int maxLocalSparks;
171 struct GRAN_STATS_FLAGS {
172 rtsBool Full; /* Full .gr profile (rtsTrue) or only END events? */
173 rtsBool Suppressed; /* No .gr profile at all */
174 rtsBool Binary; /* Binary profile? (not yet implemented) */
175 rtsBool Sparks; /* Info on sparks in profile? */
176 rtsBool Heap; /* Info on heap allocs in profile? */
177 rtsBool NewLogfile; /* Use new log-file format? (not yet implemented) */
178 rtsBool Global; /* Global statistics? (printed on shutdown; no log file) */
181 struct GRAN_COST_FLAGS {
182 /* Communication Cost Variables -- set in main program */
183 nat latency; /* Latency for single packet */
184 nat additional_latency; /* Latency for additional packets */
186 nat lunblocktime; /* Time for local unblock */
187 nat gunblocktime; /* Time for global unblock */
188 nat mpacktime; /* Cost of creating a packet */
189 nat munpacktime; /* Cost of receiving a packet */
190 nat mtidytime; /* Cost of cleaning up after send */
192 nat threadcreatetime; /* Thread creation costs */
193 nat threadqueuetime; /* Cost of adding a thread to the running/runnable queue */
194 nat threaddescheduletime; /* Cost of descheduling a thread */
195 nat threadscheduletime; /* Cost of scheduling a thread */
196 nat threadcontextswitchtime; /* Cost of context switch */
198 /* Instruction Costs */
199 nat arith_cost; /* arithmetic instructions (+,i,< etc) */
200 nat branch_cost; /* branch instructions */
201 nat load_cost; /* load into register */
202 nat store_cost; /* store into memory */
203 nat float_cost; /* floating point operations */
205 nat heapalloc_cost; /* heap allocation costs */
207 /* Overhead for granularity control mechanisms */
208 /* overhead per elem of spark queue */
209 nat pri_spark_overhead;
210 /* overhead per elem of thread queue */
211 nat pri_sched_overhead;
214 struct GRAN_DEBUG_FLAGS {
215 /* flags to control debugging output in various subsystems */
216 rtsBool event_trace : 1; /* 1 */
217 rtsBool event_stats : 1; /* 2 */
218 rtsBool bq : 1; /* 4 */
219 rtsBool pack : 1; /* 8 */
220 rtsBool checkSparkQ : 1; /* 16 */
221 rtsBool thunkStealing : 1; /* 32 */
222 rtsBool randomSteal : 1; /* 64 */
223 rtsBool findWork : 1; /* 128 */
224 rtsBool unused : 1; /* 256 */
225 rtsBool pri : 1; /* 512 */
226 rtsBool checkLight : 1; /* 1024 */
227 rtsBool sortedQ : 1; /* 2048 */
228 rtsBool blockOnFetch : 1; /* 4096 */
229 rtsBool packBuffer : 1; /* 8192 */
230 rtsBool blockOnFetch_sanity : 1; /* 16384 */
233 #define MAX_GRAN_DEBUG_OPTION 14
234 #define GRAN_DEBUG_MASK(n) ((nat)(ldexp(1,n)))
235 #define MAX_GRAN_DEBUG_MASK ((nat)(ldexp(1,(MAX_GRAN_DEBUG_OPTION+1))-1))
238 struct GRAN_STATS_FLAGS GranSimStats; /* profile and stats output */
239 struct GRAN_COST_FLAGS Costs; /* cost metric for simulation */
240 struct GRAN_DEBUG_FLAGS Debug; /* debugging options */
242 nat maxThreads; /* ToDo: share with SMP and GUM */
243 /* rtsBool labelling; */
245 nat packBufferSize_internal;
247 PEs proc; /* number of processors */
248 rtsBool Fishing; /* Simulate GUM style fishing mechanism? */
249 nat maxFishes; /* max number of spark or thread steals */
250 rtsTime time_slice; /* max time slice of one reduction thread */
252 /* GrAnSim-Light: This version puts no bound on the number of
253 processors but in exchange doesn't model communication costs
254 (all communication is 0 cost). Mainly intended to show maximal
255 degree of parallelism in the program (*not* to simulate the
256 execution on a real machine). */
260 rtsBool DoFairSchedule ; /* fair scheduling alg? default: unfair */
261 rtsBool DoAsyncFetch; /* async. communication? */
262 rtsBool DoStealThreadsFirst; /* prefer threads over sparks when stealing */
263 rtsBool DoAlwaysCreateThreads; /* eager thread creation */
264 rtsBool DoBulkFetching; /* bulk fetching */
265 rtsBool DoThreadMigration; /* allow to move threads */
266 nat FetchStrategy; /* what to do when waiting for data */
267 rtsBool PreferSparksOfLocalNodes; /* prefer local over global sparks */
268 rtsBool DoPrioritySparking; /* sparks sorted by priorities */
269 rtsBool DoPriorityScheduling; /* threads sorted by priorities */
270 nat SparkPriority; /* threshold for cut-off mechanism */
272 rtsBool RandomPriorities;
273 rtsBool InversePriorities;
274 rtsBool IgnorePriorities;
275 nat ThunksToPack; /* number of thunks in packet + 1 */
276 rtsBool RandomSteal; /* steal spark/thread from random proc */
277 rtsBool NoForward; /* no forwarding of fetch messages */
279 /* unsigned int debug; */
280 /* rtsBool event_trace; */
281 /* rtsBool event_trace_all; */
286 rtsBool showTickyStats;
291 /* Put them together: */
293 typedef struct _RTS_FLAGS {
294 /* The first portion of RTS_FLAGS is invariant. */
295 struct GC_FLAGS GcFlags;
296 struct CONCURRENT_FLAGS ConcFlags;
297 struct DEBUG_FLAGS DebugFlags;
298 struct COST_CENTRE_FLAGS CcFlags;
299 struct PROFILING_FLAGS ProfFlags;
300 struct TICKY_FLAGS TickyFlags;
302 #if defined(SMP) || defined(PAR)
303 struct PAR_FLAGS ParFlags;
306 struct GRAN_FLAGS GranFlags;
310 #ifdef COMPILING_RTS_MAIN
311 extern DLLIMPORT RTS_FLAGS RtsFlags;
313 /* Hack because the C code generator can't generate '&label'. */
314 extern RTS_FLAGS RtsFlags[];
316 extern RTS_FLAGS RtsFlags;
319 /* Routines that operate-on/to-do-with RTS flags: */
321 extern void initRtsFlagsDefaults(void);
322 extern void setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[]);
323 extern void setProgName(char *argv[]);
327 * The printf formats are here, so we are less likely to make
328 * overly-long filenames (with disastrous results). No more than 128
332 #define STATS_FILENAME_MAXLEN 128
334 #define GR_FILENAME_FMT "%0.124s.gr"
335 #define GR_FILENAME_FMT_GUM "%0.120s.%03d.%s"
336 #define HP_FILENAME_FMT "%0.124s.hp"
337 #define LIFE_FILENAME_FMT "%0.122s.life"
338 #define PROF_FILENAME_FMT "%0.122s.prof"
339 #define PROF_FILENAME_FMT_GUM "%0.118s.%03d.prof"
340 #define QP_FILENAME_FMT "%0.124s.qp"
341 #define STAT_FILENAME_FMT "%0.122s.stat"
342 #define TICKY_FILENAME_FMT "%0.121s.ticky"
343 #define TIME_FILENAME_FMT "%0.122s.time"
344 #define TIME_FILENAME_FMT_GUM "%0.118s.%03d.time"
346 /* an "int" so as to match normal "argc" */
347 /* Now defined in Stg.h (lib/std/cbits need these too.)
348 extern int prog_argc;
349 extern char **prog_argv;
351 extern int rts_argc; /* ditto */
352 extern char *rts_argv[];
354 #endif /* RTSFLAGS_H */