1 /* -----------------------------------------------------------------------------
2 * $Id: RtsFlags.h,v 1.30 2000/12/19 12:50:37 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* */
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
95 # define HEAP_BY_TIME 6
97 rtsBool showCCSOnException;
101 # define DESCRchar 'D'
102 # define TYPEchar 'Y'
103 # define TIMEchar 'T'
106 # define NO_HEAP_PROFILING 0
107 # define HEAP_BY_INFOPTR 1
108 # define HEAP_BY_CLOSURE_TYPE 2
109 struct PROFILING_FLAGS {
110 unsigned int doHeapProfile; /* heap profile using symbol table */
112 #endif /* DEBUG || PROFILING */
114 struct CONCURRENT_FLAGS {
115 int ctxtSwitchTime; /* in milliseconds */
116 int ctxtSwitchTicks; /* derived */
120 /* currently the same as GRAN_STATS_FLAGS */
121 struct PAR_STATS_FLAGS {
122 rtsBool Full; /* Full .gr profile (rtsTrue) or only END events? */
123 // rtsBool Suppressed; /* No .gr profile at all */
124 rtsBool Binary; /* Binary profile? (not yet implemented) */
125 rtsBool Sparks; /* Info on sparks in profile? */
126 rtsBool Heap; /* Info on heap allocs in profile? */
127 rtsBool NewLogfile; /* Use new log-file format? (not yet implemented) */
128 rtsBool Global; /* Global statistics? (printed on shutdown; no log file) */
131 struct PAR_DEBUG_FLAGS {
132 /* flags to control debugging output in various subsystems */
133 rtsBool verbose : 1; /* 1 */
134 rtsBool trace : 1; /* 2 */
135 rtsBool schedule : 1; /* 4 */
136 rtsBool free : 1; /* 8 */
137 rtsBool resume : 1; /* 16 */
138 rtsBool weight : 1; /* 32 */
139 rtsBool fetch : 1; /* 64 */
140 rtsBool fish : 1; /* 128 */
141 rtsBool tables : 1; /* 256 */
142 rtsBool packet : 1; /* 512 */
143 rtsBool pack : 1; /* 1024 */
146 #define MAX_PAR_DEBUG_OPTION 10
147 #define PAR_DEBUG_MASK(n) ((nat)(ldexp(1,n)))
148 #define MAX_PAR_DEBUG_MASK ((nat)(ldexp(1,(MAX_PAR_DEBUG_OPTION+1))-1))
151 struct PAR_STATS_FLAGS ParStats; /* profile and stats output */
152 struct PAR_DEBUG_FLAGS Debug; /* debugging options */
153 rtsBool outputDisabled; /* Disable output for performance purposes */
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;
287 rtsBool showTickyStats;
290 #endif /* TICKY_TICKY */
293 /* Put them together: */
296 struct GC_FLAGS GcFlags;
297 struct DEBUG_FLAGS DebugFlags;
298 struct CONCURRENT_FLAGS ConcFlags;
300 #if defined(PROFILING) || defined(PAR)
301 struct COST_CENTRE_FLAGS CcFlags;
303 #if defined(PROFILING) || defined(DEBUG)
304 struct PROFILING_FLAGS ProfFlags;
306 #if defined(SMP) || defined(PAR)
307 struct PAR_FLAGS ParFlags;
310 struct GRAN_FLAGS GranFlags;
313 struct TICKY_FLAGS TickyFlags;
317 #ifdef COMPILING_RTS_MAIN
318 extern DLLIMPORT struct RTS_FLAGS RtsFlags;
320 extern struct RTS_FLAGS RtsFlags;
323 /* Routines that operate-on/to-do-with RTS flags: */
325 void initRtsFlagsDefaults(void);
326 void setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[]);
329 * The printf formats are here, so we are less likely to make
330 * overly-long filenames (with disastrous results). No more than 128
334 #define STATS_FILENAME_MAXLEN 128
336 #define GR_FILENAME_FMT "%0.124s.gr"
337 #define GR_FILENAME_FMT_GUM "%0.120s.%03d.%s"
338 #define HP_FILENAME_FMT "%0.124s.hp"
339 #define LIFE_FILENAME_FMT "%0.122s.life"
340 #define PROF_FILENAME_FMT "%0.122s.prof"
341 #define PROF_FILENAME_FMT_GUM "%0.118s.%03d.prof"
342 #define QP_FILENAME_FMT "%0.124s.qp"
343 #define STAT_FILENAME_FMT "%0.122s.stat"
344 #define TICKY_FILENAME_FMT "%0.121s.ticky"
345 #define TIME_FILENAME_FMT "%0.122s.time"
346 #define TIME_FILENAME_FMT_GUM "%0.118s.%03d.time"
348 /* an "int" so as to match normal "argc" */
349 /* Now defined in Stg.h (lib/std/cbits need these too.)
350 extern int prog_argc;
351 extern char **prog_argv;
353 extern int rts_argc; /* ditto */
354 extern char *rts_argv[];
356 #endif /* RTSFLAGS_H */