1 /* -----------------------------------------------------------------------------
2 * $Id: RtsFlags.h,v 1.29 2000/12/04 12:31:21 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* */
37 rtsBool squeezeUpdFrames;
39 #ifdef RTS_GTK_FRONTPANEL
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 #if defined(PROFILING) || defined(PAR)
76 /* with PROFILING, full cost-centre stuff (also PROFILING_FLAGS);
77 with PAR, just the four fixed cost-centres.
79 struct COST_CENTRE_FLAGS {
80 unsigned int doCostCentres;
81 # define COST_CENTRES_SUMMARY 1
82 # define COST_CENTRES_VERBOSE 2 /* incl. serial time profile */
83 # define COST_CENTRES_ALL 3
84 # define COST_CENTRES_XML 4
86 int profilerTicks; /* derived */
87 int msecsPerTick; /* derived */
92 struct PROFILING_FLAGS {
93 unsigned int doHeapProfile;
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
100 # define HEAP_BY_TIME 6
102 rtsBool showCCSOnException;
106 # define DESCRchar 'D'
107 # define TYPEchar 'Y'
108 # define TIMEchar 'T'
111 # define NO_HEAP_PROFILING 0
112 # define HEAP_BY_INFOPTR 1
113 # define HEAP_BY_CLOSURE_TYPE 2
114 struct PROFILING_FLAGS {
115 unsigned int doHeapProfile; /* heap profile using symbol table */
117 #endif /* DEBUG || PROFILING */
119 struct CONCURRENT_FLAGS {
120 int ctxtSwitchTime; /* in milliseconds */
121 int ctxtSwitchTicks; /* derived */
125 /* currently the same as GRAN_STATS_FLAGS */
126 struct PAR_STATS_FLAGS {
127 rtsBool Full; /* Full .gr profile (rtsTrue) or only END events? */
128 // rtsBool Suppressed; /* No .gr profile at all */
129 rtsBool Binary; /* Binary profile? (not yet implemented) */
130 rtsBool Sparks; /* Info on sparks in profile? */
131 rtsBool Heap; /* Info on heap allocs in profile? */
132 rtsBool NewLogfile; /* Use new log-file format? (not yet implemented) */
133 rtsBool Global; /* Global statistics? (printed on shutdown; no log file) */
136 struct PAR_DEBUG_FLAGS {
137 /* flags to control debugging output in various subsystems */
138 rtsBool verbose : 1; /* 1 */
139 rtsBool trace : 1; /* 2 */
140 rtsBool schedule : 1; /* 4 */
141 rtsBool free : 1; /* 8 */
142 rtsBool resume : 1; /* 16 */
143 rtsBool weight : 1; /* 32 */
144 rtsBool fetch : 1; /* 64 */
145 rtsBool fish : 1; /* 128 */
146 rtsBool tables : 1; /* 256 */
147 rtsBool packet : 1; /* 512 */
148 rtsBool pack : 1; /* 1024 */
151 #define MAX_PAR_DEBUG_OPTION 10
152 #define PAR_DEBUG_MASK(n) ((nat)(ldexp(1,n)))
153 #define MAX_PAR_DEBUG_MASK ((nat)(ldexp(1,(MAX_PAR_DEBUG_OPTION+1))-1))
156 struct PAR_STATS_FLAGS ParStats; /* profile and stats output */
157 struct PAR_DEBUG_FLAGS Debug; /* debugging options */
158 rtsBool outputDisabled; /* Disable output for performance purposes */
160 nat maxLocalSparks; /* spark pool size */
161 nat maxThreads; /* thread pool size */
162 nat maxFishes; /* max number of active fishes */
163 rtsTime fishDelay; /* delay before sending a new fish */
170 nat nNodes; /* number of threads to run simultaneously */
171 unsigned int maxLocalSparks;
176 struct GRAN_STATS_FLAGS {
177 rtsBool Full; /* Full .gr profile (rtsTrue) or only END events? */
178 rtsBool Suppressed; /* No .gr profile at all */
179 rtsBool Binary; /* Binary profile? (not yet implemented) */
180 rtsBool Sparks; /* Info on sparks in profile? */
181 rtsBool Heap; /* Info on heap allocs in profile? */
182 rtsBool NewLogfile; /* Use new log-file format? (not yet implemented) */
183 rtsBool Global; /* Global statistics? (printed on shutdown; no log file) */
186 struct GRAN_COST_FLAGS {
187 /* Communication Cost Variables -- set in main program */
188 nat latency; /* Latency for single packet */
189 nat additional_latency; /* Latency for additional packets */
191 nat lunblocktime; /* Time for local unblock */
192 nat gunblocktime; /* Time for global unblock */
193 nat mpacktime; /* Cost of creating a packet */
194 nat munpacktime; /* Cost of receiving a packet */
195 nat mtidytime; /* Cost of cleaning up after send */
197 nat threadcreatetime; /* Thread creation costs */
198 nat threadqueuetime; /* Cost of adding a thread to the running/runnable queue */
199 nat threaddescheduletime; /* Cost of descheduling a thread */
200 nat threadscheduletime; /* Cost of scheduling a thread */
201 nat threadcontextswitchtime; /* Cost of context switch */
203 /* Instruction Costs */
204 nat arith_cost; /* arithmetic instructions (+,i,< etc) */
205 nat branch_cost; /* branch instructions */
206 nat load_cost; /* load into register */
207 nat store_cost; /* store into memory */
208 nat float_cost; /* floating point operations */
210 nat heapalloc_cost; /* heap allocation costs */
212 /* Overhead for granularity control mechanisms */
213 /* overhead per elem of spark queue */
214 nat pri_spark_overhead;
215 /* overhead per elem of thread queue */
216 nat pri_sched_overhead;
219 struct GRAN_DEBUG_FLAGS {
220 /* flags to control debugging output in various subsystems */
221 rtsBool event_trace : 1; /* 1 */
222 rtsBool event_stats : 1; /* 2 */
223 rtsBool bq : 1; /* 4 */
224 rtsBool pack : 1; /* 8 */
225 rtsBool checkSparkQ : 1; /* 16 */
226 rtsBool thunkStealing : 1; /* 32 */
227 rtsBool randomSteal : 1; /* 64 */
228 rtsBool findWork : 1; /* 128 */
229 rtsBool unused : 1; /* 256 */
230 rtsBool pri : 1; /* 512 */
231 rtsBool checkLight : 1; /* 1024 */
232 rtsBool sortedQ : 1; /* 2048 */
233 rtsBool blockOnFetch : 1; /* 4096 */
234 rtsBool packBuffer : 1; /* 8192 */
235 rtsBool blockOnFetch_sanity : 1; /* 16384 */
238 #define MAX_GRAN_DEBUG_OPTION 14
239 #define GRAN_DEBUG_MASK(n) ((nat)(ldexp(1,n)))
240 #define MAX_GRAN_DEBUG_MASK ((nat)(ldexp(1,(MAX_GRAN_DEBUG_OPTION+1))-1))
243 struct GRAN_STATS_FLAGS GranSimStats; /* profile and stats output */
244 struct GRAN_COST_FLAGS Costs; /* cost metric for simulation */
245 struct GRAN_DEBUG_FLAGS Debug; /* debugging options */
247 nat maxThreads; // ToDo: share with SMP and GUM
248 // rtsBool labelling;
250 nat packBufferSize_internal;
252 PEs proc; /* number of processors */
253 rtsBool Fishing; /* Simulate GUM style fishing mechanism? */
254 nat maxFishes; /* max number of spark or thread steals */
255 rtsTime time_slice; /* max time slice of one reduction thread */
257 /* GrAnSim-Light: This version puts no bound on the number of
258 processors but in exchange doesn't model communication costs
259 (all communication is 0 cost). Mainly intended to show maximal
260 degree of parallelism in the program (*not* to simulate the
261 execution on a real machine). */
265 rtsBool DoFairSchedule ; /* fair scheduling alg? default: unfair */
266 rtsBool DoAsyncFetch; /* async. communication? */
267 rtsBool DoStealThreadsFirst; /* prefer threads over sparks when stealing */
268 rtsBool DoAlwaysCreateThreads; /* eager thread creation */
269 rtsBool DoBulkFetching; /* bulk fetching */
270 rtsBool DoThreadMigration; /* allow to move threads */
271 nat FetchStrategy; /* what to do when waiting for data */
272 rtsBool PreferSparksOfLocalNodes; /* prefer local over global sparks */
273 rtsBool DoPrioritySparking; /* sparks sorted by priorities */
274 rtsBool DoPriorityScheduling; /* threads sorted by priorities */
275 nat SparkPriority; /* threshold for cut-off mechanism */
277 rtsBool RandomPriorities;
278 rtsBool InversePriorities;
279 rtsBool IgnorePriorities;
280 nat ThunksToPack; /* number of thunks in packet + 1 */
281 rtsBool RandomSteal; /* steal spark/thread from random proc */
282 rtsBool NoForward; /* no forwarding of fetch messages */
284 // unsigned int debug;
285 // rtsBool event_trace;
286 // rtsBool event_trace_all;
292 rtsBool showTickyStats;
295 #endif /* TICKY_TICKY */
298 /* Put them together: */
301 struct GC_FLAGS GcFlags;
302 struct DEBUG_FLAGS DebugFlags;
303 struct CONCURRENT_FLAGS ConcFlags;
305 #if defined(PROFILING) || defined(PAR)
306 struct COST_CENTRE_FLAGS CcFlags;
308 #if defined(PROFILING) || defined(DEBUG)
309 struct PROFILING_FLAGS ProfFlags;
311 #if defined(SMP) || defined(PAR)
312 struct PAR_FLAGS ParFlags;
315 struct GRAN_FLAGS GranFlags;
318 struct TICKY_FLAGS TickyFlags;
322 #ifdef COMPILING_RTS_MAIN
323 extern DLLIMPORT struct RTS_FLAGS RtsFlags;
325 extern struct RTS_FLAGS RtsFlags;
328 /* Routines that operate-on/to-do-with RTS flags: */
330 void initRtsFlagsDefaults(void);
331 void setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[]);
334 * The printf formats are here, so we are less likely to make
335 * overly-long filenames (with disastrous results). No more than 128
339 #define STATS_FILENAME_MAXLEN 128
341 #define GR_FILENAME_FMT "%0.124s.gr"
342 #define GR_FILENAME_FMT_GUM "%0.120s.%03d.%s"
343 #define HP_FILENAME_FMT "%0.124s.hp"
344 #define LIFE_FILENAME_FMT "%0.122s.life"
345 #define PROF_FILENAME_FMT "%0.122s.prof"
346 #define PROF_FILENAME_FMT_GUM "%0.118s.%03d.prof"
347 #define QP_FILENAME_FMT "%0.124s.qp"
348 #define STAT_FILENAME_FMT "%0.122s.stat"
349 #define TICKY_FILENAME_FMT "%0.121s.ticky"
350 #define TIME_FILENAME_FMT "%0.122s.time"
351 #define TIME_FILENAME_FMT_GUM "%0.118s.%03d.time"
353 /* an "int" so as to match normal "argc" */
354 /* Now defined in Stg.h (lib/std/cbits need these too.)
355 extern int prog_argc;
356 extern char **prog_argv;
358 extern int rts_argc; /* ditto */
359 extern char *rts_argv[];
361 #endif /* RTSFLAGS_H */