1 /* -----------------------------------------------------------------------------
2 * $Id: RtsFlags.h,v 1.4 1999/01/19 15:07:55 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 */
54 #if defined(PROFILING) || defined(PAR)
55 /* with PROFILING, full cost-centre stuff (also PROFILING_FLAGS);
56 with PAR, just the four fixed cost-centres.
58 struct COST_CENTRE_FLAGS {
59 unsigned int doCostCentres;
60 # define COST_CENTRES_SUMMARY 1
61 # define COST_CENTRES_VERBOSE 2 /* incl. serial time profile */
62 # define COST_CENTRES_ALL 3
65 # define SORTCC_LABEL 'C'
66 # define SORTCC_TIME 'T'
67 # define SORTCC_ALLOC 'A'
69 int ctxtSwitchTicks; /* derived */
70 int profilerTicks; /* derived */
71 int msecsPerTick; /* derived */
76 struct PROFILING_FLAGS {
77 unsigned int doHeapProfile;
78 # define NO_HEAP_PROFILING 0 /* N.B. Used as indexes into arrays */
80 # define HEAP_BY_MOD 2
81 # define HEAP_BY_GRP 3
82 # define HEAP_BY_DESCR 4
83 # define HEAP_BY_TYPE 5
84 # define HEAP_BY_TIME 6
89 # define DESCRchar 'D'
101 # define NO_HEAP_PROFILING 0
102 # define HEAP_BY_INFOPTR 1
103 # define HEAP_BY_CLOSURE_TYPE 2
104 struct PROFILING_FLAGS {
105 unsigned int doHeapProfile; /* heap profile using symbol table */
107 #endif /* DEBUG || PROFILING */
109 struct CONCURRENT_FLAGS {
110 int ctxtSwitchTime; /* in milliseconds */
116 rtsBool parallelStats; /* Gather parallel statistics */
117 rtsBool granSimStats; /* Full .gr profile (rtsTrue) or only END events? */
118 rtsBool granSimStats_Binary;
120 rtsBool outputDisabled; /* Disable output for performance purposes */
122 unsigned int packBufferSize;
123 unsigned int maxLocalSparks;
130 rtsBool granSimStats; /* Full .gr profile (rtsTrue) or only END events? */
131 rtsBool granSimStats_suppressed; /* No .gr profile at all */
132 rtsBool granSimStats_Binary;
133 rtsBool granSimStats_Sparks;
134 rtsBool granSimStats_Heap;
136 unsigned int packBufferSize;
137 unsigned int packBufferSize_internal;
139 int proc; /* number of processors */
140 int max_fishes; /* max number of spark or thread steals */
141 TIME time_slice; /* max time slice of one reduction thread */
143 /* Communication Cost Variables -- set in main program */
144 unsigned int gran_latency; /* Latency for single packet */
145 unsigned int gran_additional_latency; /* Latency for additional packets */
146 unsigned int gran_fetchtime;
147 unsigned int gran_lunblocktime; /* Time for local unblock */
148 unsigned int gran_gunblocktime; /* Time for global unblock */
149 unsigned int gran_mpacktime; /* Cost of creating a packet */
150 unsigned int gran_munpacktime; /* Cost of receiving a packet */
151 unsigned int gran_mtidytime; /* Cost of cleaning up after send */
153 unsigned int gran_threadcreatetime; /* Thread creation costs */
154 unsigned int gran_threadqueuetime; /* Cost of adding a thread to the running/runnable queue */
155 unsigned int gran_threaddescheduletime; /* Cost of descheduling a thread */
156 unsigned int gran_threadscheduletime; /* Cost of scheduling a thread */
157 unsigned int gran_threadcontextswitchtime; /* Cost of context switch */
159 /* Instruction Costs */
160 unsigned int gran_arith_cost; /* arithmetic instructions (+,i,< etc) */
161 unsigned int gran_branch_cost; /* branch instructions */
162 unsigned int gran_load_cost; /* load into register */
163 unsigned int gran_store_cost; /* store into memory */
164 unsigned int gran_float_cost; /* floating point operations */
166 unsigned int gran_heapalloc_cost; /* heap allocation costs */
168 /* Overhead for granularity control mechanisms */
169 /* overhead per elem of spark queue */
170 unsigned int gran_pri_spark_overhead;
171 /* overhead per elem of thread queue */
172 unsigned int gran_pri_sched_overhead;
174 /* GrAnSim-Light: This version puts no bound on the number of
175 processors but in exchange doesn't model communication costs
176 (all communication is 0 cost). Mainly intended to show maximal
177 degree of parallelism in the program (*not* to simulate the
178 execution on a real machine). */
182 rtsBool DoFairSchedule ; /* fair scheduling alg? default: unfair */
183 rtsBool DoReScheduleOnFetch ; /* async. communication? */
184 rtsBool DoStealThreadsFirst; /* prefer threads over sparks when stealing */
185 rtsBool SimplifiedFetch; /* fast but inaccurate fetch modelling */
186 rtsBool DoAlwaysCreateThreads; /* eager thread creation */
187 rtsBool DoGUMMFetching; /* bulk fetching */
188 rtsBool DoThreadMigration; /* allow to move threads */
189 int FetchStrategy; /* what to do when waiting for data */
190 rtsBool PreferSparksOfLocalNodes; /* prefer local over global sparks */
191 rtsBool DoPrioritySparking; /* sparks sorted by priorities */
192 rtsBool DoPriorityScheduling; /* threads sorted by priorities */
193 int SparkPriority; /* threshold for cut-off mechanism */
195 rtsBool RandomPriorities;
196 rtsBool InversePriorities;
197 rtsBool IgnorePriorities;
198 int ThunksToPack; /* number of thunks in packet + 1 */
199 rtsBool RandomSteal; /* steal spark/thread from random proc */
200 rtsBool NoForward; /* no forwarding of fetch messages */
201 rtsBool PrintFetchMisses; /* print number of fetch misses */
205 rtsBool event_trace_all;
212 rtsBool showTickyStats;
215 /* see also: doUpdEntryCounts in AllFlags */
217 #endif /* TICKY_TICKY */
220 /* Put them together: */
223 struct GC_FLAGS GcFlags;
224 struct DEBUG_FLAGS DebugFlags; /* unused at present */
225 struct CONCURRENT_FLAGS ConcFlags;
227 #if defined(PROFILING) || defined(PAR)
228 struct COST_CENTRE_FLAGS CcFlags;
230 #if defined(PROFILING) || defined(DEBUG)
231 struct PROFILING_FLAGS ProfFlags;
234 struct PAR_FLAGS ParFlags;
237 struct GRAN_FLAGS GranFlags;
240 struct TICKY_FLAGS TickyFlags;
244 extern struct RTS_FLAGS RtsFlags;
246 /* Routines that operate-on/to-do-with RTS flags: */
248 void initRtsFlagsDefaults(void);
249 void setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[]);
252 * The printf formats are here, so we are less likely to make
253 * overly-long filenames (with disastrous results). No more than 128
257 #define STATS_FILENAME_MAXLEN 128
259 #define GR_FILENAME_FMT "%0.124s.gr"
260 #define GR_FILENAME_FMT_GUM "%0.120s.%03d.%s"
261 #define HP_FILENAME_FMT "%0.124s.hp"
262 #define LIFE_FILENAME_FMT "%0.122s.life"
263 #define PROF_FILENAME_FMT "%0.122s.prof"
264 #define PROF_FILENAME_FMT_GUM "%0.118s.%03d.prof"
265 #define QP_FILENAME_FMT "%0.124s.qp"
266 #define STAT_FILENAME_FMT "%0.122s.stat"
267 #define TICKY_FILENAME_FMT "%0.121s.ticky"
268 #define TIME_FILENAME_FMT "%0.122s.time"
269 #define TIME_FILENAME_FMT_GUM "%0.118s.%03d.time"
271 extern int prog_argc; /* an "int" so as to match normal "argc" */
272 extern char **prog_argv;
273 extern int rts_argc; /* ditto */
274 extern char *rts_argv[];
276 #endif /* RTSFLAGS_H */