1 /* -----------------------------------------------------------------------------
2 * $Id: RtsFlags.h,v 1.2 1998/12/02 13:28:40 simonm Exp $
4 * Datatypes that holds the command-line flag settings.
6 * ---------------------------------------------------------------------------*/
11 /* For defaults, see the @initRtsFlagsDefaults@ routine. */
15 nat giveStats; /* ToDo: replace with enum type? */
17 #define VERBOSE_GC_STATS 1
19 nat maxStkSize; /* in *words* */
20 nat initialStkSize; /* in *words* */
22 nat maxHeapSize; /* in *blocks* */
23 nat minAllocAreaSize; /* in *blocks* */
26 rtsBool force2s; /* force the use of 2-space copying collection;
27 forced to rtsTrue if we do *heap* profiling.
29 rtsBool forceGC; /* force a major GC every <interval> bytes */
30 int forcingInterval; /* actually, stored as a number of *words* */
33 rtsBool squeezeUpdFrames;
36 /* Hack: this struct uses bitfields so that we can use a binary arg
40 /* flags to control debugging output in various subsystems */
41 rtsBool scheduler : 1; /* 1 */
42 rtsBool evaluator : 1; /* 2 */
43 rtsBool codegen : 1; /* 4 */
44 rtsBool weak : 1; /* 8 */
45 rtsBool gccafs : 1; /* 16 */
46 rtsBool gc : 1; /* 32 */
47 rtsBool block_alloc : 1; /* 64 */
49 /* flags to control consistency checking (often very expensive!) */
50 rtsBool sanity : 1; /* 128 */
53 #if defined(PROFILING) || defined(PAR)
54 /* with PROFILING, full cost-centre stuff (also PROFILING_FLAGS);
55 with PAR, just the four fixed cost-centres.
57 struct COST_CENTRE_FLAGS {
58 unsigned int doCostCentres;
59 # define COST_CENTRES_SUMMARY 1
60 # define COST_CENTRES_VERBOSE 2 /* incl. serial time profile */
61 # define COST_CENTRES_ALL 3
64 # define SORTCC_LABEL 'C'
65 # define SORTCC_TIME 'T'
66 # define SORTCC_ALLOC 'A'
68 int ctxtSwitchTicks; /* derived */
69 int profilerTicks; /* derived */
70 int msecsPerTick; /* derived */
75 struct PROFILING_FLAGS {
76 unsigned int doHeapProfile;
77 # define NO_HEAP_PROFILING 0 /* N.B. Used as indexes into arrays */
79 # define HEAP_BY_MOD 2
80 # define HEAP_BY_GRP 3
81 # define HEAP_BY_DESCR 4
82 # define HEAP_BY_TYPE 5
83 # define HEAP_BY_TIME 6
88 # define DESCRchar 'D'
100 # define NO_HEAP_PROFILING 0
101 # define HEAP_BY_INFOPTR 1
102 # define HEAP_BY_CLOSURE_TYPE 2
103 struct PROFILING_FLAGS {
104 unsigned int doHeapProfile; /* heap profile using symbol table */
106 #endif /* DEBUG || PROFILING */
108 struct CONCURRENT_FLAGS {
109 int ctxtSwitchTime; /* in milliseconds */
115 rtsBool parallelStats; /* Gather parallel statistics */
116 rtsBool granSimStats; /* Full .gr profile (rtsTrue) or only END events? */
117 rtsBool granSimStats_Binary;
119 rtsBool outputDisabled; /* Disable output for performance purposes */
121 unsigned int packBufferSize;
122 unsigned int maxLocalSparks;
129 rtsBool granSimStats; /* Full .gr profile (rtsTrue) or only END events? */
130 rtsBool granSimStats_suppressed; /* No .gr profile at all */
131 rtsBool granSimStats_Binary;
132 rtsBool granSimStats_Sparks;
133 rtsBool granSimStats_Heap;
135 unsigned int packBufferSize;
136 unsigned int packBufferSize_internal;
138 int proc; /* number of processors */
139 int max_fishes; /* max number of spark or thread steals */
140 TIME time_slice; /* max time slice of one reduction thread */
142 /* Communication Cost Variables -- set in main program */
143 unsigned int gran_latency; /* Latency for single packet */
144 unsigned int gran_additional_latency; /* Latency for additional packets */
145 unsigned int gran_fetchtime;
146 unsigned int gran_lunblocktime; /* Time for local unblock */
147 unsigned int gran_gunblocktime; /* Time for global unblock */
148 unsigned int gran_mpacktime; /* Cost of creating a packet */
149 unsigned int gran_munpacktime; /* Cost of receiving a packet */
150 unsigned int gran_mtidytime; /* Cost of cleaning up after send */
152 unsigned int gran_threadcreatetime; /* Thread creation costs */
153 unsigned int gran_threadqueuetime; /* Cost of adding a thread to the running/runnable queue */
154 unsigned int gran_threaddescheduletime; /* Cost of descheduling a thread */
155 unsigned int gran_threadscheduletime; /* Cost of scheduling a thread */
156 unsigned int gran_threadcontextswitchtime; /* Cost of context switch */
158 /* Instruction Costs */
159 unsigned int gran_arith_cost; /* arithmetic instructions (+,i,< etc) */
160 unsigned int gran_branch_cost; /* branch instructions */
161 unsigned int gran_load_cost; /* load into register */
162 unsigned int gran_store_cost; /* store into memory */
163 unsigned int gran_float_cost; /* floating point operations */
165 unsigned int gran_heapalloc_cost; /* heap allocation costs */
167 /* Overhead for granularity control mechanisms */
168 /* overhead per elem of spark queue */
169 unsigned int gran_pri_spark_overhead;
170 /* overhead per elem of thread queue */
171 unsigned int gran_pri_sched_overhead;
173 /* GrAnSim-Light: This version puts no bound on the number of
174 processors but in exchange doesn't model communication costs
175 (all communication is 0 cost). Mainly intended to show maximal
176 degree of parallelism in the program (*not* to simulate the
177 execution on a real machine). */
181 rtsBool DoFairSchedule ; /* fair scheduling alg? default: unfair */
182 rtsBool DoReScheduleOnFetch ; /* async. communication? */
183 rtsBool DoStealThreadsFirst; /* prefer threads over sparks when stealing */
184 rtsBool SimplifiedFetch; /* fast but inaccurate fetch modelling */
185 rtsBool DoAlwaysCreateThreads; /* eager thread creation */
186 rtsBool DoGUMMFetching; /* bulk fetching */
187 rtsBool DoThreadMigration; /* allow to move threads */
188 int FetchStrategy; /* what to do when waiting for data */
189 rtsBool PreferSparksOfLocalNodes; /* prefer local over global sparks */
190 rtsBool DoPrioritySparking; /* sparks sorted by priorities */
191 rtsBool DoPriorityScheduling; /* threads sorted by priorities */
192 int SparkPriority; /* threshold for cut-off mechanism */
194 rtsBool RandomPriorities;
195 rtsBool InversePriorities;
196 rtsBool IgnorePriorities;
197 int ThunksToPack; /* number of thunks in packet + 1 */
198 rtsBool RandomSteal; /* steal spark/thread from random proc */
199 rtsBool NoForward; /* no forwarding of fetch messages */
200 rtsBool PrintFetchMisses; /* print number of fetch misses */
204 rtsBool event_trace_all;
211 rtsBool showTickyStats;
214 /* see also: doUpdEntryCounts in AllFlags */
216 #endif /* TICKY_TICKY */
219 /* Put them together: */
222 struct GC_FLAGS GcFlags;
223 struct DEBUG_FLAGS DebugFlags; /* unused at present */
224 struct CONCURRENT_FLAGS ConcFlags;
226 #if defined(PROFILING) || defined(PAR)
227 struct COST_CENTRE_FLAGS CcFlags;
229 #if defined(PROFILING) || defined(DEBUG)
230 struct PROFILING_FLAGS ProfFlags;
233 struct PAR_FLAGS ParFlags;
236 struct GRAN_FLAGS GranFlags;
239 struct TICKY_FLAGS TickyFlags;
243 extern struct RTS_FLAGS RtsFlags;
245 /* Routines that operate-on/to-do-with RTS flags: */
247 void initRtsFlagsDefaults(void);
248 void setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[]);
251 * The printf formats are here, so we are less likely to make
252 * overly-long filenames (with disastrous results). No more than 128
256 #define STATS_FILENAME_MAXLEN 128
258 #define GR_FILENAME_FMT "%0.124s.gr"
259 #define GR_FILENAME_FMT_GUM "%0.120s.%03d.%s"
260 #define HP_FILENAME_FMT "%0.124s.hp"
261 #define LIFE_FILENAME_FMT "%0.122s.life"
262 #define PROF_FILENAME_FMT "%0.122s.prof"
263 #define PROF_FILENAME_FMT_GUM "%0.118s.%03d.prof"
264 #define QP_FILENAME_FMT "%0.124s.qp"
265 #define STAT_FILENAME_FMT "%0.122s.stat"
266 #define TICKY_FILENAME_FMT "%0.121s.ticky"
267 #define TIME_FILENAME_FMT "%0.122s.time"
268 #define TIME_FILENAME_FMT_GUM "%0.118s.%03d.time"
270 extern int prog_argc; /* an "int" so as to match normal "argc" */
271 extern char **prog_argv;
272 extern int rts_argc; /* ditto */
273 extern char *rts_argv[];
275 #endif /* RTSFLAGS_H */