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