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