1 /* -----------------------------------------------------------------------------
2 * $Id: RtsFlags.h,v 1.34 2001/07/23 17:23:19 simonmar 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* */
37 rtsBool squeezeUpdFrames;
43 /* Hack: this struct uses bitfields so that we can use a binary arg
45 * Remember to update the corresponding bit of RtsFlags.c if you
46 * change/extend this struct.
49 /* flags to control debugging output in various subsystems */
50 rtsBool scheduler : 1; /* 1 */
51 rtsBool evaluator : 1; /* 2 */
52 rtsBool codegen : 1; /* 4 */
53 rtsBool weak : 1; /* 8 */
54 rtsBool gccafs : 1; /* 16 */
55 rtsBool gc : 1; /* 32 */
56 rtsBool block_alloc : 1; /* 64 */
58 /* flags to control consistency checking (often very expensive!) */
59 rtsBool sanity : 1; /* 128 */
61 rtsBool stable : 1; /* 256 */
62 rtsBool prof : 1; /* 512 */
63 rtsBool gran : 1; /* 1024 */
64 rtsBool par : 1; /* 2048 */
66 /* The object linker */
67 rtsBool linker : 1; /* 4096 */
70 #define MAX_DEBUG_OPTION 12
71 #define DEBUG_MASK(n) ((nat)(ldexp(1,n)))
72 #define MAX_DEBUG_MASK ((nat)(ldexp(1,(MAX_DEBUG_OPTION+1))-1))
74 struct COST_CENTRE_FLAGS {
75 unsigned int doCostCentres;
76 # define COST_CENTRES_SUMMARY 1
77 # define COST_CENTRES_VERBOSE 2 /* incl. serial time profile */
78 # define COST_CENTRES_ALL 3
79 # define COST_CENTRES_XML 4
81 int profilerTicks; /* derived */
82 int msecsPerTick; /* derived */
86 struct PROFILING_FLAGS {
87 unsigned int doHeapProfile;
89 nat profileFrequency; /* how often do you want */
90 /* to sample (in ms) */
93 # define NO_HEAP_PROFILING 0 /* N.B. Used as indexes into arrays */
94 # define HEAP_BY_CCS 1
95 # define HEAP_BY_MOD 2
96 # define HEAP_BY_DESCR 4
97 # define HEAP_BY_TYPE 5
99 rtsBool showCCSOnException;
103 # define DESCRchar 'D'
104 # define TYPEchar 'Y'
114 # define NO_HEAP_PROFILING 0
115 # define HEAP_BY_INFOPTR 1
116 # define HEAP_BY_CLOSURE_TYPE 2
117 struct PROFILING_FLAGS {
118 unsigned int doHeapProfile; /* heap profile using symbol table */
121 #endif /* DEBUG || PROFILING */
123 struct CONCURRENT_FLAGS {
124 int ctxtSwitchTime; /* in milliseconds */
125 int ctxtSwitchTicks; /* derived */
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 unsigned int maxLocalSparks;
184 struct GRAN_STATS_FLAGS {
185 rtsBool Full; /* Full .gr profile (rtsTrue) or only END events? */
186 rtsBool Suppressed; /* No .gr profile at all */
187 rtsBool Binary; /* Binary profile? (not yet implemented) */
188 rtsBool Sparks; /* Info on sparks in profile? */
189 rtsBool Heap; /* Info on heap allocs in profile? */
190 rtsBool NewLogfile; /* Use new log-file format? (not yet implemented) */
191 rtsBool Global; /* Global statistics? (printed on shutdown; no log file) */
194 struct GRAN_COST_FLAGS {
195 /* Communication Cost Variables -- set in main program */
196 nat latency; /* Latency for single packet */
197 nat additional_latency; /* Latency for additional packets */
199 nat lunblocktime; /* Time for local unblock */
200 nat gunblocktime; /* Time for global unblock */
201 nat mpacktime; /* Cost of creating a packet */
202 nat munpacktime; /* Cost of receiving a packet */
203 nat mtidytime; /* Cost of cleaning up after send */
205 nat threadcreatetime; /* Thread creation costs */
206 nat threadqueuetime; /* Cost of adding a thread to the running/runnable queue */
207 nat threaddescheduletime; /* Cost of descheduling a thread */
208 nat threadscheduletime; /* Cost of scheduling a thread */
209 nat threadcontextswitchtime; /* Cost of context switch */
211 /* Instruction Costs */
212 nat arith_cost; /* arithmetic instructions (+,i,< etc) */
213 nat branch_cost; /* branch instructions */
214 nat load_cost; /* load into register */
215 nat store_cost; /* store into memory */
216 nat float_cost; /* floating point operations */
218 nat heapalloc_cost; /* heap allocation costs */
220 /* Overhead for granularity control mechanisms */
221 /* overhead per elem of spark queue */
222 nat pri_spark_overhead;
223 /* overhead per elem of thread queue */
224 nat pri_sched_overhead;
227 struct GRAN_DEBUG_FLAGS {
228 /* flags to control debugging output in various subsystems */
229 rtsBool event_trace : 1; /* 1 */
230 rtsBool event_stats : 1; /* 2 */
231 rtsBool bq : 1; /* 4 */
232 rtsBool pack : 1; /* 8 */
233 rtsBool checkSparkQ : 1; /* 16 */
234 rtsBool thunkStealing : 1; /* 32 */
235 rtsBool randomSteal : 1; /* 64 */
236 rtsBool findWork : 1; /* 128 */
237 rtsBool unused : 1; /* 256 */
238 rtsBool pri : 1; /* 512 */
239 rtsBool checkLight : 1; /* 1024 */
240 rtsBool sortedQ : 1; /* 2048 */
241 rtsBool blockOnFetch : 1; /* 4096 */
242 rtsBool packBuffer : 1; /* 8192 */
243 rtsBool blockOnFetch_sanity : 1; /* 16384 */
246 #define MAX_GRAN_DEBUG_OPTION 14
247 #define GRAN_DEBUG_MASK(n) ((nat)(ldexp(1,n)))
248 #define MAX_GRAN_DEBUG_MASK ((nat)(ldexp(1,(MAX_GRAN_DEBUG_OPTION+1))-1))
251 struct GRAN_STATS_FLAGS GranSimStats; /* profile and stats output */
252 struct GRAN_COST_FLAGS Costs; /* cost metric for simulation */
253 struct GRAN_DEBUG_FLAGS Debug; /* debugging options */
255 nat maxThreads; // ToDo: share with SMP and GUM
256 // rtsBool labelling;
258 nat packBufferSize_internal;
260 PEs proc; /* number of processors */
261 rtsBool Fishing; /* Simulate GUM style fishing mechanism? */
262 nat maxFishes; /* max number of spark or thread steals */
263 rtsTime time_slice; /* max time slice of one reduction thread */
265 /* GrAnSim-Light: This version puts no bound on the number of
266 processors but in exchange doesn't model communication costs
267 (all communication is 0 cost). Mainly intended to show maximal
268 degree of parallelism in the program (*not* to simulate the
269 execution on a real machine). */
273 rtsBool DoFairSchedule ; /* fair scheduling alg? default: unfair */
274 rtsBool DoAsyncFetch; /* async. communication? */
275 rtsBool DoStealThreadsFirst; /* prefer threads over sparks when stealing */
276 rtsBool DoAlwaysCreateThreads; /* eager thread creation */
277 rtsBool DoBulkFetching; /* bulk fetching */
278 rtsBool DoThreadMigration; /* allow to move threads */
279 nat FetchStrategy; /* what to do when waiting for data */
280 rtsBool PreferSparksOfLocalNodes; /* prefer local over global sparks */
281 rtsBool DoPrioritySparking; /* sparks sorted by priorities */
282 rtsBool DoPriorityScheduling; /* threads sorted by priorities */
283 nat SparkPriority; /* threshold for cut-off mechanism */
285 rtsBool RandomPriorities;
286 rtsBool InversePriorities;
287 rtsBool IgnorePriorities;
288 nat ThunksToPack; /* number of thunks in packet + 1 */
289 rtsBool RandomSteal; /* steal spark/thread from random proc */
290 rtsBool NoForward; /* no forwarding of fetch messages */
292 // unsigned int debug;
293 // rtsBool event_trace;
294 // rtsBool event_trace_all;
300 rtsBool showTickyStats;
303 #endif /* TICKY_TICKY */
306 /* Put them together: */
309 struct GC_FLAGS GcFlags;
310 struct DEBUG_FLAGS DebugFlags;
311 struct CONCURRENT_FLAGS ConcFlags;
313 #if defined(PROFILING) || defined(PAR)
314 struct COST_CENTRE_FLAGS CcFlags;
316 #if defined(PROFILING) || defined(DEBUG)
317 struct PROFILING_FLAGS ProfFlags;
319 #if defined(SMP) || defined(PAR)
320 struct PAR_FLAGS ParFlags;
323 struct GRAN_FLAGS GranFlags;
326 struct TICKY_FLAGS TickyFlags;
330 #ifdef COMPILING_RTS_MAIN
331 extern DLLIMPORT struct RTS_FLAGS RtsFlags;
333 extern struct RTS_FLAGS RtsFlags;
336 /* Routines that operate-on/to-do-with RTS flags: */
338 void initRtsFlagsDefaults(void);
339 void setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[]);
342 * The printf formats are here, so we are less likely to make
343 * overly-long filenames (with disastrous results). No more than 128
347 #define STATS_FILENAME_MAXLEN 128
349 #define GR_FILENAME_FMT "%0.124s.gr"
350 #define GR_FILENAME_FMT_GUM "%0.120s.%03d.%s"
351 #define HP_FILENAME_FMT "%0.124s.hp"
352 #define LIFE_FILENAME_FMT "%0.122s.life"
353 #define PROF_FILENAME_FMT "%0.122s.prof"
354 #define PROF_FILENAME_FMT_GUM "%0.118s.%03d.prof"
355 #define QP_FILENAME_FMT "%0.124s.qp"
356 #define STAT_FILENAME_FMT "%0.122s.stat"
357 #define TICKY_FILENAME_FMT "%0.121s.ticky"
358 #define TIME_FILENAME_FMT "%0.122s.time"
359 #define TIME_FILENAME_FMT_GUM "%0.118s.%03d.time"
361 /* an "int" so as to match normal "argc" */
362 /* Now defined in Stg.h (lib/std/cbits need these too.)
363 extern int prog_argc;
364 extern char **prog_argv;
366 extern int rts_argc; /* ditto */
367 extern char *rts_argv[];
369 #endif /* RTSFLAGS_H */