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