1 /* -----------------------------------------------------------------------------
2 * $Id: RtsFlags.h,v 1.22 2000/03/08 17:48:24 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 SUMMARY_GC_STATS 1
20 #define VERBOSE_GC_STATS 2
22 nat maxStkSize; /* in *words* */
23 nat initialStkSize; /* in *words* */
25 nat maxHeapSize; /* in *blocks* */
26 nat minAllocAreaSize; /* in *blocks* */
27 nat minOldGenSize; /* in *blocks* */
28 nat heapSizeSuggestion; /* in *blocks* */
35 rtsBool forceGC; /* force a major GC every <interval> bytes */
36 int forcingInterval; /* actually, stored as a number of *words* */
39 rtsBool squeezeUpdFrames;
42 /* Hack: this struct uses bitfields so that we can use a binary arg
44 * Remember to update the corresponding bit of RtsFlags.c if you
45 * change/extend this struct.
48 /* flags to control debugging output in various subsystems */
49 rtsBool scheduler : 1; /* 1 */
50 rtsBool evaluator : 1; /* 2 */
51 rtsBool codegen : 1; /* 4 */
52 rtsBool weak : 1; /* 8 */
53 rtsBool gccafs : 1; /* 16 */
54 rtsBool gc : 1; /* 32 */
55 rtsBool block_alloc : 1; /* 64 */
57 /* flags to control consistency checking (often very expensive!) */
58 rtsBool sanity : 1; /* 128 */
60 rtsBool stable : 1; /* 256 */
61 rtsBool prof : 1; /* 512 */
62 rtsBool gran : 1; /* 1024 */
63 rtsBool par : 1; /* 2048 */
66 #if defined(PROFILING) || defined(PAR)
67 /* with PROFILING, full cost-centre stuff (also PROFILING_FLAGS);
68 with PAR, just the four fixed cost-centres.
70 struct COST_CENTRE_FLAGS {
71 unsigned int doCostCentres;
72 # define COST_CENTRES_SUMMARY 1
73 # define COST_CENTRES_VERBOSE 2 /* incl. serial time profile */
74 # define COST_CENTRES_ALL 3
75 # define COST_CENTRES_XML 4
77 int ctxtSwitchTicks; /* derived */
78 int profilerTicks; /* derived */
79 int msecsPerTick; /* derived */
84 struct PROFILING_FLAGS {
85 unsigned int doHeapProfile;
87 # define NO_HEAP_PROFILING 0 /* N.B. Used as indexes into arrays */
88 # define HEAP_BY_CCS 1
89 # define HEAP_BY_MOD 2
90 # define HEAP_BY_DESCR 4
91 # define HEAP_BY_TYPE 5
92 # define HEAP_BY_TIME 6
94 rtsBool showCCSOnException;
98 # define DESCRchar 'D'
100 # define TIMEchar 'T'
109 # define NO_HEAP_PROFILING 0
110 # define HEAP_BY_INFOPTR 1
111 # define HEAP_BY_CLOSURE_TYPE 2
112 struct PROFILING_FLAGS {
113 unsigned int doHeapProfile; /* heap profile using symbol table */
115 #endif /* DEBUG || PROFILING */
117 struct CONCURRENT_FLAGS {
118 int ctxtSwitchTime; /* 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 trace : 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 ack : 1; /* 128 */
143 rtsBool fish : 1; /* 256 */
144 rtsBool forward : 1; /* 512 */
145 rtsBool pack : 1; /* 1024 */
148 #define MAX_PAR_DEBUG_OPTION 10
149 #define PAR_DEBUG_MASK(n) ((nat)(ldexp(1,n)))
150 #define MAX_PAR_DEBUG_MASK ((nat)(ldexp(1,(MAX_PAR_DEBUG_OPTION+1))-1))
153 struct PAR_STATS_FLAGS ParStats; /* profile and stats output */
154 struct PAR_DEBUG_FLAGS Debug; /* debugging options */
155 rtsBool outputDisabled; /* Disable output for performance purposes */
157 nat maxLocalSparks; /* spark pool size */
158 nat maxThreads; /* thread pool size */
159 nat maxFishes; /* max number of active fishes */
160 rtsTime fishDelay; /* delay before sending a new fish */
167 nat nNodes; /* number of threads to run simultaneously */
168 unsigned int maxLocalSparks;
173 struct GRAN_STATS_FLAGS {
174 rtsBool Full; /* Full .gr profile (rtsTrue) or only END events? */
175 rtsBool Suppressed; /* No .gr profile at all */
176 rtsBool Binary; /* Binary profile? (not yet implemented) */
177 rtsBool Sparks; /* Info on sparks in profile? */
178 rtsBool Heap; /* Info on heap allocs in profile? */
179 rtsBool NewLogfile; /* Use new log-file format? (not yet implemented) */
180 rtsBool Global; /* Global statistics? (printed on shutdown; no log file) */
183 struct GRAN_COST_FLAGS {
184 /* Communication Cost Variables -- set in main program */
185 nat latency; /* Latency for single packet */
186 nat additional_latency; /* Latency for additional packets */
188 nat lunblocktime; /* Time for local unblock */
189 nat gunblocktime; /* Time for global unblock */
190 nat mpacktime; /* Cost of creating a packet */
191 nat munpacktime; /* Cost of receiving a packet */
192 nat mtidytime; /* Cost of cleaning up after send */
194 nat threadcreatetime; /* Thread creation costs */
195 nat threadqueuetime; /* Cost of adding a thread to the running/runnable queue */
196 nat threaddescheduletime; /* Cost of descheduling a thread */
197 nat threadscheduletime; /* Cost of scheduling a thread */
198 nat threadcontextswitchtime; /* Cost of context switch */
200 /* Instruction Costs */
201 nat arith_cost; /* arithmetic instructions (+,i,< etc) */
202 nat branch_cost; /* branch instructions */
203 nat load_cost; /* load into register */
204 nat store_cost; /* store into memory */
205 nat float_cost; /* floating point operations */
207 nat heapalloc_cost; /* heap allocation costs */
209 /* Overhead for granularity control mechanisms */
210 /* overhead per elem of spark queue */
211 nat pri_spark_overhead;
212 /* overhead per elem of thread queue */
213 nat pri_sched_overhead;
216 struct GRAN_DEBUG_FLAGS {
217 /* flags to control debugging output in various subsystems */
218 rtsBool event_trace : 1; /* 1 */
219 rtsBool event_stats : 1; /* 2 */
220 rtsBool bq : 1; /* 4 */
221 rtsBool pack : 1; /* 8 */
222 rtsBool checkSparkQ : 1; /* 16 */
223 rtsBool thunkStealing : 1; /* 32 */
224 rtsBool randomSteal : 1; /* 64 */
225 rtsBool findWork : 1; /* 128 */
226 rtsBool unused : 1; /* 256 */
227 rtsBool pri : 1; /* 512 */
228 rtsBool checkLight : 1; /* 1024 */
229 rtsBool sortedQ : 1; /* 2048 */
230 rtsBool blockOnFetch : 1; /* 4096 */
231 rtsBool packBuffer : 1; /* 8192 */
232 rtsBool blockOnFetch_sanity : 1; /* 16384 */
235 #define MAX_GRAN_DEBUG_OPTION 14
236 #define GRAN_DEBUG_MASK(n) ((nat)(ldexp(1,n)))
237 #define MAX_GRAN_DEBUG_MASK ((nat)(ldexp(1,(MAX_GRAN_DEBUG_OPTION+1))-1))
240 struct GRAN_STATS_FLAGS GranSimStats; /* profile and stats output */
241 struct GRAN_COST_FLAGS Costs; /* cost metric for simulation */
242 struct GRAN_DEBUG_FLAGS Debug; /* debugging options */
244 // rtsBool labelling;
246 nat packBufferSize_internal;
248 PEs proc; /* number of processors */
249 rtsBool Fishing; /* Simulate GUM style fishing mechanism? */
250 nat maxFishes; /* max number of spark or thread steals */
251 rtsTime time_slice; /* max time slice of one reduction thread */
253 /* GrAnSim-Light: This version puts no bound on the number of
254 processors but in exchange doesn't model communication costs
255 (all communication is 0 cost). Mainly intended to show maximal
256 degree of parallelism in the program (*not* to simulate the
257 execution on a real machine). */
261 rtsBool DoFairSchedule ; /* fair scheduling alg? default: unfair */
262 rtsBool DoAsyncFetch; /* async. communication? */
263 rtsBool DoStealThreadsFirst; /* prefer threads over sparks when stealing */
264 rtsBool DoAlwaysCreateThreads; /* eager thread creation */
265 rtsBool DoBulkFetching; /* bulk fetching */
266 rtsBool DoThreadMigration; /* allow to move threads */
267 nat FetchStrategy; /* what to do when waiting for data */
268 rtsBool PreferSparksOfLocalNodes; /* prefer local over global sparks */
269 rtsBool DoPrioritySparking; /* sparks sorted by priorities */
270 rtsBool DoPriorityScheduling; /* threads sorted by priorities */
271 nat SparkPriority; /* threshold for cut-off mechanism */
273 rtsBool RandomPriorities;
274 rtsBool InversePriorities;
275 rtsBool IgnorePriorities;
276 nat ThunksToPack; /* number of thunks in packet + 1 */
277 rtsBool RandomSteal; /* steal spark/thread from random proc */
278 rtsBool NoForward; /* no forwarding of fetch messages */
280 // unsigned int debug;
281 // rtsBool event_trace;
282 // rtsBool event_trace_all;
288 rtsBool showTickyStats;
291 #endif /* TICKY_TICKY */
294 /* Put them together: */
297 struct GC_FLAGS GcFlags;
298 struct DEBUG_FLAGS DebugFlags;
299 struct CONCURRENT_FLAGS ConcFlags;
301 #if defined(PROFILING) || defined(PAR)
302 struct COST_CENTRE_FLAGS CcFlags;
304 #if defined(PROFILING) || defined(DEBUG)
305 struct PROFILING_FLAGS ProfFlags;
307 #if defined(SMP) || defined(PAR)
308 struct PAR_FLAGS ParFlags;
311 struct GRAN_FLAGS GranFlags;
314 struct TICKY_FLAGS TickyFlags;
318 #ifdef COMPILING_RTS_MAIN
319 extern DLLIMPORT struct RTS_FLAGS RtsFlags;
321 extern struct RTS_FLAGS RtsFlags;
324 /* Routines that operate-on/to-do-with RTS flags: */
326 void initRtsFlagsDefaults(void);
327 void setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[]);
330 * The printf formats are here, so we are less likely to make
331 * overly-long filenames (with disastrous results). No more than 128
335 #define STATS_FILENAME_MAXLEN 128
337 #define GR_FILENAME_FMT "%0.124s.gr"
338 #define GR_FILENAME_FMT_GUM "%0.120s.%03d.%s"
339 #define HP_FILENAME_FMT "%0.124s.hp"
340 #define LIFE_FILENAME_FMT "%0.122s.life"
341 #define PROF_FILENAME_FMT "%0.122s.prof"
342 #define PROF_FILENAME_FMT_GUM "%0.118s.%03d.prof"
343 #define QP_FILENAME_FMT "%0.124s.qp"
344 #define STAT_FILENAME_FMT "%0.122s.stat"
345 #define TICKY_FILENAME_FMT "%0.121s.ticky"
346 #define TIME_FILENAME_FMT "%0.122s.time"
347 #define TIME_FILENAME_FMT_GUM "%0.118s.%03d.time"
349 /* an "int" so as to match normal "argc" */
350 /* Now defined in Stg.h (lib/std/cbits need these too.)
351 extern int prog_argc;
352 extern char **prog_argv;
354 extern int rts_argc; /* ditto */
355 extern char *rts_argv[];
357 #endif /* RTSFLAGS_H */