1 /* -----------------------------------------------------------------------------
2 * $Id: RtsFlags.h,v 1.6 1999/01/26 11:12:46 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* */
24 nat minOldGenSize; /* in *blocks* */
30 rtsBool forceGC; /* force a major GC every <interval> bytes */
31 int forcingInterval; /* actually, stored as a number of *words* */
34 rtsBool squeezeUpdFrames;
37 /* Hack: this struct uses bitfields so that we can use a binary arg
41 /* flags to control debugging output in various subsystems */
42 rtsBool scheduler : 1; /* 1 */
43 rtsBool evaluator : 1; /* 2 */
44 rtsBool codegen : 1; /* 4 */
45 rtsBool weak : 1; /* 8 */
46 rtsBool gccafs : 1; /* 16 */
47 rtsBool gc : 1; /* 32 */
48 rtsBool block_alloc : 1; /* 64 */
50 /* flags to control consistency checking (often very expensive!) */
51 rtsBool sanity : 1; /* 128 */
53 rtsBool stable : 1; /* 256 */
56 #if defined(PROFILING) || defined(PAR)
57 /* with PROFILING, full cost-centre stuff (also PROFILING_FLAGS);
58 with PAR, just the four fixed cost-centres.
60 struct COST_CENTRE_FLAGS {
61 unsigned int doCostCentres;
62 # define COST_CENTRES_SUMMARY 1
63 # define COST_CENTRES_VERBOSE 2 /* incl. serial time profile */
64 # define COST_CENTRES_ALL 3
67 # define SORTCC_LABEL 'C'
68 # define SORTCC_TIME 'T'
69 # define SORTCC_ALLOC 'A'
71 int ctxtSwitchTicks; /* derived */
72 int profilerTicks; /* derived */
73 int msecsPerTick; /* derived */
78 struct PROFILING_FLAGS {
79 unsigned int doHeapProfile;
80 # define NO_HEAP_PROFILING 0 /* N.B. Used as indexes into arrays */
82 # define HEAP_BY_MOD 2
83 # define HEAP_BY_GRP 3
84 # define HEAP_BY_DESCR 4
85 # define HEAP_BY_TYPE 5
86 # define HEAP_BY_TIME 6
91 # define DESCRchar 'D'
103 # define NO_HEAP_PROFILING 0
104 # define HEAP_BY_INFOPTR 1
105 # define HEAP_BY_CLOSURE_TYPE 2
106 struct PROFILING_FLAGS {
107 unsigned int doHeapProfile; /* heap profile using symbol table */
109 #endif /* DEBUG || PROFILING */
111 struct CONCURRENT_FLAGS {
112 int ctxtSwitchTime; /* in milliseconds */
118 rtsBool parallelStats; /* Gather parallel statistics */
119 rtsBool granSimStats; /* Full .gr profile (rtsTrue) or only END events? */
120 rtsBool granSimStats_Binary;
122 rtsBool outputDisabled; /* Disable output for performance purposes */
124 unsigned int packBufferSize;
125 unsigned int maxLocalSparks;
132 rtsBool granSimStats; /* Full .gr profile (rtsTrue) or only END events? */
133 rtsBool granSimStats_suppressed; /* No .gr profile at all */
134 rtsBool granSimStats_Binary;
135 rtsBool granSimStats_Sparks;
136 rtsBool granSimStats_Heap;
138 unsigned int packBufferSize;
139 unsigned int packBufferSize_internal;
141 int proc; /* number of processors */
142 int max_fishes; /* max number of spark or thread steals */
143 TIME time_slice; /* max time slice of one reduction thread */
145 /* Communication Cost Variables -- set in main program */
146 unsigned int gran_latency; /* Latency for single packet */
147 unsigned int gran_additional_latency; /* Latency for additional packets */
148 unsigned int gran_fetchtime;
149 unsigned int gran_lunblocktime; /* Time for local unblock */
150 unsigned int gran_gunblocktime; /* Time for global unblock */
151 unsigned int gran_mpacktime; /* Cost of creating a packet */
152 unsigned int gran_munpacktime; /* Cost of receiving a packet */
153 unsigned int gran_mtidytime; /* Cost of cleaning up after send */
155 unsigned int gran_threadcreatetime; /* Thread creation costs */
156 unsigned int gran_threadqueuetime; /* Cost of adding a thread to the running/runnable queue */
157 unsigned int gran_threaddescheduletime; /* Cost of descheduling a thread */
158 unsigned int gran_threadscheduletime; /* Cost of scheduling a thread */
159 unsigned int gran_threadcontextswitchtime; /* Cost of context switch */
161 /* Instruction Costs */
162 unsigned int gran_arith_cost; /* arithmetic instructions (+,i,< etc) */
163 unsigned int gran_branch_cost; /* branch instructions */
164 unsigned int gran_load_cost; /* load into register */
165 unsigned int gran_store_cost; /* store into memory */
166 unsigned int gran_float_cost; /* floating point operations */
168 unsigned int gran_heapalloc_cost; /* heap allocation costs */
170 /* Overhead for granularity control mechanisms */
171 /* overhead per elem of spark queue */
172 unsigned int gran_pri_spark_overhead;
173 /* overhead per elem of thread queue */
174 unsigned int gran_pri_sched_overhead;
176 /* GrAnSim-Light: This version puts no bound on the number of
177 processors but in exchange doesn't model communication costs
178 (all communication is 0 cost). Mainly intended to show maximal
179 degree of parallelism in the program (*not* to simulate the
180 execution on a real machine). */
184 rtsBool DoFairSchedule ; /* fair scheduling alg? default: unfair */
185 rtsBool DoReScheduleOnFetch ; /* async. communication? */
186 rtsBool DoStealThreadsFirst; /* prefer threads over sparks when stealing */
187 rtsBool SimplifiedFetch; /* fast but inaccurate fetch modelling */
188 rtsBool DoAlwaysCreateThreads; /* eager thread creation */
189 rtsBool DoGUMMFetching; /* bulk fetching */
190 rtsBool DoThreadMigration; /* allow to move threads */
191 int FetchStrategy; /* what to do when waiting for data */
192 rtsBool PreferSparksOfLocalNodes; /* prefer local over global sparks */
193 rtsBool DoPrioritySparking; /* sparks sorted by priorities */
194 rtsBool DoPriorityScheduling; /* threads sorted by priorities */
195 int SparkPriority; /* threshold for cut-off mechanism */
197 rtsBool RandomPriorities;
198 rtsBool InversePriorities;
199 rtsBool IgnorePriorities;
200 int ThunksToPack; /* number of thunks in packet + 1 */
201 rtsBool RandomSteal; /* steal spark/thread from random proc */
202 rtsBool NoForward; /* no forwarding of fetch messages */
203 rtsBool PrintFetchMisses; /* print number of fetch misses */
207 rtsBool event_trace_all;
214 rtsBool showTickyStats;
217 /* see also: doUpdEntryCounts in AllFlags */
219 #endif /* TICKY_TICKY */
222 /* Put them together: */
225 struct GC_FLAGS GcFlags;
226 struct DEBUG_FLAGS DebugFlags;
227 struct CONCURRENT_FLAGS ConcFlags;
229 #if defined(PROFILING) || defined(PAR)
230 struct COST_CENTRE_FLAGS CcFlags;
232 #if defined(PROFILING) || defined(DEBUG)
233 struct PROFILING_FLAGS ProfFlags;
236 struct PAR_FLAGS ParFlags;
239 struct GRAN_FLAGS GranFlags;
242 struct TICKY_FLAGS TickyFlags;
246 extern struct RTS_FLAGS RtsFlags;
248 /* Routines that operate-on/to-do-with RTS flags: */
250 void initRtsFlagsDefaults(void);
251 void setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[]);
254 * The printf formats are here, so we are less likely to make
255 * overly-long filenames (with disastrous results). No more than 128
259 #define STATS_FILENAME_MAXLEN 128
261 #define GR_FILENAME_FMT "%0.124s.gr"
262 #define GR_FILENAME_FMT_GUM "%0.120s.%03d.%s"
263 #define HP_FILENAME_FMT "%0.124s.hp"
264 #define LIFE_FILENAME_FMT "%0.122s.life"
265 #define PROF_FILENAME_FMT "%0.122s.prof"
266 #define PROF_FILENAME_FMT_GUM "%0.118s.%03d.prof"
267 #define QP_FILENAME_FMT "%0.124s.qp"
268 #define STAT_FILENAME_FMT "%0.122s.stat"
269 #define TICKY_FILENAME_FMT "%0.121s.ticky"
270 #define TIME_FILENAME_FMT "%0.122s.time"
271 #define TIME_FILENAME_FMT_GUM "%0.118s.%03d.time"
273 extern int prog_argc; /* an "int" so as to match normal "argc" */
274 extern char **prog_argv;
275 extern int rts_argc; /* ditto */
276 extern char *rts_argv[];
278 #endif /* RTSFLAGS_H */