1 /* -----------------------------------------------------------------------------
3 * (c) The GHC Team, 1998-1999
5 * Datatypes that holds the command-line flag settings.
7 * ---------------------------------------------------------------------------*/
14 /* For defaults, see the @initRtsFlagsDefaults@ routine. */
20 #define COLLECT_GC_STATS 1
21 #define ONELINE_GC_STATS 2
22 #define SUMMARY_GC_STATS 3
23 #define VERBOSE_GC_STATS 4
25 nat maxStkSize; /* in *words* */
26 nat initialStkSize; /* in *words* */
28 nat maxHeapSize; /* in *blocks* */
29 nat minAllocAreaSize; /* in *blocks* */
30 nat minOldGenSize; /* in *blocks* */
31 nat heapSizeSuggestion; /* in *blocks* */
37 rtsBool squeezeUpdFrames;
39 rtsBool compact; /* True <=> "compact all the time" */
40 double compactThreshold;
42 rtsBool sweep; /* use "mostly mark-sweep" instead of copying
43 * for the oldest generation */
47 int idleGCDelayTime; /* in milliseconds */
49 StgWord heapBase; /* address to ask the OS for memory */
53 /* flags to control debugging output & extra checking in various subsystems */
54 rtsBool scheduler; /* 's' */
55 rtsBool interpreter; /* 'i' */
56 rtsBool weak; /* 'w' */
57 rtsBool gccafs; /* 'G' */
59 rtsBool block_alloc; /* 'b' */
60 rtsBool sanity; /* 'S' warning: might be expensive! */
61 rtsBool stable; /* 't' */
62 rtsBool prof; /* 'p' */
63 rtsBool eventlog; /* 'e' */
64 rtsBool linker; /* 'l' the object linker */
65 rtsBool apply; /* 'a' */
66 rtsBool stm; /* 'm' */
67 rtsBool squeeze; /* 'z' stack squeezing & lazy blackholing */
68 rtsBool hpc; /* 'c' coverage */
69 rtsBool timestamp; /* add timestamps to traces */
72 struct COST_CENTRE_FLAGS {
73 unsigned int doCostCentres;
74 # define COST_CENTRES_SUMMARY 1
75 # define COST_CENTRES_VERBOSE 2 /* incl. serial time profile */
76 # define COST_CENTRES_ALL 3
77 # define COST_CENTRES_XML 4
79 int profilerTicks; /* derived */
80 int msecsPerTick; /* derived */
83 struct PROFILING_FLAGS {
84 unsigned int doHeapProfile;
85 # define NO_HEAP_PROFILING 0 /* N.B. Used as indexes into arrays */
86 # define HEAP_BY_CCS 1
87 # define HEAP_BY_MOD 2
88 # define HEAP_BY_DESCR 4
89 # define HEAP_BY_TYPE 5
90 # define HEAP_BY_RETAINER 6
91 # define HEAP_BY_LDV 7
93 # define HEAP_BY_CLOSURE_TYPE 8
95 nat profileInterval; /* delta between samples (in ms) */
96 nat profileIntervalTicks; /* delta between samples (in 'ticks') */
100 rtsBool showCCSOnException;
102 nat maxRetainerSetSize;
111 char* retainerSelector;
117 struct EVENTLOG_FLAGS {
118 rtsBool doEventLogging;
122 struct CONCURRENT_FLAGS {
123 int ctxtSwitchTime; /* in milliseconds */
124 int ctxtSwitchTicks; /* derived */
128 int tickInterval; /* in milliseconds */
129 rtsBool install_signal_handlers;
130 rtsBool machineReadable;
131 StgWord linkerMemBase; /* address to ask the OS for memory
132 * for the linker, NULL ==> off */
137 nat nNodes; /* number of threads to run simultaneously */
138 rtsBool migrate; /* migrate threads between capabilities */
139 rtsBool wakeupMigrate; /* migrate a thread on wakeup */
140 unsigned int maxLocalSparks;
141 rtsBool parGcEnabled; /* enable parallel GC */
142 rtsBool parGcGen; /* do parallel GC in this generation
144 rtsBool parGcLoadBalancing; /* do load-balancing in parallel GC */
145 rtsBool setAffinity; /* force thread affinity with CPUs */
147 #endif /* THREADED_RTS */
150 rtsBool showTickyStats;
155 #define MAX_PAPI_USER_EVENTS 8
158 nat eventType; /* The type of events to count */
160 char * userEvents[MAX_PAPI_USER_EVENTS];
163 #define PAPI_FLAG_CACHE_L1 1
164 #define PAPI_FLAG_CACHE_L2 2
165 #define PAPI_FLAG_BRANCH 3
166 #define PAPI_FLAG_STALLS 4
167 #define PAPI_FLAG_CB_EVENTS 5
168 #define PAPI_USER_EVENTS 6
172 /* Put them together: */
174 typedef struct _RTS_FLAGS {
175 /* The first portion of RTS_FLAGS is invariant. */
176 struct GC_FLAGS GcFlags;
177 struct CONCURRENT_FLAGS ConcFlags;
178 struct MISC_FLAGS MiscFlags;
179 struct DEBUG_FLAGS DebugFlags;
180 struct COST_CENTRE_FLAGS CcFlags;
181 struct PROFILING_FLAGS ProfFlags;
183 struct EVENTLOG_FLAGS EventLogFlags;
185 struct TICKY_FLAGS TickyFlags;
187 #if defined(THREADED_RTS)
188 struct PAR_FLAGS ParFlags;
191 struct PAPI_FLAGS PapiFlags;
195 #ifdef COMPILING_RTS_MAIN
196 extern DLLIMPORT RTS_FLAGS RtsFlags;
198 /* Hack because the C code generator can't generate '&label'. */
199 extern RTS_FLAGS RtsFlags[];
201 extern RTS_FLAGS RtsFlags;
204 /* Routines that operate-on/to-do-with RTS flags: */
206 extern void initRtsFlagsDefaults(void);
207 extern void setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[]);
208 extern void setProgName(char *argv[]);
212 * The printf formats are here, so we are less likely to make
213 * overly-long filenames (with disastrous results). No more than 128
217 #define STATS_FILENAME_MAXLEN 128
219 #define GR_FILENAME_FMT "%0.124s.gr"
220 #define GR_FILENAME_FMT_GUM "%0.120s.%03d.%s"
221 #define HP_FILENAME_FMT "%0.124s.hp"
222 #define LIFE_FILENAME_FMT "%0.122s.life"
223 #define PROF_FILENAME_FMT "%0.122s.prof"
224 #define PROF_FILENAME_FMT_GUM "%0.118s.%03d.prof"
225 #define QP_FILENAME_FMT "%0.124s.qp"
226 #define STAT_FILENAME_FMT "%0.122s.stat"
227 #define TICKY_FILENAME_FMT "%0.121s.ticky"
228 #define TIME_FILENAME_FMT "%0.122s.time"
229 #define TIME_FILENAME_FMT_GUM "%0.118s.%03d.time"
231 /* an "int" so as to match normal "argc" */
232 /* Now defined in Stg.h (lib/std/cbits need these too.)
233 extern int prog_argc;
234 extern char **prog_argv;
236 extern int rts_argc; /* ditto */
237 extern char *rts_argv[];
239 #endif /* RTSFLAGS_H */