1 /* -----------------------------------------------------------------------------
2 * $Id: RtsFlags.h,v 1.31 2001/03/14 11:18:18 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* */
39 rtsBool squeezeUpdFrames;
44 /* Hack: this struct uses bitfields so that we can use a binary arg
46 * Remember to update the corresponding bit of RtsFlags.c if you
47 * change/extend this struct.
50 /* flags to control debugging output in various subsystems */
51 rtsBool scheduler : 1; /* 1 */
52 rtsBool evaluator : 1; /* 2 */
53 rtsBool codegen : 1; /* 4 */
54 rtsBool weak : 1; /* 8 */
55 rtsBool gccafs : 1; /* 16 */
56 rtsBool gc : 1; /* 32 */
57 rtsBool block_alloc : 1; /* 64 */
59 /* flags to control consistency checking (often very expensive!) */
60 rtsBool sanity : 1; /* 128 */
62 rtsBool stable : 1; /* 256 */
63 rtsBool prof : 1; /* 512 */
64 rtsBool gran : 1; /* 1024 */
65 rtsBool par : 1; /* 2048 */
67 /* The object linker */
68 rtsBool linker : 1; /* 4096 */
71 #define MAX_DEBUG_OPTION 12
72 #define DEBUG_MASK(n) ((nat)(ldexp(1,n)))
73 #define MAX_DEBUG_MASK ((nat)(ldexp(1,(MAX_DEBUG_OPTION+1))-1))
75 struct COST_CENTRE_FLAGS {
76 unsigned int doCostCentres;
77 # define COST_CENTRES_SUMMARY 1
78 # define COST_CENTRES_VERBOSE 2 /* incl. serial time profile */
79 # define COST_CENTRES_ALL 3
80 # define COST_CENTRES_XML 4
82 int profilerTicks; /* derived */
83 int msecsPerTick; /* derived */
87 struct PROFILING_FLAGS {
88 unsigned int doHeapProfile;
90 # define NO_HEAP_PROFILING 0 /* N.B. Used as indexes into arrays */
91 # define HEAP_BY_CCS 1
92 # define HEAP_BY_MOD 2
93 # define HEAP_BY_DESCR 4
94 # define HEAP_BY_TYPE 5
96 rtsBool showCCSOnException;
100 # define DESCRchar 'D'
101 # define TYPEchar 'Y'
110 # define NO_HEAP_PROFILING 0
111 # define HEAP_BY_INFOPTR 1
112 # define HEAP_BY_CLOSURE_TYPE 2
113 struct PROFILING_FLAGS {
114 unsigned int doHeapProfile; /* heap profile using symbol table */
116 #endif /* DEBUG || PROFILING */
118 struct CONCURRENT_FLAGS {
119 int ctxtSwitchTime; /* in milliseconds */
120 int ctxtSwitchTicks; /* derived */
124 /* currently the same as GRAN_STATS_FLAGS */
125 struct PAR_STATS_FLAGS {
126 rtsBool Full; /* Full .gr profile (rtsTrue) or only END events? */
127 // rtsBool Suppressed; /* No .gr profile at all */
128 rtsBool Binary; /* Binary profile? (not yet implemented) */
129 rtsBool Sparks; /* Info on sparks in profile? */
130 rtsBool Heap; /* Info on heap allocs in profile? */
131 rtsBool NewLogfile; /* Use new log-file format? (not yet implemented) */
132 rtsBool Global; /* Global statistics? (printed on shutdown; no log file) */
135 struct PAR_DEBUG_FLAGS {
136 /* flags to control debugging output in various subsystems */
137 rtsBool verbose : 1; /* 1 */
138 rtsBool trace : 1; /* 2 */
139 rtsBool schedule : 1; /* 4 */
140 rtsBool free : 1; /* 8 */
141 rtsBool resume : 1; /* 16 */
142 rtsBool weight : 1; /* 32 */
143 rtsBool fetch : 1; /* 64 */
144 rtsBool fish : 1; /* 128 */
145 rtsBool tables : 1; /* 256 */
146 rtsBool packet : 1; /* 512 */
147 rtsBool pack : 1; /* 1024 */
150 #define MAX_PAR_DEBUG_OPTION 10
151 #define PAR_DEBUG_MASK(n) ((nat)(ldexp(1,n)))
152 #define MAX_PAR_DEBUG_MASK ((nat)(ldexp(1,(MAX_PAR_DEBUG_OPTION+1))-1))
155 struct PAR_STATS_FLAGS ParStats; /* profile and stats output */
156 struct PAR_DEBUG_FLAGS Debug; /* debugging options */
157 rtsBool outputDisabled; /* Disable output for performance purposes */
159 nat maxLocalSparks; /* spark pool size */
160 nat maxThreads; /* thread pool size */
161 nat maxFishes; /* max number of active fishes */
162 rtsTime fishDelay; /* delay before sending a new fish */
169 nat nNodes; /* number of threads to run simultaneously */
170 unsigned int maxLocalSparks;
175 struct GRAN_STATS_FLAGS {
176 rtsBool Full; /* Full .gr profile (rtsTrue) or only END events? */
177 rtsBool Suppressed; /* No .gr profile at all */
178 rtsBool Binary; /* Binary profile? (not yet implemented) */
179 rtsBool Sparks; /* Info on sparks in profile? */
180 rtsBool Heap; /* Info on heap allocs in profile? */
181 rtsBool NewLogfile; /* Use new log-file format? (not yet implemented) */
182 rtsBool Global; /* Global statistics? (printed on shutdown; no log file) */
185 struct GRAN_COST_FLAGS {
186 /* Communication Cost Variables -- set in main program */
187 nat latency; /* Latency for single packet */
188 nat additional_latency; /* Latency for additional packets */
190 nat lunblocktime; /* Time for local unblock */
191 nat gunblocktime; /* Time for global unblock */
192 nat mpacktime; /* Cost of creating a packet */
193 nat munpacktime; /* Cost of receiving a packet */
194 nat mtidytime; /* Cost of cleaning up after send */
196 nat threadcreatetime; /* Thread creation costs */
197 nat threadqueuetime; /* Cost of adding a thread to the running/runnable queue */
198 nat threaddescheduletime; /* Cost of descheduling a thread */
199 nat threadscheduletime; /* Cost of scheduling a thread */
200 nat threadcontextswitchtime; /* Cost of context switch */
202 /* Instruction Costs */
203 nat arith_cost; /* arithmetic instructions (+,i,< etc) */
204 nat branch_cost; /* branch instructions */
205 nat load_cost; /* load into register */
206 nat store_cost; /* store into memory */
207 nat float_cost; /* floating point operations */
209 nat heapalloc_cost; /* heap allocation costs */
211 /* Overhead for granularity control mechanisms */
212 /* overhead per elem of spark queue */
213 nat pri_spark_overhead;
214 /* overhead per elem of thread queue */
215 nat pri_sched_overhead;
218 struct GRAN_DEBUG_FLAGS {
219 /* flags to control debugging output in various subsystems */
220 rtsBool event_trace : 1; /* 1 */
221 rtsBool event_stats : 1; /* 2 */
222 rtsBool bq : 1; /* 4 */
223 rtsBool pack : 1; /* 8 */
224 rtsBool checkSparkQ : 1; /* 16 */
225 rtsBool thunkStealing : 1; /* 32 */
226 rtsBool randomSteal : 1; /* 64 */
227 rtsBool findWork : 1; /* 128 */
228 rtsBool unused : 1; /* 256 */
229 rtsBool pri : 1; /* 512 */
230 rtsBool checkLight : 1; /* 1024 */
231 rtsBool sortedQ : 1; /* 2048 */
232 rtsBool blockOnFetch : 1; /* 4096 */
233 rtsBool packBuffer : 1; /* 8192 */
234 rtsBool blockOnFetch_sanity : 1; /* 16384 */
237 #define MAX_GRAN_DEBUG_OPTION 14
238 #define GRAN_DEBUG_MASK(n) ((nat)(ldexp(1,n)))
239 #define MAX_GRAN_DEBUG_MASK ((nat)(ldexp(1,(MAX_GRAN_DEBUG_OPTION+1))-1))
242 struct GRAN_STATS_FLAGS GranSimStats; /* profile and stats output */
243 struct GRAN_COST_FLAGS Costs; /* cost metric for simulation */
244 struct GRAN_DEBUG_FLAGS Debug; /* debugging options */
246 nat maxThreads; // ToDo: share with SMP and GUM
247 // rtsBool labelling;
249 nat packBufferSize_internal;
251 PEs proc; /* number of processors */
252 rtsBool Fishing; /* Simulate GUM style fishing mechanism? */
253 nat maxFishes; /* max number of spark or thread steals */
254 rtsTime time_slice; /* max time slice of one reduction thread */
256 /* GrAnSim-Light: This version puts no bound on the number of
257 processors but in exchange doesn't model communication costs
258 (all communication is 0 cost). Mainly intended to show maximal
259 degree of parallelism in the program (*not* to simulate the
260 execution on a real machine). */
264 rtsBool DoFairSchedule ; /* fair scheduling alg? default: unfair */
265 rtsBool DoAsyncFetch; /* async. communication? */
266 rtsBool DoStealThreadsFirst; /* prefer threads over sparks when stealing */
267 rtsBool DoAlwaysCreateThreads; /* eager thread creation */
268 rtsBool DoBulkFetching; /* bulk fetching */
269 rtsBool DoThreadMigration; /* allow to move threads */
270 nat FetchStrategy; /* what to do when waiting for data */
271 rtsBool PreferSparksOfLocalNodes; /* prefer local over global sparks */
272 rtsBool DoPrioritySparking; /* sparks sorted by priorities */
273 rtsBool DoPriorityScheduling; /* threads sorted by priorities */
274 nat SparkPriority; /* threshold for cut-off mechanism */
276 rtsBool RandomPriorities;
277 rtsBool InversePriorities;
278 rtsBool IgnorePriorities;
279 nat ThunksToPack; /* number of thunks in packet + 1 */
280 rtsBool RandomSteal; /* steal spark/thread from random proc */
281 rtsBool NoForward; /* no forwarding of fetch messages */
283 // unsigned int debug;
284 // rtsBool event_trace;
285 // rtsBool event_trace_all;
291 rtsBool showTickyStats;
294 #endif /* TICKY_TICKY */
297 /* Put them together: */
300 struct GC_FLAGS GcFlags;
301 struct DEBUG_FLAGS DebugFlags;
302 struct CONCURRENT_FLAGS ConcFlags;
304 #if defined(PROFILING) || defined(PAR)
305 struct COST_CENTRE_FLAGS CcFlags;
307 #if defined(PROFILING) || defined(DEBUG)
308 struct PROFILING_FLAGS ProfFlags;
310 #if defined(SMP) || defined(PAR)
311 struct PAR_FLAGS ParFlags;
314 struct GRAN_FLAGS GranFlags;
317 struct TICKY_FLAGS TickyFlags;
321 #ifdef COMPILING_RTS_MAIN
322 extern DLLIMPORT struct RTS_FLAGS RtsFlags;
324 extern struct RTS_FLAGS RtsFlags;
327 /* Routines that operate-on/to-do-with RTS flags: */
329 void initRtsFlagsDefaults(void);
330 void setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[]);
333 * The printf formats are here, so we are less likely to make
334 * overly-long filenames (with disastrous results). No more than 128
338 #define STATS_FILENAME_MAXLEN 128
340 #define GR_FILENAME_FMT "%0.124s.gr"
341 #define GR_FILENAME_FMT_GUM "%0.120s.%03d.%s"
342 #define HP_FILENAME_FMT "%0.124s.hp"
343 #define LIFE_FILENAME_FMT "%0.122s.life"
344 #define PROF_FILENAME_FMT "%0.122s.prof"
345 #define PROF_FILENAME_FMT_GUM "%0.118s.%03d.prof"
346 #define QP_FILENAME_FMT "%0.124s.qp"
347 #define STAT_FILENAME_FMT "%0.122s.stat"
348 #define TICKY_FILENAME_FMT "%0.121s.ticky"
349 #define TIME_FILENAME_FMT "%0.122s.time"
350 #define TIME_FILENAME_FMT_GUM "%0.118s.%03d.time"
352 /* an "int" so as to match normal "argc" */
353 /* Now defined in Stg.h (lib/std/cbits need these too.)
354 extern int prog_argc;
355 extern char **prog_argv;
357 extern int rts_argc; /* ditto */
358 extern char *rts_argv[];
360 #endif /* RTSFLAGS_H */