1 /* -----------------------------------------------------------------------------
2 * $Id: RtsFlags.h,v 1.19 2000/01/12 15:15:17 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 */
64 #if defined(PROFILING) || defined(PAR)
65 /* with PROFILING, full cost-centre stuff (also PROFILING_FLAGS);
66 with PAR, just the four fixed cost-centres.
68 struct COST_CENTRE_FLAGS {
69 unsigned int doCostCentres;
70 # define COST_CENTRES_SUMMARY 1
71 # define COST_CENTRES_VERBOSE 2 /* incl. serial time profile */
72 # define COST_CENTRES_ALL 3
75 # define SORTCC_LABEL 'C'
76 # define SORTCC_TIME 'T'
77 # define SORTCC_ALLOC 'A'
79 int ctxtSwitchTicks; /* derived */
80 int profilerTicks; /* derived */
81 int msecsPerTick; /* derived */
86 struct PROFILING_FLAGS {
87 unsigned int doHeapProfile;
89 # define NO_HEAP_PROFILING 0 /* N.B. Used as indexes into arrays */
90 # define HEAP_BY_CCS 1
91 # define HEAP_BY_MOD 2
92 # define HEAP_BY_GRP 3
93 # define HEAP_BY_DESCR 4
94 # define HEAP_BY_TYPE 5
95 # define HEAP_BY_TIME 6
97 rtsBool showCCSOnException;
102 # define DESCRchar 'D'
103 # define TYPEchar 'Y'
104 # define TIMEchar 'T'
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 */
120 #endif /* DEBUG || PROFILING */
122 struct CONCURRENT_FLAGS {
123 int ctxtSwitchTime; /* in milliseconds */
128 rtsBool parallelStats; /* Gather parallel statistics */
129 rtsBool granSimStats; /* Full .gr profile (rtsTrue) or only END events? */
130 rtsBool granSimStats_Binary;
132 rtsBool outputDisabled; /* Disable output for performance purposes */
134 unsigned int packBufferSize;
135 unsigned int maxLocalSparks;
141 nat nNodes; /* number of threads to run simultaneously */
142 unsigned int maxLocalSparks;
148 rtsBool granSimStats; /* Full .gr profile (rtsTrue) or only END events? */
149 rtsBool granSimStats_suppressed; /* No .gr profile at all */
150 rtsBool granSimStats_Binary;
151 rtsBool granSimStats_Sparks;
152 rtsBool granSimStats_Heap;
154 unsigned int packBufferSize;
155 unsigned int packBufferSize_internal;
157 int proc; /* number of processors */
158 int max_fishes; /* max number of spark or thread steals */
159 TIME time_slice; /* max time slice of one reduction thread */
161 /* Communication Cost Variables -- set in main program */
162 unsigned int gran_latency; /* Latency for single packet */
163 unsigned int gran_additional_latency; /* Latency for additional packets */
164 unsigned int gran_fetchtime;
165 unsigned int gran_lunblocktime; /* Time for local unblock */
166 unsigned int gran_gunblocktime; /* Time for global unblock */
167 unsigned int gran_mpacktime; /* Cost of creating a packet */
168 unsigned int gran_munpacktime; /* Cost of receiving a packet */
169 unsigned int gran_mtidytime; /* Cost of cleaning up after send */
171 unsigned int gran_threadcreatetime; /* Thread creation costs */
172 unsigned int gran_threadqueuetime; /* Cost of adding a thread to the running/runnable queue */
173 unsigned int gran_threaddescheduletime; /* Cost of descheduling a thread */
174 unsigned int gran_threadscheduletime; /* Cost of scheduling a thread */
175 unsigned int gran_threadcontextswitchtime; /* Cost of context switch */
177 /* Instruction Costs */
178 unsigned int gran_arith_cost; /* arithmetic instructions (+,i,< etc) */
179 unsigned int gran_branch_cost; /* branch instructions */
180 unsigned int gran_load_cost; /* load into register */
181 unsigned int gran_store_cost; /* store into memory */
182 unsigned int gran_float_cost; /* floating point operations */
184 unsigned int gran_heapalloc_cost; /* heap allocation costs */
186 /* Overhead for granularity control mechanisms */
187 /* overhead per elem of spark queue */
188 unsigned int gran_pri_spark_overhead;
189 /* overhead per elem of thread queue */
190 unsigned int gran_pri_sched_overhead;
192 /* GrAnSim-Light: This version puts no bound on the number of
193 processors but in exchange doesn't model communication costs
194 (all communication is 0 cost). Mainly intended to show maximal
195 degree of parallelism in the program (*not* to simulate the
196 execution on a real machine). */
200 rtsBool DoFairSchedule ; /* fair scheduling alg? default: unfair */
201 rtsBool DoReScheduleOnFetch ; /* async. communication? */
202 rtsBool DoStealThreadsFirst; /* prefer threads over sparks when stealing */
203 rtsBool SimplifiedFetch; /* fast but inaccurate fetch modelling */
204 rtsBool DoAlwaysCreateThreads; /* eager thread creation */
205 rtsBool DoGUMMFetching; /* bulk fetching */
206 rtsBool DoThreadMigration; /* allow to move threads */
207 int FetchStrategy; /* what to do when waiting for data */
208 rtsBool PreferSparksOfLocalNodes; /* prefer local over global sparks */
209 rtsBool DoPrioritySparking; /* sparks sorted by priorities */
210 rtsBool DoPriorityScheduling; /* threads sorted by priorities */
211 int SparkPriority; /* threshold for cut-off mechanism */
213 rtsBool RandomPriorities;
214 rtsBool InversePriorities;
215 rtsBool IgnorePriorities;
216 int ThunksToPack; /* number of thunks in packet + 1 */
217 rtsBool RandomSteal; /* steal spark/thread from random proc */
218 rtsBool NoForward; /* no forwarding of fetch messages */
219 rtsBool PrintFetchMisses; /* print number of fetch misses */
223 rtsBool event_trace_all;
230 rtsBool showTickyStats;
233 #endif /* TICKY_TICKY */
236 /* Put them together: */
239 struct GC_FLAGS GcFlags;
240 struct DEBUG_FLAGS DebugFlags;
241 struct CONCURRENT_FLAGS ConcFlags;
243 #if defined(PROFILING) || defined(PAR)
244 struct COST_CENTRE_FLAGS CcFlags;
246 #if defined(PROFILING) || defined(DEBUG)
247 struct PROFILING_FLAGS ProfFlags;
249 #if defined(SMP) || defined(PAR)
250 struct PAR_FLAGS ParFlags;
253 struct GRAN_FLAGS GranFlags;
256 struct TICKY_FLAGS TickyFlags;
260 #ifdef COMPILING_RTS_MAIN
261 extern DLLIMPORT struct RTS_FLAGS RtsFlags;
263 extern struct RTS_FLAGS RtsFlags;
266 /* Routines that operate-on/to-do-with RTS flags: */
268 void initRtsFlagsDefaults(void);
269 void setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[]);
272 * The printf formats are here, so we are less likely to make
273 * overly-long filenames (with disastrous results). No more than 128
277 #define STATS_FILENAME_MAXLEN 128
279 #define GR_FILENAME_FMT "%0.124s.gr"
280 #define GR_FILENAME_FMT_GUM "%0.120s.%03d.%s"
281 #define HP_FILENAME_FMT "%0.124s.hp"
282 #define LIFE_FILENAME_FMT "%0.122s.life"
283 #define PROF_FILENAME_FMT "%0.122s.prof"
284 #define PROF_FILENAME_FMT_GUM "%0.118s.%03d.prof"
285 #define QP_FILENAME_FMT "%0.124s.qp"
286 #define STAT_FILENAME_FMT "%0.122s.stat"
287 #define TICKY_FILENAME_FMT "%0.121s.ticky"
288 #define TIME_FILENAME_FMT "%0.122s.time"
289 #define TIME_FILENAME_FMT_GUM "%0.118s.%03d.time"
291 /* an "int" so as to match normal "argc" */
292 /* Now defined in Stg.h (lib/std/cbits need these too.)
293 extern int prog_argc;
294 extern char **prog_argv;
296 extern int rts_argc; /* ditto */
297 extern char *rts_argv[];
299 #endif /* RTSFLAGS_H */