1 /* -----------------------------------------------------------------------------
2 * $Id: RtsFlags.h,v 1.38 2001/08/31 11:42:44 sewardj Exp $
4 * (c) The GHC Team, 1998-1999
6 * Datatypes that holds the command-line flag settings.
8 * ---------------------------------------------------------------------------*/
13 /* For defaults, see the @initRtsFlagsDefaults@ routine. */
19 #define COLLECT_GC_STATS 1
20 #define ONELINE_GC_STATS 2
21 #define SUMMARY_GC_STATS 3
22 #define VERBOSE_GC_STATS 4
24 nat maxStkSize; /* in *words* */
25 nat initialStkSize; /* in *words* */
27 nat maxHeapSize; /* in *blocks* */
28 nat minAllocAreaSize; /* in *blocks* */
29 nat minOldGenSize; /* in *blocks* */
30 nat heapSizeSuggestion; /* in *blocks* */
36 rtsBool squeezeUpdFrames;
38 rtsBool compact; /* True <=> "compact all the time" */
39 double compactThreshold;
45 /* Hack: this struct uses bitfields so that we can use a binary arg
47 * Remember to update the corresponding bit of RtsFlags.c if you
48 * change/extend this struct.
51 /* flags to control debugging output in various subsystems */
52 rtsBool scheduler : 1; /* 1 */
53 rtsBool evaluator : 1; /* 2 */
54 rtsBool codegen : 1; /* 4 */
55 rtsBool weak : 1; /* 8 */
56 rtsBool gccafs : 1; /* 16 */
57 rtsBool gc : 1; /* 32 */
58 rtsBool block_alloc : 1; /* 64 */
60 /* flags to control consistency checking (often very expensive!) */
61 rtsBool sanity : 1; /* 128 */
63 rtsBool stable : 1; /* 256 */
64 rtsBool prof : 1; /* 512 */
65 rtsBool gran : 1; /* 1024 */
66 rtsBool par : 1; /* 2048 */
68 /* The object linker */
69 rtsBool linker : 1; /* 4096 */
72 #define MAX_DEBUG_OPTION 13
73 #define DEBUG_MASK(n) ((nat)(ldexp(1,n)))
74 #define MAX_DEBUG_MASK ((nat)(ldexp(1,(MAX_DEBUG_OPTION+1))-1))
76 struct COST_CENTRE_FLAGS {
77 unsigned int doCostCentres;
78 # define COST_CENTRES_SUMMARY 1
79 # define COST_CENTRES_VERBOSE 2 /* incl. serial time profile */
80 # define COST_CENTRES_ALL 3
81 # define COST_CENTRES_XML 4
83 int profilerTicks; /* derived */
84 int msecsPerTick; /* derived */
88 struct PROFILING_FLAGS {
89 unsigned int doHeapProfile;
91 nat profileFrequency; /* how often do you want */
92 /* to sample (in ms) */
95 # define NO_HEAP_PROFILING 0 /* N.B. Used as indexes into arrays */
96 # define HEAP_BY_CCS 1
97 # define HEAP_BY_MOD 2
98 # define HEAP_BY_DESCR 4
99 # define HEAP_BY_TYPE 5
101 rtsBool showCCSOnException;
105 # define DESCRchar 'D'
106 # define TYPEchar 'Y'
116 # define NO_HEAP_PROFILING 0
117 # define HEAP_BY_INFOPTR 1
118 # define HEAP_BY_CLOSURE_TYPE 2
119 struct PROFILING_FLAGS {
120 unsigned int doHeapProfile; /* heap profile using symbol table */
123 #endif /* DEBUG || PROFILING */
125 struct CONCURRENT_FLAGS {
126 int ctxtSwitchTime; /* in milliseconds */
127 int ctxtSwitchTicks; /* derived */
131 /* currently the same as GRAN_STATS_FLAGS */
132 struct PAR_STATS_FLAGS {
133 rtsBool Full; /* Full .gr profile (rtsTrue) or only END events? */
134 rtsBool Suppressed; /* No .gr profile at all */
135 rtsBool Binary; /* Binary profile? (not yet implemented) */
136 rtsBool Sparks; /* Info on sparks in profile? */
137 rtsBool Heap; /* Info on heap allocs in profile? */
138 rtsBool NewLogfile; /* Use new log-file format? (not yet implemented) */
139 rtsBool Global; /* Global statistics? (printed on shutdown; no log file) */
142 struct PAR_DEBUG_FLAGS {
143 /* flags to control debugging output in various subsystems */
144 rtsBool verbose : 1; /* 1 */
145 rtsBool bq : 1; /* 2 */
146 rtsBool schedule : 1; /* 4 */
147 rtsBool free : 1; /* 8 */
148 rtsBool resume : 1; /* 16 */
149 rtsBool weight : 1; /* 32 */
150 rtsBool fetch : 1; /* 64 */
151 rtsBool fish : 1; /* 128 */
152 rtsBool tables : 1; /* 256 */
153 rtsBool packet : 1; /* 512 */
154 rtsBool pack : 1; /* 1024 */
155 rtsBool paranoia : 1; /* 2048 */
158 #define MAX_PAR_DEBUG_OPTION 11
159 #define PAR_DEBUG_MASK(n) ((nat)(ldexp(1,n)))
160 #define MAX_PAR_DEBUG_MASK ((nat)(ldexp(1,(MAX_PAR_DEBUG_OPTION+1))-1))
163 struct PAR_STATS_FLAGS ParStats; /* profile and stats output */
164 struct PAR_DEBUG_FLAGS Debug; /* debugging options */
165 rtsBool outputDisabled; /* Disable output for performance purposes */
166 rtsBool doFairScheduling; /* Fair-ish scheduling (round robin; no time-slices) */
168 nat thunksToPack; /* number of thunks in packet + 1 */
169 nat globalising; /* globalisation scheme */
170 nat maxLocalSparks; /* spark pool size */
171 nat maxThreads; /* thread pool size */
172 nat maxFishes; /* max number of active fishes */
173 rtsTime fishDelay; /* delay before sending a new fish */
180 nat nNodes; /* number of threads to run simultaneously */
181 unsigned int maxLocalSparks;
186 struct GRAN_STATS_FLAGS {
187 rtsBool Full; /* Full .gr profile (rtsTrue) or only END events? */
188 rtsBool Suppressed; /* No .gr profile at all */
189 rtsBool Binary; /* Binary profile? (not yet implemented) */
190 rtsBool Sparks; /* Info on sparks in profile? */
191 rtsBool Heap; /* Info on heap allocs in profile? */
192 rtsBool NewLogfile; /* Use new log-file format? (not yet implemented) */
193 rtsBool Global; /* Global statistics? (printed on shutdown; no log file) */
196 struct GRAN_COST_FLAGS {
197 /* Communication Cost Variables -- set in main program */
198 nat latency; /* Latency for single packet */
199 nat additional_latency; /* Latency for additional packets */
201 nat lunblocktime; /* Time for local unblock */
202 nat gunblocktime; /* Time for global unblock */
203 nat mpacktime; /* Cost of creating a packet */
204 nat munpacktime; /* Cost of receiving a packet */
205 nat mtidytime; /* Cost of cleaning up after send */
207 nat threadcreatetime; /* Thread creation costs */
208 nat threadqueuetime; /* Cost of adding a thread to the running/runnable queue */
209 nat threaddescheduletime; /* Cost of descheduling a thread */
210 nat threadscheduletime; /* Cost of scheduling a thread */
211 nat threadcontextswitchtime; /* Cost of context switch */
213 /* Instruction Costs */
214 nat arith_cost; /* arithmetic instructions (+,i,< etc) */
215 nat branch_cost; /* branch instructions */
216 nat load_cost; /* load into register */
217 nat store_cost; /* store into memory */
218 nat float_cost; /* floating point operations */
220 nat heapalloc_cost; /* heap allocation costs */
222 /* Overhead for granularity control mechanisms */
223 /* overhead per elem of spark queue */
224 nat pri_spark_overhead;
225 /* overhead per elem of thread queue */
226 nat pri_sched_overhead;
229 struct GRAN_DEBUG_FLAGS {
230 /* flags to control debugging output in various subsystems */
231 rtsBool event_trace : 1; /* 1 */
232 rtsBool event_stats : 1; /* 2 */
233 rtsBool bq : 1; /* 4 */
234 rtsBool pack : 1; /* 8 */
235 rtsBool checkSparkQ : 1; /* 16 */
236 rtsBool thunkStealing : 1; /* 32 */
237 rtsBool randomSteal : 1; /* 64 */
238 rtsBool findWork : 1; /* 128 */
239 rtsBool unused : 1; /* 256 */
240 rtsBool pri : 1; /* 512 */
241 rtsBool checkLight : 1; /* 1024 */
242 rtsBool sortedQ : 1; /* 2048 */
243 rtsBool blockOnFetch : 1; /* 4096 */
244 rtsBool packBuffer : 1; /* 8192 */
245 rtsBool blockOnFetch_sanity : 1; /* 16384 */
248 #define MAX_GRAN_DEBUG_OPTION 14
249 #define GRAN_DEBUG_MASK(n) ((nat)(ldexp(1,n)))
250 #define MAX_GRAN_DEBUG_MASK ((nat)(ldexp(1,(MAX_GRAN_DEBUG_OPTION+1))-1))
253 struct GRAN_STATS_FLAGS GranSimStats; /* profile and stats output */
254 struct GRAN_COST_FLAGS Costs; /* cost metric for simulation */
255 struct GRAN_DEBUG_FLAGS Debug; /* debugging options */
257 nat maxThreads; // ToDo: share with SMP and GUM
258 // rtsBool labelling;
260 nat packBufferSize_internal;
262 PEs proc; /* number of processors */
263 rtsBool Fishing; /* Simulate GUM style fishing mechanism? */
264 nat maxFishes; /* max number of spark or thread steals */
265 rtsTime time_slice; /* max time slice of one reduction thread */
267 /* GrAnSim-Light: This version puts no bound on the number of
268 processors but in exchange doesn't model communication costs
269 (all communication is 0 cost). Mainly intended to show maximal
270 degree of parallelism in the program (*not* to simulate the
271 execution on a real machine). */
275 rtsBool DoFairSchedule ; /* fair scheduling alg? default: unfair */
276 rtsBool DoAsyncFetch; /* async. communication? */
277 rtsBool DoStealThreadsFirst; /* prefer threads over sparks when stealing */
278 rtsBool DoAlwaysCreateThreads; /* eager thread creation */
279 rtsBool DoBulkFetching; /* bulk fetching */
280 rtsBool DoThreadMigration; /* allow to move threads */
281 nat FetchStrategy; /* what to do when waiting for data */
282 rtsBool PreferSparksOfLocalNodes; /* prefer local over global sparks */
283 rtsBool DoPrioritySparking; /* sparks sorted by priorities */
284 rtsBool DoPriorityScheduling; /* threads sorted by priorities */
285 nat SparkPriority; /* threshold for cut-off mechanism */
287 rtsBool RandomPriorities;
288 rtsBool InversePriorities;
289 rtsBool IgnorePriorities;
290 nat ThunksToPack; /* number of thunks in packet + 1 */
291 rtsBool RandomSteal; /* steal spark/thread from random proc */
292 rtsBool NoForward; /* no forwarding of fetch messages */
294 // unsigned int debug;
295 // rtsBool event_trace;
296 // rtsBool event_trace_all;
302 rtsBool showTickyStats;
305 #endif /* TICKY_TICKY */
308 /* Put them together: */
311 struct GC_FLAGS GcFlags;
312 struct DEBUG_FLAGS DebugFlags;
313 struct CONCURRENT_FLAGS ConcFlags;
315 #if defined(PROFILING) || defined(PAR)
316 struct COST_CENTRE_FLAGS CcFlags;
318 #if defined(PROFILING) || defined(DEBUG)
319 struct PROFILING_FLAGS ProfFlags;
321 #if defined(SMP) || defined(PAR)
322 struct PAR_FLAGS ParFlags;
325 struct GRAN_FLAGS GranFlags;
328 struct TICKY_FLAGS TickyFlags;
332 #ifdef COMPILING_RTS_MAIN
333 extern DLLIMPORT struct RTS_FLAGS RtsFlags;
335 extern struct RTS_FLAGS RtsFlags;
338 /* Routines that operate-on/to-do-with RTS flags: */
340 void initRtsFlagsDefaults(void);
341 void setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[]);
344 * The printf formats are here, so we are less likely to make
345 * overly-long filenames (with disastrous results). No more than 128
349 #define STATS_FILENAME_MAXLEN 128
351 #define GR_FILENAME_FMT "%0.124s.gr"
352 #define GR_FILENAME_FMT_GUM "%0.120s.%03d.%s"
353 #define HP_FILENAME_FMT "%0.124s.hp"
354 #define LIFE_FILENAME_FMT "%0.122s.life"
355 #define PROF_FILENAME_FMT "%0.122s.prof"
356 #define PROF_FILENAME_FMT_GUM "%0.118s.%03d.prof"
357 #define QP_FILENAME_FMT "%0.124s.qp"
358 #define STAT_FILENAME_FMT "%0.122s.stat"
359 #define TICKY_FILENAME_FMT "%0.121s.ticky"
360 #define TIME_FILENAME_FMT "%0.122s.time"
361 #define TIME_FILENAME_FMT_GUM "%0.118s.%03d.time"
363 /* an "int" so as to match normal "argc" */
364 /* Now defined in Stg.h (lib/std/cbits need these too.)
365 extern int prog_argc;
366 extern char **prog_argv;
368 extern int rts_argc; /* ditto */
369 extern char *rts_argv[];
371 #endif /* RTSFLAGS_H */