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